@ledgerhq/device-management-kit 0.0.0-signer-eth-plugin-fix-20250331141239 → 0.0.0-web-ble-29-08---20250829104351
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 +40 -3
- package/lib/cjs/package.json +22 -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/apdu/utils/ByteArrayBuilder.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
- package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
- package/lib/cjs/src/api/command/di/commandModule.js +1 -1
- package/lib/cjs/src/api/command/di/commandModule.js.map +3 -3
- package/lib/cjs/src/api/command/di/commandModule.test.js +1 -1
- package/lib/cjs/src/api/command/di/commandModule.test.js.map +2 -2
- 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/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/command/utils/GlobalCommandError.js +1 -1
- package/lib/cjs/src/api/command/utils/GlobalCommandError.js.map +2 -2
- package/lib/cjs/src/api/device/DeviceModel.js +1 -1
- package/lib/cjs/src/api/device/DeviceModel.js.map +2 -2
- 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/di/deviceActionModule.js +1 -1
- package/lib/cjs/src/api/device-action/di/deviceActionModule.js.map +3 -3
- package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js +1 -1
- package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
- 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/GoToDashboardDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
- 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/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js.map +1 -1
- 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 +1 -1
- 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-action/xstate-utils/XStateDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +2 -2
- 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/data/StaticDeviceModelDataSource.test.js +1 -1
- package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.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/index.js +1 -1
- package/lib/cjs/src/api/index.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/types.js.map +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +1 -1
- 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/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 +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/task/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/types.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/utils.js +1 -1
- package/lib/cjs/src/api/secure-channel/utils.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/utils.test.js +1 -1
- package/lib/cjs/src/api/secure-channel/utils.test.js.map +3 -3
- 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/DeviceConnectionStateMachine.test.js +2 -0
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.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/types.js +1 -1
- package/lib/cjs/src/api/types.js.map +1 -1
- package/lib/cjs/src/api/utils/AppName.js +2 -0
- package/lib/cjs/src/api/utils/AppName.js.map +7 -0
- package/lib/cjs/src/api/utils/AppName.test.js +2 -0
- package/lib/cjs/src/api/utils/AppName.test.js.map +7 -0
- package/lib/cjs/src/di.js +1 -1
- package/lib/cjs/src/di.js.map +2 -2
- package/lib/cjs/src/internal/config/di/configModule.js +1 -1
- package/lib/cjs/src/internal/config/di/configModule.js.map +3 -3
- package/lib/cjs/src/internal/config/di/configModule.test.js +1 -1
- package/lib/cjs/src/internal/config/di/configModule.test.js.map +2 -2
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.js +1 -1
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.js.map +3 -3
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js +1 -1
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.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/di/deviceSessionModule.js +1 -1
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
- package/lib/cjs/src/internal/device-session/model/DevicePinger.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DevicePinger.js.map +3 -3
- 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/DeviceSessionStateHandler.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +3 -3
- 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/DefaultApduSenderService.test.js +1 -1
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
- 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/discovery/di/discoveryModule.js +1 -1
- package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
- package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
- package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
- 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 +2 -2
- 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/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/logger-publisher/di/loggerModule.js +1 -1
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
- 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/di/secureChannelModule.js +1 -1
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
- package/lib/cjs/src/internal/secure-channel/model/Errors.js +1 -1
- package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +3 -3
- 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/di/sendModule.js +1 -1
- package/lib/cjs/src/internal/send/di/sendModule.js.map +3 -3
- package/lib/cjs/src/internal/send/di/sendModule.test.js +1 -1
- package/lib/cjs/src/internal/send/di/sendModule.test.js.map +2 -2
- 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/transport/di/transportModule.js +1 -1
- package/lib/cjs/src/internal/transport/di/transportModule.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 +22 -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/apdu/utils/ByteArrayBuilder.js +1 -1
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
- package/lib/esm/src/api/apdu/utils/ByteArrayParser.js +1 -1
- package/lib/esm/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
- package/lib/esm/src/api/command/di/commandModule.js +1 -1
- package/lib/esm/src/api/command/di/commandModule.js.map +3 -3
- package/lib/esm/src/api/command/di/commandModule.test.js +1 -1
- package/lib/esm/src/api/command/di/commandModule.test.js.map +2 -2
- 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/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/command/utils/GlobalCommandError.js +1 -1
- package/lib/esm/src/api/command/utils/GlobalCommandError.js.map +2 -2
- package/lib/esm/src/api/device/DeviceModel.js +1 -1
- package/lib/esm/src/api/device/DeviceModel.js.map +2 -2
- 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/di/deviceActionModule.js +1 -1
- package/lib/esm/src/api/device-action/di/deviceActionModule.js.map +3 -3
- package/lib/esm/src/api/device-action/di/deviceActionModule.test.js +1 -1
- package/lib/esm/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
- 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/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
- 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/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
- 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-action/xstate-utils/XStateDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +2 -2
- 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/data/StaticDeviceModelDataSource.test.js +1 -1
- package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.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/index.js +1 -1
- package/lib/esm/src/api/index.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/InstallApp/InstallAppDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +3 -3
- 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/types.js +1 -1
- 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 +1 -1
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +3 -3
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
- package/lib/esm/src/api/secure-channel/task/types.js +1 -1
- package/lib/esm/src/api/secure-channel/task/types.js.map +2 -2
- package/lib/esm/src/api/secure-channel/utils.js +1 -1
- package/lib/esm/src/api/secure-channel/utils.js.map +3 -3
- package/lib/esm/src/api/secure-channel/utils.test.js +1 -1
- package/lib/esm/src/api/secure-channel/utils.test.js.map +3 -3
- 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/DeviceConnectionStateMachine.test.js +2 -0
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.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/utils/AppName.js +2 -0
- package/lib/esm/src/api/utils/AppName.js.map +7 -0
- package/lib/esm/src/api/utils/AppName.test.js +2 -0
- package/lib/esm/src/api/utils/AppName.test.js.map +7 -0
- package/lib/esm/src/di.js +1 -1
- package/lib/esm/src/di.js.map +3 -3
- package/lib/esm/src/internal/config/di/configModule.js +1 -1
- package/lib/esm/src/internal/config/di/configModule.js.map +3 -3
- package/lib/esm/src/internal/config/di/configModule.test.js +1 -1
- package/lib/esm/src/internal/config/di/configModule.test.js.map +2 -2
- package/lib/esm/src/internal/device-model/di/deviceModelModule.js +1 -1
- package/lib/esm/src/internal/device-model/di/deviceModelModule.js.map +3 -3
- package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js +1 -1
- package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
- 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/di/deviceSessionModule.js +1 -1
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
- package/lib/esm/src/internal/device-session/model/DevicePinger.js +1 -1
- package/lib/esm/src/internal/device-session/model/DevicePinger.js.map +3 -3
- 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/DeviceSessionStateHandler.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +3 -3
- 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/DefaultApduSenderService.test.js +1 -1
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
- 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/discovery/di/discoveryModule.js +1 -1
- package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
- package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
- package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
- 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 +2 -2
- 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/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/logger-publisher/di/loggerModule.js +1 -1
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
- 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/di/secureChannelModule.js +1 -1
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
- package/lib/esm/src/internal/secure-channel/model/Errors.js +1 -1
- package/lib/esm/src/internal/secure-channel/model/Errors.js.map +3 -3
- 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/di/sendModule.js +1 -1
- package/lib/esm/src/internal/send/di/sendModule.js.map +3 -3
- package/lib/esm/src/internal/send/di/sendModule.test.js +1 -1
- package/lib/esm/src/internal/send/di/sendModule.test.js.map +2 -2
- 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/transport/di/transportModule.js +1 -1
- package/lib/esm/src/internal/transport/di/transportModule.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 +11 -1
- 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/apdu/utils/ApduBuilder.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/ApduParser.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts +28 -0
- package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts +1 -0
- package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts.map +1 -1
- package/lib/types/src/api/command/di/commandModule.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/CommandErrors.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/CommandUtils.d.ts +4 -0
- package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/GlobalCommandError.d.ts +1 -1
- package/lib/types/src/api/command/utils/GlobalCommandError.d.ts.map +1 -1
- package/lib/types/src/api/device/DeviceModel.d.ts +2 -1
- package/lib/types/src/api/device/DeviceModel.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 +5 -0
- package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
- package/lib/types/src/api/device-action/di/deviceActionModule.d.ts.map +1 -1
- package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +1 -0
- package/lib/types/src/api/device-action/model/UserInteractionRequired.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 -1
- 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 +20 -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 +28 -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/GoToDashboardDeviceAction.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 +65 -0
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts +0 -1
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
- 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 +24 -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 -1
- 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-action/xstate-utils/XStateDeviceAction.d.ts +1 -0
- package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts.map +1 -1
- 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/device-session/service/DefaultApduReceiverService.stub.d.ts.map +1 -1
- package/lib/types/src/api/device-session/service/DefaultApduSenderService.stub.d.ts.map +1 -1
- package/lib/types/src/api/index.d.ts +6 -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.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts.map +1 -1
- 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/types.d.ts +2 -1
- 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.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +5 -2
- package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/task/types.d.ts +6 -1
- package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/utils.d.ts +0 -11
- package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -1
- 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 +63 -0
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -0
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts +2 -0
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.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 +27 -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 +6 -2
- package/lib/types/src/api/types.d.ts.map +1 -1
- package/lib/types/src/api/utils/AppName.d.ts +2 -0
- package/lib/types/src/api/utils/AppName.d.ts.map +1 -0
- package/lib/types/src/api/utils/AppName.test.d.ts +2 -0
- package/lib/types/src/api/utils/AppName.test.d.ts.map +1 -0
- package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
- package/lib/types/src/di.d.ts.map +1 -1
- package/lib/types/src/internal/config/di/configModule.d.ts.map +1 -1
- package/lib/types/src/internal/device-model/di/deviceModelModule.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/di/deviceSessionModule.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DevicePinger.d.ts +1 -1
- package/lib/types/src/internal/device-session/model/DevicePinger.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +3 -1
- 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.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/Frame.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.map +1 -1
- package/lib/types/src/internal/discovery/di/discoveryModule.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/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/logger-publisher/di/loggerModule.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/di/secureChannelModule.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/model/Errors.d.ts +22 -2
- package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +2 -2
- 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 +3 -3
- package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -1
- package/lib/types/src/internal/send/di/sendModule.d.ts.map +1 -1
- package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts +9 -1
- package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/transport/di/transportModule.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 +16 -17
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../../src/api/device-action/os/ListApps/ListAppsDeviceAction.ts"],
|
4
|
-
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n type AppResponse,\n ListAppsCommand,\n type ListAppsCommandResult,\n} from \"@api/command/os/ListAppsCommand\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\n\nimport {\n type ListAppsDAError,\n type ListAppsDAInput,\n type ListAppsDAIntermediateValue,\n type ListAppsDAOutput,\n} from \"./types\";\n\ntype ListAppsMachineInternalState = {\n readonly error: ListAppsDAError | null;\n readonly apps: AppResponse[];\n readonly shouldContinue: boolean;\n};\n\nexport type MachineDependencies = {\n readonly listApps: ({\n input,\n }: {\n input: boolean;\n }) => Promise<ListAppsCommandResult>;\n};\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class ListAppsDeviceAction extends XStateDeviceAction<\n ListAppsDAOutput,\n ListAppsDAInput,\n ListAppsDAError,\n ListAppsDAIntermediateValue,\n ListAppsMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n ListAppsDAOutput,\n ListAppsDAInput,\n ListAppsDAError,\n ListAppsDAIntermediateValue,\n ListAppsMachineInternalState\n > {\n type types = StateMachineTypes<\n ListAppsDAOutput,\n ListAppsDAInput,\n ListAppsDAError,\n ListAppsDAIntermediateValue,\n ListAppsMachineInternalState\n >;\n\n const { listApps } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const goToDashboardMachine = new GoToDashboardDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalApi);\n\n return setup({\n types: {\n input: {\n unlockTimeout,\n } as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n listApps: fromPromise<ListAppsCommandResult, boolean>(listApps),\n goToDashboard: goToDashboardMachine,\n },\n guards: {\n hasError: ({ context }: { context: types[\"context\"] }) => {\n return context._internalState.error !== null;\n },\n hasMoreApps: (_) => _.context._internalState.shouldContinue,\n },\n actions: {\n assignAllowListApps: assign({\n intermediateValue: (_) =>\n ({\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QBkCWsAuBBADj2AImAG6oDGYWZGqA9gHYB0RpFASmAIYQCeAxAG0ADAF1EoHLVioaDcSAAeiAIwBOIYwAcANgDsyzat2HlAJgDMegDQgeKg412ntAVm3mdp1af0uAvn42aJi4+CzklNR0TADitAAqtAScsAAWAEa0nABOEHwQDGCMqPTEtADWRRApGVm5wmJIIJLSsvTySgguquaMACy6rvrKfSOqfTZ2CKZC2v3K2ou6xn2mms7+gSDB2HiEJBFUbYxxiclpmTl5YNnZtNmMOAA2nBgAZvcAtozVF3UQDXkLRk0Q6iG6vQGQ2UIzGE1siE0ykYLiEaLRuiECxcbmUASC6F2YQOFCO0ROCSSNUuuQAwqkwGRyoJRECpCC5E1OsosZpHAZBi5zKpuhjJohTBZHBt3N5UapVGp8dtCaF9qxIsdTlS-ld6YzmQJlI0JOy2mCEDyHPpNILhaKhLpxQg+kI+ZjzGZdD0seYPMqdmrwqSogxGIG9vlCsVShUihHiRqyWGE7AECUymRXtEGoCmsDzVyVAM+cpzGtzKjvdp1ppnZWNNosW4+sLNEJUdo+gHVXtg5ryam+Dc7g9nq8Ptlvqn+8mmKn07Gs21c6z82bQUXLSXGGWK1XVDW1s6XMZ+kKzLaZk3XD2Qn2SQOU738HwFJhXkVOG8MDcABTKKiaIAJR8DOj5zuGL6wHmpqtJuoDcjue6aA21a1s6ejIuo2imDiCy6H0PS6HeRLqocobztBtIMDQ9AAK5gFG9BFBmcZQfeiYUccqY0fQdGMYumbZgwq4ms0G6cohKiaC4pZCOMQjlu4bguPWqyMJKrhdpKmLLNopFBhBlEcWRfECUxI73I8LzvF8plGUmJm8bRJSCWxy45qIsESfBUmKBKMzIjMnpyTitp+uY9ZyburYWDCfQ1ro5aGQ+TnHOZblMT5BYIQFlqoaojDaCK5iuq2XY1s6iW6I4h54bJlheKlXEhhlrkMdlxpsn57RbgYbiMLMeFrLpMxCiewqOOV4xEai6x4sq9C0BAcDyOB6V5bl-mdAAtNozq7S4jAKqdFgKdW+4teRbXkv2HDcFMcEcn10kuqYzowrVTjaR4TXrNds4mdq5y1FcPUvRaazHaVl5Cq66hqQiCDjJpMplQYmijClWwbdx5Ig9S-z6kyEOFm97bIqsh4KsKZYlQdyOSnywrluYsxDJTmwEpxN1PlRvNk3l3IGMiOIDB2ZWtq6H3I5WtV9BePhYm6gymIDxk8dRHWMULO0SlicyyYBPRlt4jXRXM2hqN6lg8j0GubWGmWdXrr35QsOhDbJh5+l44XwlM5hOCixhej4Ip9Ei3a49BQPHAAyvRZAULA8Drr1UM4nMMxeM4NaoR4TrI0KOczX0cWKo7+NhgAorc9xu1DoxFYBuE6O2OgKfWZ46EYimzAsXYBAEQA */\n id: \"ListAppsDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n error: null,\n apps: [],\n shouldContinue: false,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"GoToDashboard\",\n },\n },\n GoToDashboard: {\n invoke: {\n id: \"dashboard\",\n src: \"goToDashboard\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n target: \"GoToDashboardCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<ListAppsMachineInternalState>({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GoToDashboardCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"ListApps\",\n },\n ],\n },\n ListApps: {\n // NOTE: This is a timeout that is currently not used\n // We need to discuss this as a team, how do we want to\n // handle the case when the user does not validate or reject on the device\n // after: {\n // 15000: \"Error\",\n // actions: assign({\n // _internalState: (_) => ({\n // error: new UnknownDAError(\"ListAppsTimeout\"),\n // }),\n // }),\n // },\n entry: \"assignAllowListApps\",\n invoke: {\n src: \"listApps\",\n input: (_) => false,\n onDone: {\n target: \"Continue\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return {\n ..._.context._internalState,\n apps: _.context._internalState.apps.concat(\n _.event.output.data,\n ),\n shouldContinue: _.event.output.data.length === 2,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n ListAppsCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n \"ListAppsContinue\",\n ],\n },\n ListAppsContinue: {\n invoke: {\n src: \"listApps\",\n input: (_) => true,\n onDone: {\n target: \"Continue\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return {\n ..._.context._internalState,\n apps: _.context._internalState.apps.concat(\n _.event.output.data,\n ),\n shouldContinue: _.event.output.data.length === 2,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n Continue: {\n always: [\n {\n target: \"ListAppsContinue\",\n guard: \"hasMoreApps\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (_) => {\n if (_.context._internalState.error) {\n return Left(_.context._internalState.error);\n }\n\n return Right(_.context._internalState.apps);\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const listApps = async ({ input }: { input: boolean }) => {\n const command = new ListAppsCommand({ isContinue: input });\n return internalApi.sendCommand(command);\n };\n\n return {\n listApps,\n };\n }\n}\n"],
|
5
|
-
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAC5B,OAAS,UAAAC,EAAQ,eAAAC,EAAa,SAAAC,MAAa,SAE3C,OAAS,0BAAAC,MAA8B,mCACvC,OAEE,mBAAAC,MAEK,kCAEP,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,6BAAAC,MAAiC,8BAC1C,OAAS,6BAAAC,MAAiC,gEAE1C,OAEE,sBAAAC,MACK,qDA2BA,MAAMC,UAA6BD,CAMxC,CACA,iBACEE,EAOA,CASA,KAAM,CAAE,SAAAC,CAAS,EAAI,KAAK,oBAAoBD,CAAW,EAEnDE,EAAgB,KAAK,MAAM,eAAiBN,EAE5CO,EAAuB,IAAIN,EAA0B,CACzD,MAAO,CACL,cAAAK,CACF,CACF,CAAC,EAAE,iBAAiBF,CAAW,EAE/B,OAAOR,EAAM,CACX,MAAO,CACL,MAAO,CACL,cAAAU,CACF,EACA,QAAS,CAAC,EACV,OAAQ,CAAC,CACX,EACA,OAAQ,CACN,SAAUX,EAA4CU,CAAQ,EAC9D,cAAeE,CACjB,EACA,OAAQ,CACN,SAAU,CAAC,CAAE,QAAAC,CAAQ,IACZA,EAAQ,eAAe,QAAU,KAE1C,YAAcC,GAAMA,EAAE,QAAQ,eAAe,cAC/C,EACA,QAAS,CACP,oBAAqBf,EAAO,CAC1B,kBAAoBe,IACjB,CACC,wBAAyBV,EAAwB,aACnD,EACJ,CAAC,EACD,qBAAsBL,EAAO,CAC3B,eAAiBe,IAAO,CACtB,GAAGA,EAAE,QAAQ,eACb,MAAOA,EAAE,MAAM,KACjB,EACF,CAAC,CACH,CACF,CAAC,EAAE,cAAc,CAEf,GAAI,uBACJ,QAAS,cACT,QAAUA,IACD,CACL,MAAO,CACL,cAAeA,EAAE,MAAM,aACzB,EACA,kBAAmB,CACjB,wBAAyBV,EAAwB,IACnD,EACA,eAAgB,CACd,MAAO,KACP,KAAM,CAAC,EACP,eAAgB,EAClB,CACF,GAEF,OAAQ,CACN,YAAa,CACX,OAAQ,CACN,OAAQ,eACV,CACF,EACA,cAAe,CACb,OAAQ,CACN,GAAI,YACJ,IAAK,gBACL,MAAQU,IAAO,CACb,cAAeA,EAAE,QAAQ,MAAM,aACjC,GACA,WAAY,CACV,QAASf,EAAO,CACd,kBAAoBe,GAClBA,EAAE,MAAM,SAAS,QAAQ,iBAC7B,CAAC,CACH,EACA,OAAQ,CACN,OAAQ,qBACR,QAASf,EAAO,CACd,eAAiBe,GACRA,EAAE,MAAM,OAAO,OAAqC,CACzD,MAAO,IAAMA,EAAE,QAAQ,eACvB,KAAOC,IAAW,CAChB,GAAGD,EAAE,QAAQ,eACb,MAAAC,CACF,EACF,CAAC,CAEL,CAAC,CACH,EACA,QAAS,CACP,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,mBAAoB,CAClB,OAAQ,CACN,CACE,OAAQ,QACR,MAAO,UACT,EACA,CACE,OAAQ,UACV,CACF,CACF,EACA,SAAU,CAYR,MAAO,sBACP,OAAQ,CACN,IAAK,WACL,MAAQD,GAAM,GACd,OAAQ,CACN,OAAQ,WACR,QAASf,EAAO,CACd,eAAiBe,GACXZ,EAAuBY,EAAE,MAAM,MAAM,EAChC,CACL,GAAGA,EAAE,QAAQ,eACb,KAAMA,EAAE,QAAQ,eAAe,KAAK,OAClCA,EAAE,MAAM,OAAO,IACjB,EACA,eAAgBA,EAAE,MAAM,OAAO,KAAK,
|
4
|
+
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n type AppResponse,\n ListAppsCommand,\n type ListAppsCommandResult,\n} from \"@api/command/os/ListAppsCommand\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\n\nimport {\n type ListAppsDAError,\n type ListAppsDAInput,\n type ListAppsDAIntermediateValue,\n type ListAppsDAOutput,\n} from \"./types\";\n\ntype ListAppsMachineInternalState = {\n readonly error: ListAppsDAError | null;\n readonly apps: AppResponse[];\n readonly shouldContinue: boolean;\n};\n\nexport type MachineDependencies = {\n readonly listApps: ({\n input,\n }: {\n input: boolean;\n }) => Promise<ListAppsCommandResult>;\n};\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class ListAppsDeviceAction extends XStateDeviceAction<\n ListAppsDAOutput,\n ListAppsDAInput,\n ListAppsDAError,\n ListAppsDAIntermediateValue,\n ListAppsMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n ListAppsDAOutput,\n ListAppsDAInput,\n ListAppsDAError,\n ListAppsDAIntermediateValue,\n ListAppsMachineInternalState\n > {\n type types = StateMachineTypes<\n ListAppsDAOutput,\n ListAppsDAInput,\n ListAppsDAError,\n ListAppsDAIntermediateValue,\n ListAppsMachineInternalState\n >;\n\n const { listApps } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const goToDashboardMachine = new GoToDashboardDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalApi);\n\n return setup({\n types: {\n input: {\n unlockTimeout,\n } as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n listApps: fromPromise<ListAppsCommandResult, boolean>(listApps),\n goToDashboard: goToDashboardMachine,\n },\n guards: {\n hasError: ({ context }: { context: types[\"context\"] }) => {\n return context._internalState.error !== null;\n },\n hasMoreApps: (_) => _.context._internalState.shouldContinue,\n },\n actions: {\n assignAllowListApps: assign({\n intermediateValue: (_) =>\n ({\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QBkCWsAuBBADj2AImAG6oDGYWZGqA9gHYB0RpFASmAIYQCeAxAG0ADAF1EoHLVioaDcSAAeiAIwBOIYwAcANgDsyzat2HlAJgDMegDQgeKg412ntAVm3mdp1af0uAvn42aJi4+CzklNR0TADitAAqtAScsAAWAEa0nABOEHwQDGCMqPTEtADWRRApGVm5wmJIIJLSsvTySgguquaMACy6rvrKfSOqfTZ2CKZC2v3K2ou6xn2mms7+gSDB2HiEJBFUbYxxiclpmTl5YNnZtNmMOAA2nBgAZvcAtozVF3UQDXkLRk0Q6iG6vQGQ2UIzGE1siE0ykYLiEaLRuiECxcbmUASC6F2YQOFCO0ROCSSNUuuQAwqkwGRyoJRECpCC5E1OsosZpHAZBi5zKpuhjJohTBZHBt3N5UapVGp8dtCaF9qxIsdTlS-ld6YzmQJlI0JOy2mCEDyHPpNILhaKhLpxQg+kI+ZjzGZdD0seYPMqdmrwqSogxGIG9vlCsVShUihHiRqyWGE7AECUymRXtEGoCmsDzVyVAM+cpzGtzKjvdp1ppnZWNNosW4+sLNEJUdo+gHVXtg5ryam+Dc7g9nq8Ptlvqn+8mmKn07Gs21c6z82bQUXLSXGGWK1XVDW1s6XMZ+kKzLaZk3XD2Qn2SQOU738HwFJhXkVOG8MDcABTKKiaIAJR8DOj5zuGL6wHmpqtJuoDcjue6aA21a1s6ejIuo2imDiCy6H0PS6HeRLqocobztBtIMDQ9AAK5gFG9BFBmcZQfeiYUccqY0fQdGMYumbZgwq4ms0G6cohKiaC4pZCOMQjlu4bguPWqyMJKrhdpKmLLNopFBhBlEcWRfECUxI73I8LzvF8plGUmJm8bRJSCWxy45qIsESfBUmKBKMzIjMnpyTitp+uY9ZyburYWDCfQ1ro5aGQ+TnHOZblMT5BYIQFlqoaojDaCK5iuq2XY1s6iW6I4h54bJlheKlXEhhlrkMdlxpsn57RbgYbiMLMeFrLpMxCiewqOOV4xEai6x4sq9C0BAcDyOB6V5bl-mdAAtNozq7S4jAKqdFgKdW+4teRbXkv2HDcFMcEcn10kuqYzowrVTjaR4TXrNds4mdq5y1FcPUvRaazHaVl5Cq66hqQiCDjJpMplQYmijClWwbdx5Ig9S-z6kyEOFm97bIqsh4KsKZYlQdyOSnywrluYsxDJTmwEpxN1PlRvNk3l3IGMiOIDB2ZWtq6H3I5WtV9BePhYm6gymIDxk8dRHWMULO0SlicyyYBPRlt4jXRXM2hqN6lg8j0GubWGmWdXrr35QsOhDbJh5+l44XwlM5hOCixhej4Ip9Ei3a49BQPHAAyvRZAULA8Drr1UM4nMMxeM4NaoR4TrI0KOczX0cWKo7+NhgAorc9xu1DoxFYBuE6O2OgKfWZ46EYimzAsXYBAEQA */\n id: \"ListAppsDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n error: null,\n apps: [],\n shouldContinue: false,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"GoToDashboard\",\n },\n },\n GoToDashboard: {\n invoke: {\n id: \"dashboard\",\n src: \"goToDashboard\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n target: \"GoToDashboardCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<ListAppsMachineInternalState>({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GoToDashboardCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"ListApps\",\n },\n ],\n },\n ListApps: {\n // NOTE: This is a timeout that is currently not used\n // We need to discuss this as a team, how do we want to\n // handle the case when the user does not validate or reject on the device\n // after: {\n // 15000: \"Error\",\n // actions: assign({\n // _internalState: (_) => ({\n // error: new UnknownDAError(\"ListAppsTimeout\"),\n // }),\n // }),\n // },\n entry: \"assignAllowListApps\",\n invoke: {\n src: \"listApps\",\n input: (_) => false,\n onDone: {\n target: \"Continue\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return {\n ..._.context._internalState,\n apps: _.context._internalState.apps.concat(\n _.event.output.data,\n ),\n shouldContinue: _.event.output.data.length >= 2,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n ListAppsCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n \"ListAppsContinue\",\n ],\n },\n ListAppsContinue: {\n invoke: {\n src: \"listApps\",\n input: (_) => true,\n onDone: {\n target: \"Continue\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return {\n ..._.context._internalState,\n apps: _.context._internalState.apps.concat(\n _.event.output.data,\n ),\n shouldContinue: _.event.output.data.length >= 2,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n Continue: {\n always: [\n {\n target: \"ListAppsContinue\",\n guard: \"hasMoreApps\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (_) => {\n if (_.context._internalState.error) {\n return Left(_.context._internalState.error);\n }\n\n return Right(_.context._internalState.apps);\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const listApps = async ({ input }: { input: boolean }) => {\n const command = new ListAppsCommand({ isContinue: input });\n return internalApi.sendCommand(command);\n };\n\n return {\n listApps,\n };\n }\n}\n"],
|
5
|
+
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAC5B,OAAS,UAAAC,EAAQ,eAAAC,EAAa,SAAAC,MAAa,SAE3C,OAAS,0BAAAC,MAA8B,mCACvC,OAEE,mBAAAC,MAEK,kCAEP,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,6BAAAC,MAAiC,8BAC1C,OAAS,6BAAAC,MAAiC,gEAE1C,OAEE,sBAAAC,MACK,qDA2BA,MAAMC,UAA6BD,CAMxC,CACA,iBACEE,EAOA,CASA,KAAM,CAAE,SAAAC,CAAS,EAAI,KAAK,oBAAoBD,CAAW,EAEnDE,EAAgB,KAAK,MAAM,eAAiBN,EAE5CO,EAAuB,IAAIN,EAA0B,CACzD,MAAO,CACL,cAAAK,CACF,CACF,CAAC,EAAE,iBAAiBF,CAAW,EAE/B,OAAOR,EAAM,CACX,MAAO,CACL,MAAO,CACL,cAAAU,CACF,EACA,QAAS,CAAC,EACV,OAAQ,CAAC,CACX,EACA,OAAQ,CACN,SAAUX,EAA4CU,CAAQ,EAC9D,cAAeE,CACjB,EACA,OAAQ,CACN,SAAU,CAAC,CAAE,QAAAC,CAAQ,IACZA,EAAQ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MC,EAAU,IAAId,EAAgB,CAAE,WAAYa,CAAM,CAAC,EACzD,OAAOP,EAAY,YAAYQ,CAAO,CACxC,CAIA,CACF,CACF",
|
6
6
|
"names": ["Left", "Right", "assign", "fromPromise", "setup", "isSuccessCommandResult", "ListAppsCommand", "UserInteractionRequired", "DEFAULT_UNLOCK_TIMEOUT_MS", "GoToDashboardDeviceAction", "XStateDeviceAction", "ListAppsDeviceAction", "internalApi", "listApps", "unlockTimeout", "goToDashboardMachine", "context", "_", "error", "input", "command"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{Left as D,Right as
|
1
|
+
import{Left as D,Right as g}from"purify-ts";import{assign as t,fromPromise as c,setup as y}from"xstate";import{isSuccessCommandResult as u}from"../../../command/model/CommandResult";import{CloseAppCommand as O}from"../../../command/os/CloseAppCommand";import{OpenAppCommand as v}from"../../../command/os/OpenAppCommand";import{UserInteractionRequired as i}from"../../../device-action/model/UserInteractionRequired";import{DEFAULT_UNLOCK_TIMEOUT_MS as h}from"../../../device-action/os/Const";import{DeviceNotOnboardedError as E}from"../../../device-action/os/Errors";import{GetDeviceStatusDeviceAction as f}from"../../../device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction";import{XStateDeviceAction as R}from"../../../device-action/xstate-utils/XStateDeviceAction";import{DeviceSessionStateType as l}from"../../../device-session/DeviceSessionState";import{DeviceDisconnectedWhileSendingError as C}from"../../../transport/model/Errors";import{isDashboardName as x}from"../../../utils/AppName";class W extends R{makeStateMachine(r){const{closeApp:o,openApp:s,getDeviceSessionState:a,isDeviceOnboarded:A,setDeviceSessionState:d}=this.extractDependencies(r),S=this.input.unlockTimeout??h,m=new f({input:{unlockTimeout:S}}).makeStateMachine(r);return y({types:{input:{},context:{},output:{}},actors:{closeApp:c(o),openApp:c(s),getDeviceStatus:m},guards:{isDeviceOnboarded:()=>A(),isRequestedAppOpen:({context:e})=>e._internalState.currentlyRunningApp===null?!1:e._internalState.currentlyRunningApp===e.input.appName,isDashboardOpen:({context:e})=>{if(e._internalState.currentlyRunningApp===null)throw new Error("context.currentlyRunningApp === null");return x(e._internalState.currentlyRunningApp)},hasDisconnectedWhileSending:({context:e})=>e._internalState.error!==null&&e._internalState.error instanceof C,hasError:({context:e})=>e._internalState.error!==null},actions:{assignErrorDeviceNotOnboarded:t({_internalState:e=>({...e.context._internalState,error:new E})}),assignUserActionNeededOpenApp:t({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:i.ConfirmOpenApp})}),assignNoUserActionNeeded:t({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:i.None})}),assignErrorFromEvent:t({_internalState:e=>({...e.context._internalState,error:e.event.error})}),assignNoError:t({_internalState:e=>({...e.context._internalState,error:null})})}}).createMachine({id:"OpenAppDeviceAction",initial:"DeviceReady",context:({input:e})=>{const n=a(),{sessionStateType:p}=n;return{input:e,intermediateValue:{requiredUserInteraction:i.None},_internalState:{error:null,currentlyRunningApp:p===l.ReadyWithoutSecureChannel?n.currentApp.name:null}}},states:{DeviceReady:{always:{target:"OnboardingCheck"}},OnboardingCheck:{always:[{target:"GetDeviceStatus",guard:{type:"isDeviceOnboarded"}},{target:"Error",actions:"assignErrorDeviceNotOnboarded"}]},GetDeviceStatus:{invoke:{id:"deviceStatus",src:"getDeviceStatus",input:e=>({unlockTimeout:e.context.input.unlockTimeout}),onSnapshot:{actions:t({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{target:"CheckDeviceStatus",actions:t({_internalState:e=>e.event.output.caseOf({Right:n=>{const p=a();return p.sessionStateType!==l.Connected&&d({...p,currentApp:{name:n.currentApp,version:n.currentAppVersion}}),{...e.context._internalState,currentlyRunningApp:n.currentApp}},Left:n=>({...e.context._internalState,currentlyRunningApp:null,error:n})})})},onError:{target:"Error",actions:[t({_internalState:e=>({...e.context._internalState,currentlyRunningApp:null})}),"assignErrorFromEvent"]}}},CheckDeviceStatus:{always:[{target:"ApplicationReady",guard:"isRequestedAppOpen",actions:"assignNoError"},{target:"Error",guard:"hasError"},{target:"DashboardCheck"}]},DashboardCheck:{always:[{target:"OpenApplication",guard:"isDashboardOpen"},"CloseApplication"]},OpenApplication:{entry:"assignUserActionNeededOpenApp",exit:"assignNoUserActionNeeded",invoke:{src:"openApp",input:({context:e})=>({appName:e.input.appName}),onDone:{target:"OpenApplicationResultCheck",actions:t({_internalState:e=>u(e.event.output)?{...e.context._internalState,currentlyRunningApp:e.context.input.appName}:{...e.context._internalState,error:e.event.output.error}})},onError:{target:"OpenApplicationResultCheck",actions:"assignErrorFromEvent"}}},OpenApplicationResultCheck:{always:[{target:"GetDeviceStatus",guard:"hasDisconnectedWhileSending"},{target:"Error",guard:"hasError"},{target:"GetDeviceStatus"}]},CloseApplication:{invoke:{src:"closeApp",onDone:{target:"CloseApplicationResultCheck",actions:t({_internalState:e=>u(e.event.output)?{...e.context._internalState,currentlyRunningApp:"BOLOS"}:{...e.context._internalState,error:e.event.output.error}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},CloseApplicationResultCheck:{always:[{target:"Error",guard:"hasError"},{target:"OpenApplication"}]},ApplicationReady:{always:"Success"},Success:{type:"final",actions:"assignNoError"},Error:{type:"final"}},output:({context:e})=>e._internalState.error?D(e._internalState.error):g(void 0)})}extractDependencies(r){return{closeApp:async()=>r.sendCommand(new O),openApp:async a=>r.sendCommand(new v({appName:a.input.appName})),getDeviceSessionState:()=>r.getDeviceSessionState(),setDeviceSessionState:a=>r.setDeviceSessionState(a),isDeviceOnboarded:()=>!0}}}export{W as OpenAppDeviceAction};
|
2
2
|
//# sourceMappingURL=OpenAppDeviceAction.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../../src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.ts"],
|
4
|
-
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n CloseAppCommand,\n type CloseAppCommandResult,\n} from \"@api/command/os/CloseAppCommand\";\nimport {\n OpenAppCommand,\n type OpenAppCommandResult,\n} from \"@api/command/os/OpenAppCommand\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { DeviceNotOnboardedError } from \"@api/device-action/os/Errors\";\nimport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\n\nimport {\n type OpenAppDAError,\n type OpenAppDAInput,\n type OpenAppDAIntermediateValue,\n type OpenAppDAOutput,\n} from \"./types\";\n\ntype OpenAppStateMachineInternalState = {\n readonly currentlyRunningApp: string | null;\n readonly error: OpenAppDAError | null;\n};\n\nexport type MachineDependencies = {\n readonly closeApp: () => Promise<CloseAppCommandResult>;\n readonly openApp: (arg0: {\n input: { appName: string };\n }) => Promise<OpenAppCommandResult>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly setDeviceSessionState: (state: DeviceSessionState) => void;\n readonly isDeviceOnboarded: () => boolean;\n};\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\n/**\n * Opens a given app on the device.\n *\n * It checks if the device is onboarded, unlocked, and which app is currently open.\n * If the current app is the dashboard, it will directly open the requested app.\n * If another app is opened, it will close the current app and open the requested app.\n *\n * Example of usage:\n *\n * ```ts\n * const deviceAction = new OpenAppDeviceAction({\n * input: {\n * appName: \"MyApp\",\n * },\n * });\n * dmk.executeDeviceAction({ sessionId: \"mySessionId\", deviceAction });\n * ```\n */\nexport class OpenAppDeviceAction extends XStateDeviceAction<\n OpenAppDAOutput,\n OpenAppDAInput,\n OpenAppDAError,\n OpenAppDAIntermediateValue,\n OpenAppStateMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n OpenAppDAOutput,\n OpenAppDAInput,\n OpenAppDAError,\n OpenAppDAIntermediateValue,\n OpenAppStateMachineInternalState\n > {\n type types = StateMachineTypes<\n OpenAppDAOutput,\n OpenAppDAInput,\n OpenAppDAError,\n OpenAppDAIntermediateValue,\n OpenAppStateMachineInternalState\n >;\n\n const {\n closeApp,\n openApp,\n getDeviceSessionState,\n isDeviceOnboarded,\n setDeviceSessionState,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const getDeviceStatusMachine = new GetDeviceStatusDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalApi);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n closeApp: fromPromise(closeApp),\n openApp: fromPromise(openApp),\n getDeviceStatus: getDeviceStatusMachine,\n },\n guards: {\n isDeviceOnboarded: () => isDeviceOnboarded(), // TODO: we don't have this info for now, this can be derived from the \"flags\" obtained in the getVersion command\n isRequestedAppOpen: ({ context }: { context: types[\"context\"] }) => {\n if (context._internalState.currentlyRunningApp === null)\n throw new Error(\"context.currentlyRunningApp === null\");\n return (\n context._internalState.currentlyRunningApp ===\n context.input.appName ||\n (context.input.compatibleAppNames !== undefined &&\n context.input.compatibleAppNames.includes(\n context._internalState.currentlyRunningApp,\n ))\n );\n },\n isDashboardOpen: ({ context }: { context: types[\"context\"] }) => {\n if (context._internalState.currentlyRunningApp === null)\n throw new Error(\"context.currentlyRunningApp === null\");\n return context._internalState.currentlyRunningApp === \"BOLOS\";\n },\n hasError: ({ context }) => context._internalState.error !== null,\n },\n actions: {\n assignErrorDeviceNotOnboarded: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceNotOnboardedError(),\n }),\n }),\n assignUserActionNeededOpenApp: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignNoUserActionNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // FIXME: add a typeguard\n }),\n }),\n assignNoError: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: null,\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHkAOYB2BBVqAiYAbgJYDGYWpALsQPYYB0BJ5ASmAIYQCeAxANoAGALqJQqWrGI16YkAA9EARhWCGADgAsAZm1b1SwUoDspgDQhuiAEzX1DbQE5tJlQDYlm414CsAXz8LNEwcfCIyCmo6RmQMACNaDgAnCGIMKABhAAswUgBrARE5CSkZDDlFBCUPbQYfZx91H0FtTRNjCysEbWM1bTdHAzcfH2q9awCg9GxcZgjKMoZYhOTU9Ozcgv4lUSQQEuloiuUauoamlrbzSxtBNTu7pW1BEe1rJUmQYJmwlkjFgAytHyaUyOXyhV24kkh1ke0q7w8DDcxmqjkM1l6Kh8nUQzR8DEEjjcz3UxKUjiMbk+31Cc3IC2iDCBIPW4K2O2KMLKxwQiKUyNRAwxWKUOJu3TaDFsw28bkExmsgnU-Rp0zp4QZUXoDFCABsyBwylhCBxiHqOHE9WBeBB6GAGGlCLQ8g7abNNf8mfrDcbTebLdaEE7gUbokJhBGuaUjvCbCSCdZNI5UQqhg1cQhNOprAxND4XP0xZTHI01SEPX9GTqfaQw-QTWaLVabWAkklaE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ATwA2RM7rknUm4FUhV-oiTJFTCUth05j0xJVFUTxt7sIOssRIKRQRyV4bdWOTNkTqDekqAwbxNDIUzFIhwzhZHVHkf0akZ9rKFx1CyPI6j2SaJjsoUsBIBimB8MMeUZJqFdH6PYDwKYBjwQaEYpRtlOYzlfC2NxS8bB6HsM4RUIwiSH0VNxAy6lkL1EEjTYUtisLn1ISAhuDZZxvhvpsRJmVX51FJFlZ4-Qk5wUYcxR2BTTIGUKtEvCoDpwaMUobbqugUzIg8PmEwIiTJ9yqAMaUW90IngCaIgZcUEpJVUa1Vxoy+GVGMbvZiuVf5IM8CoTZOpNZDL4eQjcIlDLIRRH5FhoxDyIGFMiASe8IoFlGNchaS0waxNqfkepG4tACiMGeQw6IiQeBGncMaMycxEl8eoIFu0fiVPbg87qSE3q6MVBpehPQ4K6G+uoZUJIVB7laNiq+2s4DkRGYTLRygs6GSQtmO4iIaWljgvUBgip-K5RErofOdiYocLBZwHhBzOWSkKqKz6Lw3i6U+QgPchlTB7xTPBeCWVHDYoAMqflIOQWA8AlXuO6KMQylImipgMi4BZzhDIKkpM0FEypRimplXNWyABRMuSRIXjNaKvHQ3h0Q0reCYT+3khGNEKgqIRxgAgBCAA */\n id: \"OpenAppDeviceAction\",\n initial: \"DeviceReady\",\n context: ({ input }) => {\n const sessionState = getDeviceSessionState();\n const { sessionStateType } = sessionState;\n return {\n input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n error: null,\n currentlyRunningApp:\n sessionStateType ===\n DeviceSessionStateType.ReadyWithoutSecureChannel\n ? sessionState.currentApp.name\n : null,\n },\n };\n },\n states: {\n DeviceReady: {\n // check device capabilities & status known\n always: {\n target: \"OnboardingCheck\",\n },\n },\n\n OnboardingCheck: {\n // check onboarding status provided by device session\n always: [\n {\n target: \"GetDeviceStatus\",\n guard: {\n type: \"isDeviceOnboarded\",\n },\n },\n {\n target: \"Error\",\n actions: \"assignErrorDeviceNotOnboarded\",\n },\n ],\n },\n\n GetDeviceStatus: {\n // We run the GetDeviceStatus flow to get information about the device state\n invoke: {\n id: \"deviceStatus\",\n src: \"getDeviceStatus\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n target: \"CheckDeviceStatus\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<OpenAppStateMachineInternalState>(\n {\n Right: (output) => {\n const state: DeviceSessionState =\n getDeviceSessionState();\n\n if (\n state.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n setDeviceSessionState({\n ...state,\n currentApp: {\n name: output.currentApp,\n version: output.currentAppVersion,\n },\n });\n }\n return {\n ..._.context._internalState,\n currentlyRunningApp: output.currentApp,\n };\n },\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n },\n );\n },\n }),\n },\n // NOTE: The way we handle our DeviceActions means that we should never as we return an Either\n // onError: {\n // target: \"Error\",\n // actions: \"assignGetDeviceStatusUnknownError\",\n // },\n },\n },\n CheckDeviceStatus: {\n // We check the device status to see if we can have an error\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"ApplicationReady\",\n guard: \"isRequestedAppOpen\",\n },\n {\n target: \"DashboardCheck\",\n },\n ],\n },\n\n DashboardCheck: {\n // Is the current application the dashboard\n always: [\n {\n target: \"OpenApplication\",\n guard: \"isDashboardOpen\",\n },\n \"CloseApplication\",\n ],\n },\n\n OpenApplication: {\n // execute openApp command,\n entry: \"assignUserActionNeededOpenApp\",\n exit: \"assignNoUserActionNeeded\",\n invoke: {\n src: \"openApp\",\n input: ({ context }) => ({ appName: context.input.appName }),\n onDone: {\n target: \"OpenApplicationResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return {\n ..._.context._internalState,\n currentlyRunningApp: _.context.input.appName,\n };\n } else {\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n }\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n\n OpenApplicationResultCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"GetDeviceStatus\" },\n ],\n },\n\n CloseApplication: {\n invoke: {\n src: \"closeApp\",\n onDone: {\n target: \"CloseApplicationResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return {\n ..._.context._internalState,\n currentlyRunningApp: \"BOLOS\",\n };\n } else {\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n }\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n CloseApplicationResultCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"OpenApplication\" },\n ],\n },\n\n ApplicationCheck: {\n // Is the current application the requested one\n always: [\n {\n target: \"ApplicationReady\",\n guard: \"isRequestedAppOpen\",\n },\n \"DashboardCheck\",\n ],\n },\n\n ApplicationReady: {\n // application is ready to be used\n always: \"Success\",\n },\n\n // success state\n Success: {\n type: \"final\",\n actions: \"assignNoError\", // TODO, we should not need this\n },\n\n // error state\n Error: {\n type: \"final\",\n },\n },\n output: ({ context }) =>\n context._internalState.error // TODO: instead we should rely on the current state (\"Success\" or \"Error\")\n ? Left(context._internalState.error)\n : Right(undefined),\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const closeApp = async () => internalApi.sendCommand(new CloseAppCommand());\n const openApp = async (arg0: { input: { appName: string } }) =>\n internalApi.sendCommand(\n new OpenAppCommand({ appName: arg0.input.appName }),\n );\n\n return {\n closeApp,\n openApp,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n isDeviceOnboarded: () => true, // TODO: we don't have this info for now, this can be derived from the \"flags\" obtained in the getVersion command\n };\n }\n}\n"],
|
5
|
-
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAC5B,OAAS,UAAAC,EAAQ,eAAAC,EAAa,SAAAC,MAAa,SAE3C,OAAS,0BAAAC,MAA8B,mCACvC,OACE,mBAAAC,MAEK,kCACP,OACE,kBAAAC,MAEK,iCAEP,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,6BAAAC,MAAiC,8BAC1C,OAAS,2BAAAC,MAA+B,+BACxC,OAAS,+BAAAC,MAAmC,oEAE5C,OAEE,sBAAAC,MACK,qDACP,OAEE,0BAAAC,MACK,
|
6
|
-
"names": ["Left", "Right", "assign", "fromPromise", "setup", "isSuccessCommandResult", "CloseAppCommand", "OpenAppCommand", "UserInteractionRequired", "DEFAULT_UNLOCK_TIMEOUT_MS", "DeviceNotOnboardedError", "GetDeviceStatusDeviceAction", "XStateDeviceAction", "DeviceSessionStateType", "OpenAppDeviceAction", "internalApi", "closeApp", "openApp", "getDeviceSessionState", "isDeviceOnboarded", "setDeviceSessionState", "unlockTimeout", "getDeviceStatusMachine", "context", "_", "input", "sessionState", "sessionStateType", "output", "state", "error", "arg0"]
|
4
|
+
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n CloseAppCommand,\n type CloseAppCommandResult,\n} from \"@api/command/os/CloseAppCommand\";\nimport {\n OpenAppCommand,\n type OpenAppCommandResult,\n} from \"@api/command/os/OpenAppCommand\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { DeviceNotOnboardedError } from \"@api/device-action/os/Errors\";\nimport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nimport { DeviceDisconnectedWhileSendingError } from \"@api/transport/model/Errors\";\nimport { isDashboardName } from \"@api/utils/AppName\";\n\nimport {\n type OpenAppDAError,\n type OpenAppDAInput,\n type OpenAppDAIntermediateValue,\n type OpenAppDAOutput,\n} from \"./types\";\n\ntype OpenAppStateMachineInternalState = {\n readonly currentlyRunningApp: string | null;\n readonly error: OpenAppDAError | null;\n};\n\nexport type MachineDependencies = {\n readonly closeApp: () => Promise<CloseAppCommandResult>;\n readonly openApp: (arg0: {\n input: { appName: string };\n }) => Promise<OpenAppCommandResult>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly setDeviceSessionState: (state: DeviceSessionState) => void;\n readonly isDeviceOnboarded: () => boolean;\n};\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\n/**\n * Opens a given app on the device.\n *\n * It checks if the device is onboarded, unlocked, and which app is currently open.\n * If the current app is the dashboard, it will directly open the requested app.\n * If another app is opened, it will close the current app and open the requested app.\n *\n * Example of usage:\n *\n * ```ts\n * const deviceAction = new OpenAppDeviceAction({\n * input: {\n * appName: \"MyApp\",\n * },\n * });\n * dmk.executeDeviceAction({ sessionId: \"mySessionId\", deviceAction });\n * ```\n */\nexport class OpenAppDeviceAction extends XStateDeviceAction<\n OpenAppDAOutput,\n OpenAppDAInput,\n OpenAppDAError,\n OpenAppDAIntermediateValue,\n OpenAppStateMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n OpenAppDAOutput,\n OpenAppDAInput,\n OpenAppDAError,\n OpenAppDAIntermediateValue,\n OpenAppStateMachineInternalState\n > {\n type types = StateMachineTypes<\n OpenAppDAOutput,\n OpenAppDAInput,\n OpenAppDAError,\n OpenAppDAIntermediateValue,\n OpenAppStateMachineInternalState\n >;\n\n const {\n closeApp,\n openApp,\n getDeviceSessionState,\n isDeviceOnboarded,\n setDeviceSessionState,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const getDeviceStatusMachine = new GetDeviceStatusDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalApi);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n closeApp: fromPromise(closeApp),\n openApp: fromPromise(openApp),\n getDeviceStatus: getDeviceStatusMachine,\n },\n guards: {\n isDeviceOnboarded: () => isDeviceOnboarded(), // TODO: we don't have this info for now, this can be derived from the \"flags\" obtained in the getVersion command\n isRequestedAppOpen: ({ context }: { context: types[\"context\"] }) => {\n if (context._internalState.currentlyRunningApp === null) return false;\n return (\n context._internalState.currentlyRunningApp === context.input.appName\n );\n },\n isDashboardOpen: ({ context }: { context: types[\"context\"] }) => {\n if (context._internalState.currentlyRunningApp === null)\n throw new Error(\"context.currentlyRunningApp === null\");\n return isDashboardName(context._internalState.currentlyRunningApp);\n },\n hasDisconnectedWhileSending: ({ context }) =>\n context._internalState.error !== null &&\n context._internalState.error instanceof\n DeviceDisconnectedWhileSendingError,\n hasError: ({ context }) => context._internalState.error !== null,\n },\n actions: {\n assignErrorDeviceNotOnboarded: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceNotOnboardedError(),\n }),\n }),\n assignUserActionNeededOpenApp: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignNoUserActionNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // FIXME: add a typeguard\n }),\n }),\n assignNoError: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: null,\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHkAOYB2BBVqAiYAbgJYDGYWpALsQPYYB0BJ5ASmAIYQCeAxANoAGALqJQqWrGI16YkAA9EARhWCGADgAsAZm1b1SwUoDspgDQhuiAEzX1DbQE5tJlQDYlm414CsAXz8LNEwcfCIyCmo6RmQMACNaDgAnCGIMKABhAAswUgBrARE5CSkZDDlFBCUPbQYfZx91H0FtTRNjCysEbWM1bTdHAzcfH2q9awCg9GxcZgjKMoZYhOTU9Ozcgv4lUSQQEuloiuUauoamlrbzSxtBNTu7pW1BEe1rJUmQYJmwlkjFgAytHyaUyOXyhV24kkh1ke0q7w8DDcxmqjkM1l6Kh8nUQzR8DEEjjcz3UxKUjiMbk+31Cc3IC2iDCBIPW4K2O2KMLKxwQiKUyNRAwxWKUOJu3TaDFsw28bkExmsgnU-Rp0zp4QZUXoDFCABsyBwylhCBxiHqOHE9WBeBB6GAGGlCLQ8g7abNNf8mfrDcbTebLdaEE7gUbokJhBGuaUjvCbCSCdZNI5UQqhg1cQhNOprAxND4XP0xZTHI01SEPX9GTqfaQw-QTWaLVabWAkklaEkGKgLVQAGadgC2S3Vlfm2sYtfr2H9zaDIbrZQjUb2Bx5cb5CelydTxnT2nFXTcmjUBYTzlazkcE0CX1Hv3HiynfqbgbA7FgAFc9VQNhCV9CMZwqAlQuAWZwHiqbStI0mY+PmdRKNYxLZmKgjvDeUwVg+WpPrgBqLtEjYBi2H7fr+7ICJyq7crGIGIK0LwME8dzJuizzNNYmZeLmAysZ4Ph2KYmiaOWPz0l6Nb4b60R-lsRQ0UB5Qbq0pgMM4FJ8dYx4KpomaOJo6k9G4yHvEhBmYmJGpVhOurSYR9ByVRUL7LRwEKAxYq1PUk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M8CoTZOpNZDL4eQjcIlDLIRRH5FhoxDyIGFMiASe8IoFlGNchaS0waxNqfkepG4tACiMGeQw6IiQeBGncMaMycxEl8eoIFu0fiVPbg87qSE3q6MVBpehPQ4K6G+uoZUJIVB7laNiq+2s4DkRGYTLRygs6GSQtmO4iIaWljgvUBgip-K5RErofOdiYocLBZwHhBzOWSkKqKz6Lw3i6U+QgPchlTB7xTPBeCWVHDYoAMqflIOQWA8AlXuO6KMQylImipgMi4BZzhDIKkpM0FEypRimplXNWyABRMuSRIXjNaKvHQ3h0Q0reCYT+3khGNEKgqIRxgAgBCAA */\n id: \"OpenAppDeviceAction\",\n initial: \"DeviceReady\",\n context: ({ input }) => {\n const sessionState = getDeviceSessionState();\n const { sessionStateType } = sessionState;\n return {\n input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n error: null,\n currentlyRunningApp:\n sessionStateType ===\n DeviceSessionStateType.ReadyWithoutSecureChannel\n ? sessionState.currentApp.name\n : null,\n },\n };\n },\n states: {\n DeviceReady: {\n // check device capabilities & status known\n always: {\n target: \"OnboardingCheck\",\n },\n },\n\n OnboardingCheck: {\n // check onboarding status provided by device session\n always: [\n {\n target: \"GetDeviceStatus\",\n guard: {\n type: \"isDeviceOnboarded\",\n },\n },\n {\n target: \"Error\",\n actions: \"assignErrorDeviceNotOnboarded\",\n },\n ],\n },\n\n GetDeviceStatus: {\n // We run the GetDeviceStatus flow to get information about the device state\n invoke: {\n id: \"deviceStatus\",\n src: \"getDeviceStatus\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n target: \"CheckDeviceStatus\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<OpenAppStateMachineInternalState>(\n {\n Right: (output) => {\n const state: DeviceSessionState =\n getDeviceSessionState();\n\n if (\n state.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n setDeviceSessionState({\n ...state,\n currentApp: {\n name: output.currentApp,\n version: output.currentAppVersion,\n },\n });\n }\n return {\n ..._.context._internalState,\n currentlyRunningApp: output.currentApp,\n };\n },\n Left: (error) => ({\n ..._.context._internalState,\n currentlyRunningApp: null,\n error,\n }),\n },\n );\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: [\n assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n currentlyRunningApp: null,\n }),\n }),\n \"assignErrorFromEvent\",\n ],\n },\n },\n },\n CheckDeviceStatus: {\n // We check the device status to see if we can have an error\n always: [\n {\n target: \"ApplicationReady\",\n guard: \"isRequestedAppOpen\",\n // If target app is currently opened, we can ignore errors\n actions: \"assignNoError\",\n },\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"DashboardCheck\",\n },\n ],\n },\n\n DashboardCheck: {\n // Is the current application the dashboard\n always: [\n {\n target: \"OpenApplication\",\n guard: \"isDashboardOpen\",\n },\n \"CloseApplication\",\n ],\n },\n\n OpenApplication: {\n // execute openApp command,\n entry: \"assignUserActionNeededOpenApp\",\n exit: \"assignNoUserActionNeeded\",\n invoke: {\n src: \"openApp\",\n input: ({ context }) => ({ appName: context.input.appName }),\n onDone: {\n target: \"OpenApplicationResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return {\n ..._.context._internalState,\n currentlyRunningApp: _.context.input.appName,\n };\n } else {\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n }\n },\n }),\n },\n onError: {\n target: \"OpenApplicationResultCheck\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n\n OpenApplicationResultCheck: {\n always: [\n {\n // When an APDU triggers a disconnection, some transports may possibly\n // be closed on device side before the APDU response could be received,\n // especially on BLE transports.\n // Therefore when a disconnection occurs while sending, we should verify\n // the device status because it may have been successfully executed.\n target: \"GetDeviceStatus\",\n guard: \"hasDisconnectedWhileSending\",\n },\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"GetDeviceStatus\" },\n ],\n },\n\n CloseApplication: {\n invoke: {\n src: \"closeApp\",\n onDone: {\n target: \"CloseApplicationResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return {\n ..._.context._internalState,\n currentlyRunningApp: \"BOLOS\",\n };\n } else {\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n }\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n CloseApplicationResultCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"OpenApplication\" },\n ],\n },\n\n ApplicationReady: {\n // application is ready to be used\n always: \"Success\",\n },\n\n // success state\n Success: {\n type: \"final\",\n actions: \"assignNoError\", // TODO, we should not need this\n },\n\n // error state\n Error: {\n type: \"final\",\n },\n },\n output: ({ context }) =>\n context._internalState.error // TODO: instead we should rely on the current state (\"Success\" or \"Error\")\n ? Left(context._internalState.error)\n : Right(undefined),\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const closeApp = async () => internalApi.sendCommand(new CloseAppCommand());\n const openApp = async (arg0: { input: { appName: string } }) =>\n internalApi.sendCommand(\n new OpenAppCommand({ appName: arg0.input.appName }),\n );\n\n return {\n closeApp,\n openApp,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n isDeviceOnboarded: () => true, // TODO: we don't have this info for now, this can be derived from the \"flags\" obtained in the getVersion command\n };\n }\n}\n"],
|
5
|
+
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAC5B,OAAS,UAAAC,EAAQ,eAAAC,EAAa,SAAAC,MAAa,SAE3C,OAAS,0BAAAC,MAA8B,mCACvC,OACE,mBAAAC,MAEK,kCACP,OACE,kBAAAC,MAEK,iCAEP,OAAS,2BAAAC,MAA+B,mDAC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,CACE,OAAQ,QACR,MAAO,UACT,EACA,CAAE,OAAQ,iBAAkB,CAC9B,CACF,EAEA,iBAAkB,CAChB,OAAQ,CACN,IAAK,WACL,OAAQ,CACN,OAAQ,8BACR,QAASxB,EAAO,CACd,eAAiBwB,GACXrB,EAAuBqB,EAAE,MAAM,MAAM,EAChC,CACL,GAAGA,EAAE,QAAQ,eACb,oBAAqB,OACvB,EAEO,CACL,GAAGA,EAAE,QAAQ,eACb,MAAOA,EAAE,MAAM,OAAO,KACxB,CAGN,CAAC,CACH,EACA,QAAS,CACP,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,4BAA6B,CAC3B,OAAQ,CACN,CACE,OAAQ,QACR,MAAO,UACT,EACA,CAAE,OAAQ,iBAAkB,CAC9B,CACF,EAEA,iBAAkB,CAEhB,OAAQ,SACV,EAGA,QAAS,CACP,KAAM,QACN,QAAS,eACX,EAGA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAAQ,CAAC,CAAE,QAAAD,CAAQ,IACjBA,EAAQ,eAAe,MACnBzB,EAAKyB,EAAQ,eAAe,KAAK,EACjCxB,EAAM,MAAS,CACvB,CAAC,CACH,CAEA,oBAAoBgB,EAA+C,CAOjE,MAAO,CACL,SAPe,SAAYA,EAAY,YAAY,IAAIX,CAAiB,EAQxE,QAPc,MAAO2B,GACrBhB,EAAY,YACV,IAAIV,EAAe,CAAE,QAAS0B,EAAK,MAAM,OAAQ,CAAC,CACpD,EAKA,sBAAuB,IAAMhB,EAAY,sBAAsB,EAC/D,sBAAwBc,GACtBd,EAAY,sBAAsBc,CAAK,EACzC,kBAAmB,IAAM,EAC3B,CACF,CACF",
|
6
|
+
"names": ["Left", "Right", "assign", "fromPromise", "setup", "isSuccessCommandResult", "CloseAppCommand", "OpenAppCommand", "UserInteractionRequired", "DEFAULT_UNLOCK_TIMEOUT_MS", "DeviceNotOnboardedError", "GetDeviceStatusDeviceAction", "XStateDeviceAction", "DeviceSessionStateType", "DeviceDisconnectedWhileSendingError", "isDashboardName", "OpenAppDeviceAction", "internalApi", "closeApp", "openApp", "getDeviceSessionState", "isDeviceOnboarded", "setDeviceSessionState", "unlockTimeout", "getDeviceStatusMachine", "context", "_", "input", "sessionState", "sessionStateType", "output", "state", "error", "arg0"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{lastValueFrom as y}from"rxjs";import{InvalidStatusWordError as v}from"../../../command/Errors";import{CommandResultFactory as l}from"../../../command/model/CommandResult";import{DeviceModelId as w}from"../../../device/DeviceModel";import{DeviceStatus as a}from"../../../device/DeviceStatus";import{makeDeviceActionInternalApiMock as p}from"../../../device-action/__test-utils__/makeInternalApi";import{setupGetDeviceStatusMock as A}from"../../../device-action/__test-utils__/setupTestMachine";import{testDeviceActionStates as u}from"../../../device-action/__test-utils__/testDeviceActionStates";import{DeviceActionStatus as e}from"../../../device-action/model/DeviceActionState";import{UserInteractionRequired as t}from"../../../device-action/model/UserInteractionRequired";import{DeviceLockedError as C,DeviceNotOnboardedError as R,UnknownDAError as D}from"../../../device-action/os/Errors";import{DeviceSessionStateType as s}from"../../../device-session/DeviceSessionState";import{OpenAppDeviceAction as d}from"./OpenAppDeviceAction";vi.mock("@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction");describe("OpenAppDeviceAction",()=>{const O=vi.fn(),S=vi.fn(),V=vi.fn(),c=vi.fn(),h=vi.fn(),k=vi.fn();function m(){return{getDeviceSessionState:c,setDeviceSessionState:h,getAppAndVersion:O,openApp:S,closeApp:V,isDeviceOnboarded:k}}const{getDeviceSessionState:E}=p();beforeEach(()=>{vi.resetAllMocks(),k.mockReturnValue(!0)}),describe("without overriding `extractDependencies`",()=>{it("should end if the required application is opened",()=>new Promise((r,o)=>{E.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"Bitcoin",version:"1.0.0"},installedApps:[],deviceModelId:w.NANO_X,isSecureConnectionAllowed:!1}),A([{currentApp:"Bitcoin",currentAppVersion:"0.0.0"}]);const n=new d({input:{appName:"Bitcoin"}}),i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Completed,output:void 0}];u(n,i,p(),{onDone:r,onError:o})}))}),describe("success cases",()=>{it("should end in a success if the app is already opened",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"Bitcoin",version:"1.0.0"}}),A([{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]);const n=new d({input:{appName:"Bitcoin",unlockTimeout:void 0}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Completed,output:void 0}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in a success if a compatible app is already opened",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"Bitcoin Testnet",version:"1.0.0"}}),A([{currentApp:"Bitcoin Testnet",currentAppVersion:"1.0.0"}]);const n=new d({input:{appName:"Bitcoin",unlockTimeout:void 0,compatibleAppNames:["Bitcoin Testnet"]}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Completed,output:void 0}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in a success if the dashboard is open and open app succeeds",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"BOLOS",version:"0.0.0"}}),A([{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]),S.mockResolvedValue(l({data:void 0}));const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Completed,output:void 0}],{observable:N}=u(n,i,p(),{onDone:r,onError:o});y(N).then(()=>{expect(h).toHaveBeenCalledWith({deviceStatus:a.CONNECTED,sessionStateType:s.ReadyWithoutSecureChannel,currentApp:{name:"Bitcoin",version:"1.0.0"}})})})),it("should end in a success if another app is open, close app succeeds and open app succeeds",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"AnotherApp",version:"0.0.0"}}),A([{currentApp:"AnotherApp",currentAppVersion:"0.0.0"},{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]),V.mockResolvedValue(l({data:void 0})),S.mockResolvedValue(l({data:void 0}));const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.ConfirmOpenApp}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Completed,output:void 0}],{observable:N}=u(n,i,p(),{onDone:r,onError:o});y(N).then(()=>{expect(h).toHaveBeenCalledWith({currentApp:{name:"Bitcoin",version:"1.0.0"},deviceStatus:a.CONNECTED,sessionStateType:s.ReadyWithoutSecureChannel})})}))}),describe("errors cases",()=>{it("should end in an error if the device is not onboarded",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),k.mockReturnValue(!1);const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{error:new R,status:e.Error}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if the device is locked",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),A([new C]);const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Error,error:new C}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if getAppAndVersion returns an error",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),A([new v("mocked error")]);const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Error,error:new v("mocked error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if the dashboard is open and open app returns an error",()=>new Promise((r,o)=>{c.mockReturnValue(l({data:{sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"BOLOS",version:"0.0.0"}}})),O.mockResolvedValue(l({data:{name:"BOLOS",version:"0.0.0"}})),A([{currentApp:"BOLOS",currentAppVersion:"0.0.0"}]),S.mockResolvedValue(l({error:new v("mocked error")}));const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.ConfirmOpenApp}},{status:e.Error,error:new v("mocked error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if another app is open, and close app returns an error",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"AnotherApp",version:"0.0.0"}}),A([{currentApp:"AnotherApp",currentAppVersion:"0.0.0"}]),V.mockResolvedValue(l({error:new v("mocked error")}));const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Error,error:new v("mocked error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if another app is open, close app succeeds but open app returns an error",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"AnotherApp",version:"0.0.0"}}),A([{currentApp:"AnotherApp",currentAppVersion:"0.0.0"}]),V.mockResolvedValue(l({data:void 0})),S.mockResolvedValue(l({error:new v("mocked error")}));const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.ConfirmOpenApp}},{status:e.Error,error:new v("mocked error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if getAppAndVersion actor throws an error",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),A([new D("Unknown error")]);const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Error,error:new D("Unknown error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if openApp actor throws an error",()=>new Promise((r,o)=>{c.mockReturnValue(l({data:{sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"BOLOS",version:"0.0.0"}}})),A([{currentApp:"BOLOS",currentAppVersion:"0.0.0"}]),S.mockImplementation(()=>{throw new D("Unknown error")});const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.ConfirmOpenApp}},{status:e.Error,error:new D("Unknown error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if closeApp actor throws an error",()=>new Promise((r,o)=>{c.mockReturnValue(l({data:{sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"BOLOS",version:"0.0.0"}}})),A([{currentApp:"anApp",currentAppVersion:"0.0.0"}]),V.mockImplementation(()=>{throw new D("Unknown error")});const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Error,error:new D("Unknown error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should emit a stopped state if the action is cancelled",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"AnotherApp",version:"0.0.0"}}),A([{currentApp:"AnotherApp",currentAppVersion:"0.0.0"}]);const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Stopped}],{cancel:N}=u(n,i,p(),{onDone:r,onError:o});N()}))})});
|
1
|
+
import{lastValueFrom as C}from"rxjs";import{InvalidStatusWordError as S}from"../../../command/Errors";import{CommandResultFactory as A}from"../../../command/model/CommandResult";import{DeviceModelId as R}from"../../../device/DeviceModel";import{DeviceStatus as a}from"../../../device/DeviceStatus";import{makeDeviceActionInternalApiMock as p}from"../../../device-action/__test-utils__/makeInternalApi";import{setupGetDeviceStatusMock as l}from"../../../device-action/__test-utils__/setupTestMachine";import{testDeviceActionStates as u}from"../../../device-action/__test-utils__/testDeviceActionStates";import{DeviceActionStatus as e}from"../../../device-action/model/DeviceActionState";import{UserInteractionRequired as t}from"../../../device-action/model/UserInteractionRequired";import{DeviceLockedError as E,DeviceNotOnboardedError as P,UnknownDAError as D}from"../../../device-action/os/Errors";import{DeviceSessionStateType as s}from"../../../device-session/DeviceSessionState";import{DeviceDisconnectedWhileSendingError as y}from"../../../transport/model/Errors";import{OpenAppDeviceAction as d}from"./OpenAppDeviceAction";vi.mock("@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction");describe("OpenAppDeviceAction",()=>{const O=vi.fn(),v=vi.fn(),V=vi.fn(),c=vi.fn(),h=vi.fn(),k=vi.fn();function m(){return{getDeviceSessionState:c,setDeviceSessionState:h,getAppAndVersion:O,openApp:v,closeApp:V,isDeviceOnboarded:k}}const{getDeviceSessionState:w}=p();beforeEach(()=>{vi.resetAllMocks(),k.mockReturnValue(!0)}),describe("without overriding `extractDependencies`",()=>{it("should end if the required application is opened",()=>new Promise((r,o)=>{w.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"Bitcoin",version:"1.0.0"},installedApps:[],deviceModelId:R.NANO_X,isSecureConnectionAllowed:!1}),l([{currentApp:"Bitcoin",currentAppVersion:"0.0.0"}]);const n=new d({input:{appName:"Bitcoin"}}),i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Completed,output:void 0}];u(n,i,p(),{onDone:r,onError:o})}))}),describe("success cases",()=>{it("should end in a success if the app is already opened",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"Bitcoin",version:"1.0.0"}}),l([{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]);const n=new d({input:{appName:"Bitcoin",unlockTimeout:void 0}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Completed,output:void 0}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in a success if the dashboard is open and open app succeeds",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"BOLOS",version:"0.0.0"}}),l([{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]),v.mockResolvedValue(A({data:void 0}));const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Completed,output:void 0}],{observable:N}=u(n,i,p(),{onDone:r,onError:o});C(N).then(()=>{expect(h).toHaveBeenCalledWith({deviceStatus:a.CONNECTED,sessionStateType:s.ReadyWithoutSecureChannel,currentApp:{name:"Bitcoin",version:"1.0.0"}})})})),it("should end in a success if disconnection occurs while open app succeeds",()=>new Promise((r,o)=>{c.mockReturnValue(A({data:{sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"BOLOS",version:"0.0.0"}}})),O.mockResolvedValue(A({data:{name:"BOLOS",version:"0.0.0"}})),l([{currentApp:"BOLOS",currentAppVersion:"0.0.0"},{currentApp:"Bitcoin",currentAppVersion:"0.0.0"}]),v.mockRejectedValue(new y);const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.ConfirmOpenApp}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Completed,output:void 0}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in a success if another app is open, close app succeeds and open app succeeds",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"AnotherApp",version:"0.0.0"}}),l([{currentApp:"AnotherApp",currentAppVersion:"0.0.0"},{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]),V.mockResolvedValue(A({data:void 0})),v.mockResolvedValue(A({data:void 0}));const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.ConfirmOpenApp}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Completed,output:void 0}],{observable:N}=u(n,i,p(),{onDone:r,onError:o});C(N).then(()=>{expect(h).toHaveBeenCalledWith({currentApp:{name:"Bitcoin",version:"1.0.0"},deviceStatus:a.CONNECTED,sessionStateType:s.ReadyWithoutSecureChannel})})}))}),describe("errors cases",()=>{it("should end in an error if the device is not onboarded",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),k.mockReturnValue(!1);const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{error:new P,status:e.Error}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if the device is locked",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),l([new E]);const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Error,error:new E}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if getAppAndVersion returns an error",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),l([new S("mocked error")]);const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Error,error:new S("mocked error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if the dashboard is open and open app returns an error",()=>new Promise((r,o)=>{c.mockReturnValue(A({data:{sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"BOLOS",version:"0.0.0"}}})),O.mockResolvedValue(A({data:{name:"BOLOS",version:"0.0.0"}})),l([{currentApp:"BOLOS",currentAppVersion:"0.0.0"}]),v.mockResolvedValue(A({error:new S("mocked error")}));const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.ConfirmOpenApp}},{status:e.Error,error:new S("mocked error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in a success if disconnection occurs while open app failed",()=>new Promise((r,o)=>{c.mockReturnValue(A({data:{sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"BOLOS",version:"0.0.0"}}})),O.mockResolvedValue(A({data:{name:"BOLOS",version:"0.0.0"}})),l([{currentApp:"BOLOS",currentAppVersion:"0.0.0"},{currentApp:"BOLOS",currentAppVersion:"0.0.0"}]),v.mockRejectedValue(new y);const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.ConfirmOpenApp}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Error,error:new y}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if another app is open, and close app returns an error",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"AnotherApp",version:"0.0.0"}}),l([{currentApp:"AnotherApp",currentAppVersion:"0.0.0"}]),V.mockResolvedValue(A({error:new S("mocked error")}));const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Error,error:new S("mocked error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if another app is open, close app succeeds but open app returns an error",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"AnotherApp",version:"0.0.0"}}),l([{currentApp:"AnotherApp",currentAppVersion:"0.0.0"}]),V.mockResolvedValue(A({data:void 0})),v.mockResolvedValue(A({error:new S("mocked error")}));const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.ConfirmOpenApp}},{status:e.Error,error:new S("mocked error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if getAppAndVersion actor throws an error",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),l([new D("Unknown error")]);const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Error,error:new D("Unknown error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if openApp actor throws an error",()=>new Promise((r,o)=>{c.mockReturnValue(A({data:{sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"BOLOS",version:"0.0.0"}}})),l([{currentApp:"BOLOS",currentAppVersion:"0.0.0"}]),v.mockImplementation(()=>{throw new D("Unknown error")});const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.ConfirmOpenApp}},{status:e.Error,error:new D("Unknown error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should end in an error if closeApp actor throws an error",()=>new Promise((r,o)=>{c.mockReturnValue(A({data:{sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"BOLOS",version:"0.0.0"}}})),l([{currentApp:"anApp",currentAppVersion:"0.0.0"}]),V.mockImplementation(()=>{throw new D("Unknown error")});const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Error,error:new D("Unknown error")}];u(n,i,p(),{onDone:r,onError:o})})),it("should emit a stopped state if the action is cancelled",()=>new Promise((r,o)=>{c.mockReturnValue({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,currentApp:{name:"AnotherApp",version:"0.0.0"}}),l([{currentApp:"AnotherApp",currentAppVersion:"0.0.0"}]);const n=new d({input:{appName:"Bitcoin"}});vi.spyOn(n,"extractDependencies").mockReturnValue(m());const i=[{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Pending,intermediateValue:{requiredUserInteraction:t.None}},{status:e.Stopped}],{cancel:N}=u(n,i,p(),{onDone:r,onError:o});N()}))})});
|
2
2
|
//# sourceMappingURL=OpenAppDeviceAction.test.js.map
|
package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../../src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.ts"],
|
4
|
-
"sourcesContent": ["import { lastValueFrom } from \"rxjs\";\n\nimport { InvalidStatusWordError } from \"@api/command/Errors\";\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { setupGetDeviceStatusMock } from \"@api/device-action/__test-utils__/setupTestMachine\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport { DeviceActionStatus } from \"@api/device-action/model/DeviceActionState\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport {\n DeviceLockedError,\n DeviceNotOnboardedError,\n UnknownDAError,\n} from \"@api/device-action/os/Errors\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\n\nimport { OpenAppDeviceAction } from \"./OpenAppDeviceAction\";\nimport type { OpenAppDAState } from \"./types\";\n\nvi.mock(\"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\");\n\ndescribe(\"OpenAppDeviceAction\", () => {\n const getAppAndVersionMock = vi.fn();\n const openAppMock = vi.fn();\n const closeAppMock = vi.fn();\n const getDeviceSessionStateMock = vi.fn();\n const setDeviceSessionStateMock = vi.fn();\n const isDeviceOnboardedMock = vi.fn();\n\n function extractDependenciesMock() {\n return {\n getDeviceSessionState: getDeviceSessionStateMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n getAppAndVersion: getAppAndVersionMock,\n openApp: openAppMock,\n closeApp: closeAppMock,\n isDeviceOnboarded: isDeviceOnboardedMock,\n };\n }\n\n const { getDeviceSessionState: apiGetDeviceSessionStateMock } =\n makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n vi.resetAllMocks();\n isDeviceOnboardedMock.mockReturnValue(true);\n });\n\n describe(\"without overriding `extractDependencies`\", () => {\n it(\"should end if the required application is opened\", () =>\n new Promise<void>((resolve, reject) => {\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"Bitcoin\", version: \"1.0.0\" },\n installedApps: [],\n deviceModelId: DeviceModelId.NANO_X,\n isSecureConnectionAllowed: false,\n });\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarding status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: undefined,\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n\n describe(\"success cases\", () => {\n it(\"should end in a success if the app is already opened\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"Bitcoin\", version: \"1.0.0\" },\n });\n\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\", unlockTimeout: undefined },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarding status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: undefined,\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in a success if a compatible app is already opened\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: {\n name: \"Bitcoin Testnet\",\n version: \"1.0.0\",\n },\n });\n\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin Testnet\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: {\n appName: \"Bitcoin\",\n unlockTimeout: undefined,\n compatibleAppNames: [\"Bitcoin Testnet\"],\n },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarding status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: undefined,\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in a success if the dashboard is open and open app succeeds\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"0.0.0\" },\n });\n\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n openAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: undefined,\n },\n ];\n\n const { observable } = testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n\n lastValueFrom(observable).then(() => {\n expect(setDeviceSessionStateMock).toHaveBeenCalledWith({\n deviceStatus: DeviceStatus.CONNECTED,\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n currentApp: { name: \"Bitcoin\", version: \"1.0.0\" },\n });\n });\n }));\n\n it(\"should end in a success if another app is open, close app succeeds and open app succeeds\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"AnotherApp\", version: \"0.0.0\" },\n });\n setupGetDeviceStatusMock([\n {\n currentApp: \"AnotherApp\",\n currentAppVersion: \"0.0.0\",\n },\n { currentApp: \"Bitcoin\", currentAppVersion: \"1.0.0\" },\n ]);\n closeAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n openAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // close app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // open app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: undefined,\n },\n ];\n\n const { observable } = testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n\n lastValueFrom(observable).then(() => {\n expect(setDeviceSessionStateMock).toHaveBeenCalledWith({\n currentApp: { name: \"Bitcoin\", version: \"1.0.0\" },\n deviceStatus: DeviceStatus.CONNECTED,\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n });\n });\n }));\n });\n\n describe(\"errors cases\", () => {\n it(\"should end in an error if the device is not onboarded\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n isDeviceOnboardedMock.mockReturnValue(false);\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n error: new DeviceNotOnboardedError(),\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if the device is locked\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n setupGetDeviceStatusMock([new DeviceLockedError()]);\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new DeviceLockedError(),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if getAppAndVersion returns an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n setupGetDeviceStatusMock([new InvalidStatusWordError(\"mocked error\")]);\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new InvalidStatusWordError(\"mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if the dashboard is open and open app returns an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue(\n CommandResultFactory({\n data: {\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"0.0.0\" },\n },\n }),\n );\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"0.0.0\",\n },\n }),\n );\n setupGetDeviceStatusMock([\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n openAppMock.mockResolvedValue(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"mocked error\"),\n }),\n );\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarded status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // open app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new InvalidStatusWordError(\"mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if another app is open, and close app returns an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"AnotherApp\", version: \"0.0.0\" },\n });\n setupGetDeviceStatusMock([\n {\n currentApp: \"AnotherApp\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n closeAppMock.mockResolvedValue(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"mocked error\"),\n }),\n );\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarded status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // close app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new InvalidStatusWordError(\"mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if another app is open, close app succeeds but open app returns an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"AnotherApp\", version: \"0.0.0\" },\n });\n setupGetDeviceStatusMock([\n {\n currentApp: \"AnotherApp\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n closeAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n openAppMock.mockResolvedValue(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"mocked error\"),\n }),\n );\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarded status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // close app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // open app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new InvalidStatusWordError(\"mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if getAppAndVersion actor throws an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n setupGetDeviceStatusMock([new UnknownDAError(\"Unknown error\")]);\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarded status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Unknown error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if openApp actor throws an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue(\n CommandResultFactory({\n data: {\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"0.0.0\" },\n },\n }),\n );\n setupGetDeviceStatusMock([\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n openAppMock.mockImplementation(() => {\n throw new UnknownDAError(\"Unknown error\");\n });\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get device onboarded\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // open app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Unknown error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if closeApp actor throws an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue(\n CommandResultFactory({\n data: {\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"0.0.0\" },\n },\n }),\n );\n setupGetDeviceStatusMock([\n {\n currentApp: \"anApp\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n closeAppMock.mockImplementation(() => {\n throw new UnknownDAError(\"Unknown error\");\n });\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarded status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // close app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Unknown error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should emit a stopped state if the action is cancelled\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"AnotherApp\", version: \"0.0.0\" },\n });\n setupGetDeviceStatusMock([\n {\n currentApp: \"AnotherApp\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get device onboarded\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Stopped,\n },\n ];\n\n const { cancel } = testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n cancel();\n }));\n });\n});\n"],
|
5
|
-
"mappings": "AAAA,OAAS,iBAAAA,MAAqB,OAE9B,OAAS,0BAAAC,MAA8B,sBACvC,OAAS,wBAAAC,MAA4B,mCACrC,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,gBAAAC,MAAoB,2BAC7B,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,4BAAAC,MAAgC,qDACzC,OAAS,0BAAAC,MAA8B,2DACvC,OAAS,sBAAAC,MAA0B,6CACnC,OAAS,2BAAAC,MAA+B,mDACxC,OACE,qBAAAC,EACA,2BAAAC,EACA,kBAAAC,MACK,+BACP,OAAS,0BAAAC,MAA8B,yCAEvC,OAAS,uBAAAC,MAA2B,wBAGpC,GAAG,KAAK,mEAAmE,EAE3E,SAAS,sBAAuB,IAAM,CACpC,MAAMC,EAAuB,GAAG,GAAG,EAC7BC,EAAc,GAAG,GAAG,EACpBC,EAAe,GAAG,GAAG,EACrBC,EAA4B,GAAG,GAAG,EAClCC,EAA4B,GAAG,GAAG,EAClCC,EAAwB,GAAG,GAAG,EAEpC,SAASC,GAA0B,CACjC,MAAO,CACL,sBAAuBH,EACvB,sBAAuBC,EACvB,iBAAkBJ,EAClB,QAASC,EACT,SAAUC,EACV,kBAAmBG,CACrB,CACF,CAEA,KAAM,CAAE,s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jB,wBAAyBC,EAAwB,IACnD,CACF,EACA,CACE,OAAQD,EAAmB,QAC3B,kBAAmB,CACjB,wBAAyBC,EAAwB,IACnD,CACF,EACA,CACE,OAAQD,EAAmB,OAC7B,CACF,EAEM,CAAE,OAAAoB,CAAO,EAAIrB,EACjBkB,EACAC,EACArB,EAAgC,EAChC,CACE,OAAQkB,EACR,QAASC,CACX,CACF,EACAI,EAAO,CACT,CAAC,CAAC,CACN,CAAC,CACH,CAAC",
|
6
|
-
"names": ["lastValueFrom", "InvalidStatusWordError", "CommandResultFactory", "DeviceModelId", "DeviceStatus", "makeDeviceActionInternalApiMock", "setupGetDeviceStatusMock", "testDeviceActionStates", "DeviceActionStatus", "UserInteractionRequired", "DeviceLockedError", "DeviceNotOnboardedError", "UnknownDAError", "DeviceSessionStateType", "OpenAppDeviceAction", "getAppAndVersionMock", "openAppMock", "closeAppMock", "getDeviceSessionStateMock", "setDeviceSessionStateMock", "isDeviceOnboardedMock", "extractDependenciesMock", "apiGetDeviceSessionStateMock", "resolve", "reject", "openAppDeviceAction", "expectedStates", "observable", "cancel"]
|
4
|
+
"sourcesContent": ["import { lastValueFrom } from \"rxjs\";\n\nimport { InvalidStatusWordError } from \"@api/command/Errors\";\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { setupGetDeviceStatusMock } from \"@api/device-action/__test-utils__/setupTestMachine\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport { DeviceActionStatus } from \"@api/device-action/model/DeviceActionState\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport {\n DeviceLockedError,\n DeviceNotOnboardedError,\n UnknownDAError,\n} from \"@api/device-action/os/Errors\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport { DeviceDisconnectedWhileSendingError } from \"@api/transport/model/Errors\";\n\nimport { OpenAppDeviceAction } from \"./OpenAppDeviceAction\";\nimport type { OpenAppDAError, OpenAppDAState } from \"./types\";\n\nvi.mock(\"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\");\n\ndescribe(\"OpenAppDeviceAction\", () => {\n const getAppAndVersionMock = vi.fn();\n const openAppMock = vi.fn();\n const closeAppMock = vi.fn();\n const getDeviceSessionStateMock = vi.fn();\n const setDeviceSessionStateMock = vi.fn();\n const isDeviceOnboardedMock = vi.fn();\n\n function extractDependenciesMock() {\n return {\n getDeviceSessionState: getDeviceSessionStateMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n getAppAndVersion: getAppAndVersionMock,\n openApp: openAppMock,\n closeApp: closeAppMock,\n isDeviceOnboarded: isDeviceOnboardedMock,\n };\n }\n\n const { getDeviceSessionState: apiGetDeviceSessionStateMock } =\n makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n vi.resetAllMocks();\n isDeviceOnboardedMock.mockReturnValue(true);\n });\n\n describe(\"without overriding `extractDependencies`\", () => {\n it(\"should end if the required application is opened\", () =>\n new Promise<void>((resolve, reject) => {\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"Bitcoin\", version: \"1.0.0\" },\n installedApps: [],\n deviceModelId: DeviceModelId.NANO_X,\n isSecureConnectionAllowed: false,\n });\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarding status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: undefined,\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n\n describe(\"success cases\", () => {\n it(\"should end in a success if the app is already opened\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"Bitcoin\", version: \"1.0.0\" },\n });\n\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\", unlockTimeout: undefined },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarding status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: undefined,\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in a success if the dashboard is open and open app succeeds\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"0.0.0\" },\n });\n\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n openAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: undefined,\n },\n ];\n\n const { observable } = testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n\n lastValueFrom(observable).then(() => {\n expect(setDeviceSessionStateMock).toHaveBeenCalledWith({\n deviceStatus: DeviceStatus.CONNECTED,\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n currentApp: { name: \"Bitcoin\", version: \"1.0.0\" },\n });\n });\n }));\n\n it(\"should end in a success if disconnection occurs while open app succeeds\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue(\n CommandResultFactory({\n data: {\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"0.0.0\" },\n },\n }),\n );\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"0.0.0\",\n },\n }),\n );\n setupGetDeviceStatusMock([\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"0.0.0\",\n },\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n openAppMock.mockRejectedValue(\n new DeviceDisconnectedWhileSendingError(),\n );\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarded status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // open app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: undefined,\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in a success if another app is open, close app succeeds and open app succeeds\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"AnotherApp\", version: \"0.0.0\" },\n });\n setupGetDeviceStatusMock([\n {\n currentApp: \"AnotherApp\",\n currentAppVersion: \"0.0.0\",\n },\n { currentApp: \"Bitcoin\", currentAppVersion: \"1.0.0\" },\n ]);\n closeAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n openAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // close app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // open app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: undefined,\n },\n ];\n\n const { observable } = testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n\n lastValueFrom(observable).then(() => {\n expect(setDeviceSessionStateMock).toHaveBeenCalledWith({\n currentApp: { name: \"Bitcoin\", version: \"1.0.0\" },\n deviceStatus: DeviceStatus.CONNECTED,\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n });\n });\n }));\n });\n\n describe(\"errors cases\", () => {\n it(\"should end in an error if the device is not onboarded\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n isDeviceOnboardedMock.mockReturnValue(false);\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n error: new DeviceNotOnboardedError(),\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if the device is locked\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n setupGetDeviceStatusMock([new DeviceLockedError()]);\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new DeviceLockedError(),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if getAppAndVersion returns an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n setupGetDeviceStatusMock([new InvalidStatusWordError(\"mocked error\")]);\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new InvalidStatusWordError(\"mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if the dashboard is open and open app returns an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue(\n CommandResultFactory({\n data: {\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"0.0.0\" },\n },\n }),\n );\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"0.0.0\",\n },\n }),\n );\n setupGetDeviceStatusMock([\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n openAppMock.mockResolvedValue(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"mocked error\"),\n }),\n );\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarded status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // open app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new InvalidStatusWordError(\"mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in a success if disconnection occurs while open app failed\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue(\n CommandResultFactory({\n data: {\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"0.0.0\" },\n },\n }),\n );\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"0.0.0\",\n },\n }),\n );\n setupGetDeviceStatusMock([\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"0.0.0\",\n },\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n openAppMock.mockRejectedValue(\n new DeviceDisconnectedWhileSendingError(),\n );\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarded status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // open app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new DeviceDisconnectedWhileSendingError() as OpenAppDAError,\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if another app is open, and close app returns an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"AnotherApp\", version: \"0.0.0\" },\n });\n setupGetDeviceStatusMock([\n {\n currentApp: \"AnotherApp\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n closeAppMock.mockResolvedValue(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"mocked error\"),\n }),\n );\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarded status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // close app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new InvalidStatusWordError(\"mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if another app is open, close app succeeds but open app returns an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"AnotherApp\", version: \"0.0.0\" },\n });\n setupGetDeviceStatusMock([\n {\n currentApp: \"AnotherApp\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n closeAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n openAppMock.mockResolvedValue(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"mocked error\"),\n }),\n );\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarded status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // close app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // open app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new InvalidStatusWordError(\"mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if getAppAndVersion actor throws an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n setupGetDeviceStatusMock([new UnknownDAError(\"Unknown error\")]);\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarded status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Unknown error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if openApp actor throws an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue(\n CommandResultFactory({\n data: {\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"0.0.0\" },\n },\n }),\n );\n setupGetDeviceStatusMock([\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n openAppMock.mockImplementation(() => {\n throw new UnknownDAError(\"Unknown error\");\n });\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get device onboarded\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // open app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Unknown error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should end in an error if closeApp actor throws an error\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue(\n CommandResultFactory({\n data: {\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"0.0.0\" },\n },\n }),\n );\n setupGetDeviceStatusMock([\n {\n currentApp: \"anApp\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n closeAppMock.mockImplementation(() => {\n throw new UnknownDAError(\"Unknown error\");\n });\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get onboarded status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // close app\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Unknown error\"),\n },\n ];\n\n testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should emit a stopped state if the action is cancelled\", () =>\n new Promise<void>((resolve, reject) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"AnotherApp\", version: \"0.0.0\" },\n });\n setupGetDeviceStatusMock([\n {\n currentApp: \"AnotherApp\",\n currentAppVersion: \"0.0.0\",\n },\n ]);\n\n const openAppDeviceAction = new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n });\n vi.spyOn(openAppDeviceAction, \"extractDependencies\").mockReturnValue(\n extractDependenciesMock(),\n );\n\n const expectedStates: Array<OpenAppDAState> = [\n {\n status: DeviceActionStatus.Pending, // get device onboarded\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending, // get device status\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Stopped,\n },\n ];\n\n const { cancel } = testDeviceActionStates(\n openAppDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n cancel();\n }));\n });\n});\n"],
|
5
|
+
"mappings": "AAAA,OAAS,iBAAAA,MAAqB,OAE9B,OAAS,0BAAAC,MAA8B,sBACvC,OAAS,wBAAAC,MAA4B,mCACrC,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,gBAAAC,MAAoB,2BAC7B,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,4BAAAC,MAAgC,qDACzC,OAAS,0BAAAC,MAA8B,2DACvC,OAAS,sBAAAC,MAA0B,6CACnC,OAAS,2BAAAC,MAA+B,mDACxC,OACE,qBAAAC,EACA,2BAAAC,EACA,kBAAAC,MACK,+BACP,OAAS,0BAAAC,MAA8B,yCACvC,OAAS,uCAAAC,MAA2C,8BAEpD,OAAS,uBAAAC,MAA2B,wBAGpC,GAAG,KAAK,mEAAmE,EAE3E,SAAS,sBAAuB,IAAM,CACpC,MAAMC,EAAuB,GAAG,GAAG,EAC7BC,EAAc,GAAG,GAAG,EACpBC,EAAe,GAAG,GAAG,EACrBC,EAA4B,GAAG,GAAG,EAClCC,EAA4B,GAAG,GAAG,EAClCC,EAAwB,GAAG,GAAG,EAEpC,SAASC,GAA0B,CACjC,MAAO,CACL,sBAAuBH,EACvB,sBAAuBC,EACvB,iBAAkBJ,EAClB,QAASC,EACT,SAAUC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M,aAAc,QAAS,OAAQ,CACrD,CAAC,EACDE,EAAyB,CACvB,CACE,WAAY,aACZ,kBAAmB,OACrB,CACF,CAAC,EAED,MAAMoB,EAAsB,IAAIX,EAAoB,CAClD,MAAO,CAAE,QAAS,SAAU,CAC9B,CAAC,EACD,GAAG,MAAMW,EAAqB,qBAAqB,EAAE,gBACnDJ,EAAwB,CAC1B,EAEA,MAAMK,EAAwC,CAC5C,CACE,OAAQnB,EAAmB,QAC3B,kBAAmB,CACjB,wBAAyBC,EAAwB,IACnD,CACF,EACA,CACE,OAAQD,EAAmB,QAC3B,kBAAmB,CACjB,wBAAyBC,EAAwB,IACnD,CACF,EACA,CACE,OAAQD,EAAmB,OAC7B,CACF,EAEM,CAAE,OAAAqB,CAAO,EAAItB,EACjBmB,EACAC,EACAtB,EAAgC,EAChC,CACE,OAAQmB,EACR,QAASC,CACX,CACF,EACAI,EAAO,CACT,CAAC,CAAC,CACN,CAAC,CACH,CAAC",
|
6
|
+
"names": ["lastValueFrom", "InvalidStatusWordError", "CommandResultFactory", "DeviceModelId", "DeviceStatus", "makeDeviceActionInternalApiMock", "setupGetDeviceStatusMock", "testDeviceActionStates", "DeviceActionStatus", "UserInteractionRequired", "DeviceLockedError", "DeviceNotOnboardedError", "UnknownDAError", "DeviceSessionStateType", "DeviceDisconnectedWhileSendingError", "OpenAppDeviceAction", "getAppAndVersionMock", "openAppMock", "closeAppMock", "getDeviceSessionStateMock", "setDeviceSessionStateMock", "isDeviceOnboardedMock", "extractDependenciesMock", "apiGetDeviceSessionStateMock", "resolve", "reject", "openAppDeviceAction", "expectedStates", "observable", "cancel"]
|
7
7
|
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{Left as d,Right as m}from"purify-ts";import{assign as n,setup as A}from"xstate";import{UserInteractionRequired as i}from"../../../device-action/model/UserInteractionRequired";import{DEFAULT_UNLOCK_TIMEOUT_MS as D}from"../../../device-action/os/Const";import{UnsupportedFirmwareDAError as h}from"../../../device-action/os/Errors";import{GetDeviceMetadataDeviceAction as O}from"../../../device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction";import{InstallOrUpdateAppsDeviceAction as v}from"../../../device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction";import{OpenAppDeviceAction as M}from"../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction";import{XStateDeviceAction as S}from"../../../device-action/xstate-utils/XStateDeviceAction";class w extends S{makeStateMachine(r){const a=this.input.unlockTimeout??D,o=new O({input:{unlockTimeout:a,useSecureChannel:!0,forceUpdate:!1}}).makeStateMachine(r),c=new v({input:{unlockTimeout:a,applications:[...this.input.dependencies,this.input.application],allowMissingApplication:!1}}).makeStateMachine(r),s=new M({input:{unlockTimeout:a,appName:this.input.application.name}}).makeStateMachine(r);return A({types:{input:{unlockTimeout:a},context:{},output:{}},actors:{getMetadata:o,installApps:c,openApp:s},guards:{hasError:({context:e})=>e._internalState.error!==null},actions:{assignErrorFromEvent:n({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"OpenAppWithDependenciesDeviceAction",initial:"DeviceReady",context:e=>({input:{application:e.input.application,dependencies:e.input.dependencies,requireLatestFirmware:e.input.requireLatestFirmware,unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:i.None,installPlan:null},_internalState:{error:null,deviceMetadata:null,installResult:null}}),states:{DeviceReady:{always:[{target:"GetDeviceMetadata"}]},GetDeviceMetadata:{exit:n({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:i.None})}),invoke:{id:"getMetadata",src:"getMetadata",input:e=>({unlockTimeout:e.context.input.unlockTimeout,useSecureChannel:!0,forceUpdate:!1}),onSnapshot:{actions:n({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:e.event.snapshot.context.intermediateValue.requiredUserInteraction})})},onDone:{target:"GetDeviceMetadataCheck",actions:n({_internalState:e=>e.event.output.caseOf({Right:t=>e.context.input.requireLatestFirmware&&t.firmwareUpdateContext.availableUpdate!==void 0?{...e.context._internalState,error:new h("Firmware is not the latest version")}:{...e.context._internalState,deviceMetadata:t},Left:t=>({...e.context._internalState,error:t})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetDeviceMetadataCheck:{always:[{target:"Error",guard:"hasError"},{target:"InstallDependencies"}]},InstallDependencies:{exit:n({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:i.None})}),invoke:{src:"installApps",input:e=>({unlockTimeout:e.context.input.unlockTimeout,applications:[...e.context.input.dependencies,e.context.input.application],allowMissingApplication:!1}),onSnapshot:{actions:n({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:e.event.snapshot.context.intermediateValue.requiredUserInteraction,installPlan:e.event.snapshot.context.intermediateValue.installPlan})})},onDone:{target:"InstallDependenciesCheck",actions:n({_internalState:e=>e.event.output.caseOf({Right:t=>({...e.context._internalState,installResult:t}),Left:t=>({...e.context._internalState,error:t})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},InstallDependenciesCheck:{always:[{guard:"hasError",target:"Error"},{target:"OpenApp"}]},OpenApp:{exit:n({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:i.None})}),invoke:{src:"openApp",input:e=>({unlockTimeout:e.context.input.unlockTimeout,appName:e.context.input.application.name}),onSnapshot:{actions:n({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:e.event.snapshot.context.intermediateValue.requiredUserInteraction,installPlan:null})})},onDone:{target:"OpenAppCheck",actions:n({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:t=>({...e.context._internalState,error:t})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},OpenAppCheck:{always:[{guard:"hasError",target:"Error"},{target:"Success"}]},Success:{type:"final"},Error:{type:"final"}},output:e=>{const{context:t}=e,{error:p,deviceMetadata:l,installResult:u}=t._internalState;return p?d(p):m({deviceMetadata:l,installResult:u})}})}}export{w as OpenAppWithDependenciesDeviceAction};
|
2
|
+
//# sourceMappingURL=OpenAppWithDependenciesDeviceAction.js.map
|