@ledgerhq/device-management-kit 0.0.0-develop-20241017000946 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -6126
- package/lib/cjs/index.js.map +4 -4
- package/lib/cjs/package.json +64 -0
- package/lib/cjs/src/api/DeviceManagementKit.js +2 -0
- package/lib/cjs/src/api/DeviceManagementKit.js.map +7 -0
- package/lib/cjs/src/api/DeviceManagementKit.test.js +2 -0
- package/lib/cjs/src/api/DeviceManagementKit.test.js.map +7 -0
- package/lib/cjs/src/api/DeviceManagementKitBuilder.js +2 -0
- package/lib/cjs/src/api/DeviceManagementKitBuilder.js.map +7 -0
- package/lib/cjs/src/api/DeviceManagementKitBuilder.test.js +2 -0
- package/lib/cjs/src/api/DeviceManagementKitBuilder.test.js.map +7 -0
- package/lib/cjs/src/api/DmkConfig.js +2 -0
- package/lib/cjs/src/api/DmkConfig.js.map +7 -0
- package/lib/cjs/src/api/Error.js +2 -0
- package/lib/cjs/src/api/Error.js.map +7 -0
- package/lib/cjs/src/api/apdu/model/Apdu.js +2 -0
- package/lib/cjs/src/api/apdu/model/Apdu.js.map +7 -0
- package/lib/cjs/src/api/apdu/model/Apdu.test.js +2 -0
- package/lib/cjs/src/api/apdu/model/Apdu.test.js.map +7 -0
- package/lib/cjs/src/api/apdu/utils/ApduBuilder.js +2 -0
- package/lib/cjs/src/api/apdu/utils/ApduBuilder.js.map +7 -0
- package/lib/cjs/src/api/apdu/utils/ApduBuilder.test.js +2 -0
- package/lib/cjs/src/api/apdu/utils/ApduBuilder.test.js.map +7 -0
- package/lib/cjs/src/api/apdu/utils/ApduParser.js +2 -0
- package/lib/cjs/src/api/apdu/utils/ApduParser.js.map +7 -0
- package/lib/cjs/src/api/apdu/utils/ApduParser.test.js +2 -0
- package/lib/cjs/src/api/apdu/utils/ApduParser.test.js.map +7 -0
- package/lib/cjs/src/api/apdu/utils/AppBuilderError.js +2 -0
- package/lib/cjs/src/api/apdu/utils/AppBuilderError.js.map +7 -0
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js +2 -0
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js.map +7 -0
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js +2 -0
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js.map +7 -0
- package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js +2 -0
- package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js.map +7 -0
- package/lib/cjs/src/api/apdu/utils/ByteArrayParser.test.js +2 -0
- package/lib/cjs/src/api/apdu/utils/ByteArrayParser.test.js.map +7 -0
- package/lib/cjs/src/api/command/Command.js +2 -0
- package/lib/cjs/src/api/command/Command.js.map +7 -0
- package/lib/cjs/src/api/command/Errors.js +2 -0
- package/lib/cjs/src/api/command/Errors.js.map +7 -0
- package/lib/cjs/src/api/command/di/commandModule.js +2 -0
- package/lib/cjs/src/api/command/di/commandModule.js.map +7 -0
- package/lib/cjs/src/api/command/di/commandModule.test.js +2 -0
- package/lib/cjs/src/api/command/di/commandModule.test.js.map +7 -0
- package/lib/cjs/src/api/command/di/commandTypes.js +2 -0
- package/lib/cjs/src/api/command/di/commandTypes.js.map +7 -0
- package/lib/cjs/src/api/command/model/CommandResult.js +2 -0
- package/lib/cjs/src/api/command/model/CommandResult.js.map +7 -0
- package/lib/cjs/src/api/command/model/CommandResult.test.js +2 -0
- package/lib/cjs/src/api/command/model/CommandResult.test.js.map +7 -0
- package/lib/cjs/src/api/command/os/CloseAppCommand.js +2 -0
- package/lib/cjs/src/api/command/os/CloseAppCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/CloseAppCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/CloseAppCommand.test.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetAppAndVersionCommand.js +2 -0
- package/lib/cjs/src/api/command/os/GetAppAndVersionCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetAppAndVersionCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/GetAppAndVersionCommand.test.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetBatteryStatusCommand.js +2 -0
- package/lib/cjs/src/api/command/os/GetBatteryStatusCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetBatteryStatusCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/GetBatteryStatusCommand.test.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.js +2 -0
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js.map +7 -0
- package/lib/cjs/src/api/command/os/ListAppsCommand.js +2 -0
- package/lib/cjs/src/api/command/os/ListAppsCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/ListAppsCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/ListAppsCommand.test.js.map +7 -0
- package/lib/cjs/src/api/command/os/OpenAppCommand.js +2 -0
- package/lib/cjs/src/api/command/os/OpenAppCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/OpenAppCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/OpenAppCommand.test.js.map +7 -0
- package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js +2 -0
- package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js.map +7 -0
- package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js +2 -0
- package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js.map +7 -0
- package/lib/cjs/src/api/command/utils/CommandErrors.js +2 -0
- package/lib/cjs/src/api/command/utils/CommandErrors.js.map +7 -0
- package/lib/cjs/src/api/command/utils/CommandUtils.js +2 -0
- package/lib/cjs/src/api/command/utils/CommandUtils.js.map +7 -0
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js +2 -0
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js.map +7 -0
- package/lib/cjs/src/api/command/utils/GlobalCommandError.js +2 -0
- package/lib/cjs/src/api/command/utils/GlobalCommandError.js.map +7 -0
- package/lib/cjs/src/api/command/utils/GlobalCommandError.test.js +2 -0
- package/lib/cjs/src/api/command/utils/GlobalCommandError.test.js.map +7 -0
- package/lib/cjs/src/api/device/DeviceModel.js +2 -0
- package/lib/cjs/src/api/device/DeviceModel.js.map +7 -0
- package/lib/cjs/src/api/device/DeviceStatus.js +2 -0
- package/lib/cjs/src/api/device/DeviceStatus.js.map +7 -0
- package/lib/cjs/src/api/device-action/DeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/DeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/__test-utils__/data.js +2 -0
- package/lib/cjs/src/api/device-action/__test-utils__/data.js.map +7 -0
- package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +2 -0
- package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +7 -0
- package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +2 -0
- package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +7 -0
- package/lib/cjs/src/api/device-action/__test-utils__/testDeviceActionStates.js +2 -0
- package/lib/cjs/src/api/device-action/__test-utils__/testDeviceActionStates.js.map +7 -0
- package/lib/cjs/src/api/device-action/di/deviceActionModule.js +2 -0
- package/lib/cjs/src/api/device-action/di/deviceActionModule.js.map +7 -0
- package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js +2 -0
- package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/di/deviceActionTypes.js +2 -0
- package/lib/cjs/src/api/device-action/di/deviceActionTypes.js.map +7 -0
- package/lib/cjs/src/api/device-action/model/DeviceActionState.js +2 -0
- package/lib/cjs/src/api/device-action/model/DeviceActionState.js.map +7 -0
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +2 -0
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/Const.js +2 -0
- package/lib/cjs/src/api/device-action/os/Const.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/Errors.js +2 -0
- package/lib/cjs/src/api/device-action/os/Errors.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/types.js +2 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/types.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js +2 -0
- package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/ListApps/types.js +2 -0
- package/lib/cjs/src/api/device-action/os/ListApps/types.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/types.js +2 -0
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/types.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js +2 -0
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js +2 -0
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +7 -0
- package/lib/cjs/src/api/device-action/use-case/ExecuteDeviceActionUseCase.js +2 -0
- package/lib/cjs/src/api/device-action/use-case/ExecuteDeviceActionUseCase.js.map +7 -0
- package/lib/cjs/src/api/device-action/xstate-utils/StateMachineTypes.js +2 -0
- package/lib/cjs/src/api/device-action/xstate-utils/StateMachineTypes.js.map +7 -0
- package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-session/ApduResponse.js +2 -0
- package/lib/cjs/src/api/device-session/ApduResponse.js.map +7 -0
- package/lib/cjs/src/api/device-session/ApduResponse.stub.js +2 -0
- package/lib/cjs/src/api/device-session/ApduResponse.stub.js.map +7 -0
- package/lib/cjs/src/api/device-session/DeviceSessionState.js +2 -0
- package/lib/cjs/src/api/device-session/DeviceSessionState.js.map +7 -0
- package/lib/cjs/src/api/device-session/types.js +2 -0
- package/lib/cjs/src/api/device-session/types.js.map +7 -0
- package/lib/cjs/src/api/discovery/ConnectionType.js +2 -0
- package/lib/cjs/src/api/discovery/ConnectionType.js.map +7 -0
- package/lib/cjs/src/api/index.js +2 -0
- package/lib/cjs/src/api/index.js.map +7 -0
- package/lib/cjs/src/api/logger-subscriber/__mocks__/ConsoleLogger.js +2 -0
- package/lib/cjs/src/api/logger-subscriber/__mocks__/ConsoleLogger.js.map +7 -0
- package/lib/cjs/src/api/logger-subscriber/model/LogLevel.js +2 -0
- package/lib/cjs/src/api/logger-subscriber/model/LogLevel.js.map +7 -0
- package/lib/cjs/src/api/logger-subscriber/model/LogSubscriberOptions.js +2 -0
- package/lib/cjs/src/api/logger-subscriber/model/LogSubscriberOptions.js.map +7 -0
- package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.js +2 -0
- package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.js.map +7 -0
- package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js +2 -0
- package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +7 -0
- package/lib/cjs/src/api/logger-subscriber/service/LoggerSubscriberService.js +2 -0
- package/lib/cjs/src/api/logger-subscriber/service/LoggerSubscriberService.js.map +7 -0
- package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.js +2 -0
- package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.js.map +7 -0
- package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +2 -0
- package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +7 -0
- package/lib/cjs/src/api/transport/model/ConnectedDevice.js +2 -0
- package/lib/cjs/src/api/transport/model/ConnectedDevice.js.map +7 -0
- package/lib/cjs/src/api/transport/model/DiscoveredDevice.js +2 -0
- package/lib/cjs/src/api/transport/model/DiscoveredDevice.js.map +7 -0
- package/lib/cjs/src/api/transport/model/Transport.js +2 -0
- package/lib/cjs/src/api/transport/model/Transport.js.map +7 -0
- package/lib/cjs/src/api/transport/model/TransportIdentifier.js +2 -0
- package/lib/cjs/src/api/transport/model/TransportIdentifier.js.map +7 -0
- package/lib/cjs/src/api/types.js +2 -0
- package/lib/cjs/src/api/types.js.map +7 -0
- package/lib/cjs/src/api/utils/Base64String.js +2 -0
- package/lib/cjs/src/api/utils/Base64String.js.map +7 -0
- package/lib/cjs/src/api/utils/Base64String.test.js +2 -0
- package/lib/cjs/src/api/utils/Base64String.test.js.map +7 -0
- package/lib/cjs/src/api/utils/HexaString.js +2 -0
- package/lib/cjs/src/api/utils/HexaString.js.map +7 -0
- package/lib/cjs/src/api/utils/HexaString.test.js +2 -0
- package/lib/cjs/src/api/utils/HexaString.test.js.map +7 -0
- package/lib/cjs/src/di.js +2 -0
- package/lib/cjs/src/di.js.map +7 -0
- package/lib/cjs/src/di.stub.js +2 -0
- package/lib/cjs/src/di.stub.js.map +7 -0
- package/lib/cjs/src/index.js +2 -0
- package/lib/cjs/src/index.js.map +7 -0
- package/lib/cjs/src/internal/config/data/ConfigDataSource.js +2 -0
- package/lib/cjs/src/internal/config/data/ConfigDataSource.js.map +7 -0
- package/lib/cjs/src/internal/config/data/Dto.js +2 -0
- package/lib/cjs/src/internal/config/data/Dto.js.map +7 -0
- package/lib/cjs/src/internal/config/data/LocalConfigDataSource.js +2 -0
- package/lib/cjs/src/internal/config/data/LocalConfigDataSource.js.map +7 -0
- package/lib/cjs/src/internal/config/data/LocalConfigDataSource.stub.js +2 -0
- package/lib/cjs/src/internal/config/data/LocalConfigDataSource.stub.js.map +7 -0
- package/lib/cjs/src/internal/config/data/LocalConfigDataSource.test.js +2 -0
- package/lib/cjs/src/internal/config/data/LocalConfigDataSource.test.js.map +7 -0
- package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.js +2 -0
- package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.js.map +7 -0
- package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.stub.js +2 -0
- package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.stub.js.map +7 -0
- package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.test.js +2 -0
- package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.test.js.map +7 -0
- package/lib/cjs/src/internal/config/data/__mocks__/LocalConfigDataSource.js +2 -0
- package/lib/cjs/src/internal/config/data/__mocks__/LocalConfigDataSource.js.map +7 -0
- package/lib/cjs/src/internal/config/data/__mocks__/RemoteConfigDataSource.js +2 -0
- package/lib/cjs/src/internal/config/data/__mocks__/RemoteConfigDataSource.js.map +7 -0
- package/lib/cjs/src/internal/config/di/configModule.js +2 -0
- package/lib/cjs/src/internal/config/di/configModule.js.map +7 -0
- package/lib/cjs/src/internal/config/di/configModule.test.js +2 -0
- package/lib/cjs/src/internal/config/di/configModule.test.js.map +7 -0
- package/lib/cjs/src/internal/config/di/configTypes.js +2 -0
- package/lib/cjs/src/internal/config/di/configTypes.js.map +7 -0
- package/lib/cjs/src/internal/config/model/Config.js +2 -0
- package/lib/cjs/src/internal/config/model/Config.js.map +7 -0
- package/lib/cjs/src/internal/config/model/Errors.js +2 -0
- package/lib/cjs/src/internal/config/model/Errors.js.map +7 -0
- package/lib/cjs/src/internal/config/service/ConfigService.js +2 -0
- package/lib/cjs/src/internal/config/service/ConfigService.js.map +7 -0
- package/lib/cjs/src/internal/config/service/DefaultConfigService.js +2 -0
- package/lib/cjs/src/internal/config/service/DefaultConfigService.js.map +7 -0
- package/lib/cjs/src/internal/config/service/DefaultConfigService.test.js +2 -0
- package/lib/cjs/src/internal/config/service/DefaultConfigService.test.js.map +7 -0
- package/lib/cjs/src/internal/config/use-case/GetDmkVersionUseCase.js +2 -0
- package/lib/cjs/src/internal/config/use-case/GetDmkVersionUseCase.js.map +7 -0
- package/lib/cjs/src/internal/config/use-case/GetDmkVersionUseCase.test.js +2 -0
- package/lib/cjs/src/internal/config/use-case/GetDmkVersionUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/device-model/data/DeviceModelDataSource.js +2 -0
- package/lib/cjs/src/internal/device-model/data/DeviceModelDataSource.js.map +7 -0
- package/lib/cjs/src/internal/device-model/data/StaticDeviceModelDataSource.js +2 -0
- package/lib/cjs/src/internal/device-model/data/StaticDeviceModelDataSource.js.map +7 -0
- package/lib/cjs/src/internal/device-model/data/StaticDeviceModelDataSource.test.js +2 -0
- package/lib/cjs/src/internal/device-model/data/StaticDeviceModelDataSource.test.js.map +7 -0
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.js +2 -0
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.js.map +7 -0
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js +2 -0
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js.map +7 -0
- package/lib/cjs/src/internal/device-model/di/deviceModelTypes.js +2 -0
- package/lib/cjs/src/internal/device-model/di/deviceModelTypes.js.map +7 -0
- package/lib/cjs/src/internal/device-model/model/DeviceModel.js +2 -0
- package/lib/cjs/src/internal/device-model/model/DeviceModel.js.map +7 -0
- package/lib/cjs/src/internal/device-model/model/DeviceModel.stub.js +2 -0
- package/lib/cjs/src/internal/device-model/model/DeviceModel.stub.js.map +7 -0
- package/lib/cjs/src/internal/device-model/model/DeviceModel.test.js +2 -0
- package/lib/cjs/src/internal/device-model/model/DeviceModel.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js +2 -0
- package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js.map +7 -0
- package/lib/cjs/src/internal/device-session/data/DeviceSessionRefresherConst.js +2 -0
- package/lib/cjs/src/internal/device-session/data/DeviceSessionRefresherConst.js.map +7 -0
- package/lib/cjs/src/internal/device-session/data/FramerConst.js +2 -0
- package/lib/cjs/src/internal/device-session/data/FramerConst.js.map +7 -0
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +2 -0
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +7 -0
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js +2 -0
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js +2 -0
- package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSession.js +2 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js +2 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js +2 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js +2 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/Errors.js +2 -0
- package/lib/cjs/src/internal/device-session/model/Errors.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/Frame.js +2 -0
- package/lib/cjs/src/internal/device-session/model/Frame.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/FrameHeader.js +2 -0
- package/lib/cjs/src/internal/device-session/model/FrameHeader.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/ApduReceiverService.js +2 -0
- package/lib/cjs/src/internal/device-session/service/ApduReceiverService.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/ApduSenderService.js +2 -0
- package/lib/cjs/src/internal/device-session/service/ApduSenderService.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.js +2 -0
- package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.stub.js +2 -0
- package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.stub.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.test.js +2 -0
- package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js +2 -0
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.stub.js +2 -0
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.stub.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js +2 -0
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.js +2 -0
- package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js +2 -0
- package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/DeviceSessionService.js +2 -0
- package/lib/cjs/src/internal/device-session/service/DeviceSessionService.js.map +7 -0
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.js +2 -0
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.js.map +7 -0
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseState.test.js +2 -0
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseState.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.js +2 -0
- package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.js.map +7 -0
- package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +2 -0
- package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/utils/FramerUtils.js +2 -0
- package/lib/cjs/src/internal/device-session/utils/FramerUtils.js.map +7 -0
- package/lib/cjs/src/internal/device-session/utils/FramerUtils.test.js +2 -0
- package/lib/cjs/src/internal/device-session/utils/FramerUtils.test.js.map +7 -0
- package/lib/cjs/src/internal/discovery/di/discoveryModule.js +2 -0
- package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +7 -0
- package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +2 -0
- package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +7 -0
- package/lib/cjs/src/internal/discovery/di/discoveryTypes.js +2 -0
- package/lib/cjs/src/internal/discovery/di/discoveryTypes.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +2 -0
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js +2 -0
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js.map +7 -0
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js +2 -0
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js.map +7 -0
- package/lib/cjs/src/internal/logger-publisher/di/loggerTypes.js +2 -0
- package/lib/cjs/src/internal/logger-publisher/di/loggerTypes.js.map +7 -0
- package/lib/cjs/src/internal/logger-publisher/model/LogPublisherOptions.js +2 -0
- package/lib/cjs/src/internal/logger-publisher/model/LogPublisherOptions.js.map +7 -0
- package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.js +2 -0
- package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.js.map +7 -0
- package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +2 -0
- package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js.map +7 -0
- package/lib/cjs/src/internal/logger-publisher/service/LoggerPublisherService.js +2 -0
- package/lib/cjs/src/internal/logger-publisher/service/LoggerPublisherService.js.map +7 -0
- package/lib/cjs/src/internal/logger-publisher/service/__mocks__/DefaultLoggerService.js +2 -0
- package/lib/cjs/src/internal/logger-publisher/service/__mocks__/DefaultLoggerService.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +2 -0
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +2 -0
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +2 -0
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js +2 -0
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +2 -0
- package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +2 -0
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +2 -0
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js +2 -0
- package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/model/Const.js +2 -0
- package/lib/cjs/src/internal/manager-api/model/Const.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/model/Errors.js +2 -0
- package/lib/cjs/src/internal/manager-api/model/Errors.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/model/ManagerApiType.js +2 -0
- package/lib/cjs/src/internal/manager-api/model/ManagerApiType.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +2 -0
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +2 -0
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +2 -0
- package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +7 -0
- package/lib/cjs/src/internal/send/di/sendModule.js +2 -0
- package/lib/cjs/src/internal/send/di/sendModule.js.map +7 -0
- package/lib/cjs/src/internal/send/di/sendModule.test.js +2 -0
- package/lib/cjs/src/internal/send/di/sendModule.test.js.map +7 -0
- package/lib/cjs/src/internal/send/di/sendTypes.js +2 -0
- package/lib/cjs/src/internal/send/di/sendTypes.js.map +7 -0
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js +2 -0
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js.map +7 -0
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js +2 -0
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/transport/ble/di/bleDiTypes.js +2 -0
- package/lib/cjs/src/internal/transport/ble/di/bleDiTypes.js.map +7 -0
- package/lib/cjs/src/internal/transport/ble/di/bleModule.js +2 -0
- package/lib/cjs/src/internal/transport/ble/di/bleModule.js.map +7 -0
- package/lib/cjs/src/internal/transport/ble/di/bleModule.test.js +2 -0
- package/lib/cjs/src/internal/transport/ble/di/bleModule.test.js.map +7 -0
- package/lib/cjs/src/internal/transport/ble/model/BleDevice.stub.js +2 -0
- package/lib/cjs/src/internal/transport/ble/model/BleDevice.stub.js.map +7 -0
- package/lib/cjs/src/internal/transport/ble/model/BleDeviceInfos.js +2 -0
- package/lib/cjs/src/internal/transport/ble/model/BleDeviceInfos.js.map +7 -0
- package/lib/cjs/src/internal/transport/ble/service/BleDeviceConnectionFactory.js +2 -0
- package/lib/cjs/src/internal/transport/ble/service/BleDeviceConnectionFactory.js.map +7 -0
- package/lib/cjs/src/internal/transport/ble/service/BleDeviceConnectionFactory.stub.js +2 -0
- package/lib/cjs/src/internal/transport/ble/service/BleDeviceConnectionFactory.stub.js.map +7 -0
- package/lib/cjs/src/internal/transport/ble/transport/BleDeviceConnection.js +2 -0
- package/lib/cjs/src/internal/transport/ble/transport/BleDeviceConnection.js.map +7 -0
- package/lib/cjs/src/internal/transport/ble/transport/BleDeviceConnection.test.js +2 -0
- package/lib/cjs/src/internal/transport/ble/transport/BleDeviceConnection.test.js.map +7 -0
- package/lib/cjs/src/internal/transport/ble/transport/WebBleTransport.js +2 -0
- package/lib/cjs/src/internal/transport/ble/transport/WebBleTransport.js.map +7 -0
- package/lib/cjs/src/internal/transport/ble/transport/WebBleTransport.test.js +2 -0
- package/lib/cjs/src/internal/transport/ble/transport/WebBleTransport.test.js.map +7 -0
- package/lib/cjs/src/internal/transport/ble/transport/__mocks__/WebBleTransport.js +2 -0
- package/lib/cjs/src/internal/transport/ble/transport/__mocks__/WebBleTransport.js.map +7 -0
- package/lib/cjs/src/internal/transport/data/TransportDataSource.js +2 -0
- package/lib/cjs/src/internal/transport/data/TransportDataSource.js.map +7 -0
- package/lib/cjs/src/internal/transport/di/transportDiTypes.js +2 -0
- package/lib/cjs/src/internal/transport/di/transportDiTypes.js.map +7 -0
- package/lib/cjs/src/internal/transport/di/transportModule.js +2 -0
- package/lib/cjs/src/internal/transport/di/transportModule.js.map +7 -0
- package/lib/cjs/src/internal/transport/mockserver/MockserverTransport.js +2 -0
- package/lib/cjs/src/internal/transport/mockserver/MockserverTransport.js.map +7 -0
- package/lib/cjs/src/internal/transport/model/DeviceConnection.js +2 -0
- package/lib/cjs/src/internal/transport/model/DeviceConnection.js.map +7 -0
- package/lib/cjs/src/internal/transport/model/Errors.js +2 -0
- package/lib/cjs/src/internal/transport/model/Errors.js.map +7 -0
- package/lib/cjs/src/internal/transport/model/InternalConnectedDevice.js +2 -0
- package/lib/cjs/src/internal/transport/model/InternalConnectedDevice.js.map +7 -0
- package/lib/cjs/src/internal/transport/model/InternalConnectedDevice.stub.js +2 -0
- package/lib/cjs/src/internal/transport/model/InternalConnectedDevice.stub.js.map +7 -0
- package/lib/cjs/src/internal/transport/model/InternalConnectedDevice.test.js +2 -0
- package/lib/cjs/src/internal/transport/model/InternalConnectedDevice.test.js.map +7 -0
- package/lib/cjs/src/internal/transport/model/InternalDiscoveredDevice.js +2 -0
- package/lib/cjs/src/internal/transport/model/InternalDiscoveredDevice.js.map +7 -0
- package/lib/cjs/src/internal/transport/usb/data/UsbHidConfig.js +2 -0
- package/lib/cjs/src/internal/transport/usb/data/UsbHidConfig.js.map +7 -0
- package/lib/cjs/src/internal/transport/usb/di/usbDiTypes.js +2 -0
- package/lib/cjs/src/internal/transport/usb/di/usbDiTypes.js.map +7 -0
- package/lib/cjs/src/internal/transport/usb/di/usbModule.js +2 -0
- package/lib/cjs/src/internal/transport/usb/di/usbModule.js.map +7 -0
- package/lib/cjs/src/internal/transport/usb/di/usbModule.test.js +2 -0
- package/lib/cjs/src/internal/transport/usb/di/usbModule.test.js.map +7 -0
- package/lib/cjs/src/internal/transport/usb/model/HIDDevice.stub.js +2 -0
- package/lib/cjs/src/internal/transport/usb/model/HIDDevice.stub.js.map +7 -0
- package/lib/cjs/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.js +2 -0
- package/lib/cjs/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.js.map +7 -0
- package/lib/cjs/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.stub.js +2 -0
- package/lib/cjs/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.stub.js.map +7 -0
- package/lib/cjs/src/internal/transport/usb/transport/UsbHidDeviceConnection.js +2 -0
- package/lib/cjs/src/internal/transport/usb/transport/UsbHidDeviceConnection.js.map +7 -0
- package/lib/cjs/src/internal/transport/usb/transport/UsbHidDeviceConnection.test.js +2 -0
- package/lib/cjs/src/internal/transport/usb/transport/UsbHidDeviceConnection.test.js.map +7 -0
- package/lib/cjs/src/internal/transport/usb/transport/WebUsbHidTransport.js +2 -0
- package/lib/cjs/src/internal/transport/usb/transport/WebUsbHidTransport.js.map +7 -0
- package/lib/cjs/src/internal/transport/usb/transport/WebUsbHidTransport.test.js +2 -0
- package/lib/cjs/src/internal/transport/usb/transport/WebUsbHidTransport.test.js.map +7 -0
- package/lib/cjs/src/internal/transport/usb/transport/__mocks__/WebUsbHidTransport.js +2 -0
- package/lib/cjs/src/internal/transport/usb/transport/__mocks__/WebUsbHidTransport.js.map +7 -0
- package/lib/esm/index.js +1 -26507
- package/lib/esm/index.js.map +4 -4
- package/lib/esm/package.json +64 -0
- package/lib/esm/src/api/DeviceManagementKit.js +2 -0
- package/lib/esm/src/api/DeviceManagementKit.js.map +7 -0
- package/lib/esm/src/api/DeviceManagementKit.test.js +2 -0
- package/lib/esm/src/api/DeviceManagementKit.test.js.map +7 -0
- package/lib/esm/src/api/DeviceManagementKitBuilder.js +2 -0
- package/lib/esm/src/api/DeviceManagementKitBuilder.js.map +7 -0
- package/lib/esm/src/api/DeviceManagementKitBuilder.test.js +2 -0
- package/lib/esm/src/api/DeviceManagementKitBuilder.test.js.map +7 -0
- package/lib/esm/src/api/DmkConfig.js +1 -0
- package/lib/esm/src/api/DmkConfig.js.map +7 -0
- package/lib/esm/src/api/Error.js +2 -0
- package/lib/esm/src/api/Error.js.map +7 -0
- package/lib/esm/src/api/apdu/model/Apdu.js +2 -0
- package/lib/esm/src/api/apdu/model/Apdu.js.map +7 -0
- package/lib/esm/src/api/apdu/model/Apdu.test.js +2 -0
- package/lib/esm/src/api/apdu/model/Apdu.test.js.map +7 -0
- package/lib/esm/src/api/apdu/utils/ApduBuilder.js +2 -0
- package/lib/esm/src/api/apdu/utils/ApduBuilder.js.map +7 -0
- package/lib/esm/src/api/apdu/utils/ApduBuilder.test.js +2 -0
- package/lib/esm/src/api/apdu/utils/ApduBuilder.test.js.map +7 -0
- package/lib/esm/src/api/apdu/utils/ApduParser.js +2 -0
- package/lib/esm/src/api/apdu/utils/ApduParser.js.map +7 -0
- package/lib/esm/src/api/apdu/utils/ApduParser.test.js +2 -0
- package/lib/esm/src/api/apdu/utils/ApduParser.test.js.map +7 -0
- package/lib/esm/src/api/apdu/utils/AppBuilderError.js +2 -0
- package/lib/esm/src/api/apdu/utils/AppBuilderError.js.map +7 -0
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js +2 -0
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js.map +7 -0
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js +2 -0
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js.map +7 -0
- package/lib/esm/src/api/apdu/utils/ByteArrayParser.js +2 -0
- package/lib/esm/src/api/apdu/utils/ByteArrayParser.js.map +7 -0
- package/lib/esm/src/api/apdu/utils/ByteArrayParser.test.js +2 -0
- package/lib/esm/src/api/apdu/utils/ByteArrayParser.test.js.map +7 -0
- package/lib/esm/src/api/command/Command.js +1 -0
- package/lib/esm/src/api/command/Command.js.map +7 -0
- package/lib/esm/src/api/command/Errors.js +2 -0
- package/lib/esm/src/api/command/Errors.js.map +7 -0
- package/lib/esm/src/api/command/di/commandModule.js +2 -0
- package/lib/esm/src/api/command/di/commandModule.js.map +7 -0
- package/lib/esm/src/api/command/di/commandModule.test.js +2 -0
- package/lib/esm/src/api/command/di/commandModule.test.js.map +7 -0
- package/lib/esm/src/api/command/di/commandTypes.js +2 -0
- package/lib/esm/src/api/command/di/commandTypes.js.map +7 -0
- package/lib/esm/src/api/command/model/CommandResult.js +2 -0
- package/lib/esm/src/api/command/model/CommandResult.js.map +7 -0
- package/lib/esm/src/api/command/model/CommandResult.test.js +2 -0
- package/lib/esm/src/api/command/model/CommandResult.test.js.map +7 -0
- package/lib/esm/src/api/command/os/CloseAppCommand.js +2 -0
- package/lib/esm/src/api/command/os/CloseAppCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/CloseAppCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/CloseAppCommand.test.js.map +7 -0
- package/lib/esm/src/api/command/os/GetAppAndVersionCommand.js +2 -0
- package/lib/esm/src/api/command/os/GetAppAndVersionCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/GetAppAndVersionCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/GetAppAndVersionCommand.test.js.map +7 -0
- package/lib/esm/src/api/command/os/GetBatteryStatusCommand.js +2 -0
- package/lib/esm/src/api/command/os/GetBatteryStatusCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/GetBatteryStatusCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/GetBatteryStatusCommand.test.js.map +7 -0
- package/lib/esm/src/api/command/os/GetOsVersionCommand.js +2 -0
- package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js.map +7 -0
- package/lib/esm/src/api/command/os/ListAppsCommand.js +2 -0
- package/lib/esm/src/api/command/os/ListAppsCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/ListAppsCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/ListAppsCommand.test.js.map +7 -0
- package/lib/esm/src/api/command/os/OpenAppCommand.js +2 -0
- package/lib/esm/src/api/command/os/OpenAppCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/OpenAppCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/OpenAppCommand.test.js.map +7 -0
- package/lib/esm/src/api/command/use-case/SendCommandUseCase.js +2 -0
- package/lib/esm/src/api/command/use-case/SendCommandUseCase.js.map +7 -0
- package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js +2 -0
- package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js.map +7 -0
- package/lib/esm/src/api/command/utils/CommandErrors.js +2 -0
- package/lib/esm/src/api/command/utils/CommandErrors.js.map +7 -0
- package/lib/esm/src/api/command/utils/CommandUtils.js +2 -0
- package/lib/esm/src/api/command/utils/CommandUtils.js.map +7 -0
- package/lib/esm/src/api/command/utils/CommandUtils.test.js +2 -0
- package/lib/esm/src/api/command/utils/CommandUtils.test.js.map +7 -0
- package/lib/esm/src/api/command/utils/GlobalCommandError.js +2 -0
- package/lib/esm/src/api/command/utils/GlobalCommandError.js.map +7 -0
- package/lib/esm/src/api/command/utils/GlobalCommandError.test.js +2 -0
- package/lib/esm/src/api/command/utils/GlobalCommandError.test.js.map +7 -0
- package/lib/esm/src/api/device/DeviceModel.js +2 -0
- package/lib/esm/src/api/device/DeviceModel.js.map +7 -0
- package/lib/esm/src/api/device/DeviceStatus.js +2 -0
- package/lib/esm/src/api/device/DeviceStatus.js.map +7 -0
- package/lib/esm/src/api/device-action/DeviceAction.js +1 -0
- package/lib/esm/src/api/device-action/DeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/__test-utils__/data.js +2 -0
- package/lib/esm/src/api/device-action/__test-utils__/data.js.map +7 -0
- package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +2 -0
- package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +7 -0
- package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +2 -0
- package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +7 -0
- package/lib/esm/src/api/device-action/__test-utils__/testDeviceActionStates.js +2 -0
- package/lib/esm/src/api/device-action/__test-utils__/testDeviceActionStates.js.map +7 -0
- package/lib/esm/src/api/device-action/di/deviceActionModule.js +2 -0
- package/lib/esm/src/api/device-action/di/deviceActionModule.js.map +7 -0
- package/lib/esm/src/api/device-action/di/deviceActionModule.test.js +2 -0
- package/lib/esm/src/api/device-action/di/deviceActionModule.test.js.map +7 -0
- package/lib/esm/src/api/device-action/di/deviceActionTypes.js +2 -0
- package/lib/esm/src/api/device-action/di/deviceActionTypes.js.map +7 -0
- package/lib/esm/src/api/device-action/model/DeviceActionState.js +2 -0
- package/lib/esm/src/api/device-action/model/DeviceActionState.js.map +7 -0
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +2 -0
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +7 -0
- package/lib/esm/src/api/device-action/os/Const.js +2 -0
- package/lib/esm/src/api/device-action/os/Const.js.map +7 -0
- package/lib/esm/src/api/device-action/os/Errors.js +2 -0
- package/lib/esm/src/api/device-action/os/Errors.js.map +7 -0
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/types.js +1 -0
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/types.js.map +7 -0
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/GoToDashboard/types.js +1 -0
- package/lib/esm/src/api/device-action/os/GoToDashboard/types.js.map +7 -0
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/ListApps/types.js +1 -0
- package/lib/esm/src/api/device-action/os/ListApps/types.js.map +7 -0
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/types.js +1 -0
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/types.js.map +7 -0
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -0
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/types.js.map +7 -0
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js +1 -0
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +7 -0
- package/lib/esm/src/api/device-action/use-case/ExecuteDeviceActionUseCase.js +2 -0
- package/lib/esm/src/api/device-action/use-case/ExecuteDeviceActionUseCase.js.map +7 -0
- package/lib/esm/src/api/device-action/xstate-utils/StateMachineTypes.js +1 -0
- package/lib/esm/src/api/device-action/xstate-utils/StateMachineTypes.js.map +7 -0
- package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-session/ApduResponse.js +2 -0
- package/lib/esm/src/api/device-session/ApduResponse.js.map +7 -0
- package/lib/esm/src/api/device-session/ApduResponse.stub.js +2 -0
- package/lib/esm/src/api/device-session/ApduResponse.stub.js.map +7 -0
- package/lib/esm/src/api/device-session/DeviceSessionState.js +2 -0
- package/lib/esm/src/api/device-session/DeviceSessionState.js.map +7 -0
- package/lib/esm/src/api/device-session/types.js +1 -0
- package/lib/esm/src/api/device-session/types.js.map +7 -0
- package/lib/esm/src/api/discovery/ConnectionType.js +1 -0
- package/lib/esm/src/api/discovery/ConnectionType.js.map +7 -0
- package/lib/esm/src/api/index.js +2 -0
- package/lib/esm/src/api/index.js.map +7 -0
- package/lib/esm/src/api/logger-subscriber/__mocks__/ConsoleLogger.js +2 -0
- package/lib/esm/src/api/logger-subscriber/__mocks__/ConsoleLogger.js.map +7 -0
- package/lib/esm/src/api/logger-subscriber/model/LogLevel.js +2 -0
- package/lib/esm/src/api/logger-subscriber/model/LogLevel.js.map +7 -0
- package/lib/esm/src/api/logger-subscriber/model/LogSubscriberOptions.js +1 -0
- package/lib/esm/src/api/logger-subscriber/model/LogSubscriberOptions.js.map +7 -0
- package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.js +2 -0
- package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.js.map +7 -0
- package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js +2 -0
- package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +7 -0
- package/lib/esm/src/api/logger-subscriber/service/LoggerSubscriberService.js +1 -0
- package/lib/esm/src/api/logger-subscriber/service/LoggerSubscriberService.js.map +7 -0
- package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.js +2 -0
- package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.js.map +7 -0
- package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +2 -0
- package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +7 -0
- package/lib/esm/src/api/transport/model/ConnectedDevice.js +2 -0
- package/lib/esm/src/api/transport/model/ConnectedDevice.js.map +7 -0
- package/lib/esm/src/api/transport/model/DiscoveredDevice.js +1 -0
- package/lib/esm/src/api/transport/model/DiscoveredDevice.js.map +7 -0
- package/lib/esm/src/api/transport/model/Transport.js +1 -0
- package/lib/esm/src/api/transport/model/Transport.js.map +7 -0
- package/lib/esm/src/api/transport/model/TransportIdentifier.js +2 -0
- package/lib/esm/src/api/transport/model/TransportIdentifier.js.map +7 -0
- package/lib/esm/src/api/types.js +1 -0
- package/lib/esm/src/api/types.js.map +7 -0
- package/lib/esm/src/api/utils/Base64String.js +2 -0
- package/lib/esm/src/api/utils/Base64String.js.map +7 -0
- package/lib/esm/src/api/utils/Base64String.test.js +2 -0
- package/lib/esm/src/api/utils/Base64String.test.js.map +7 -0
- package/lib/esm/src/api/utils/HexaString.js +2 -0
- package/lib/esm/src/api/utils/HexaString.js.map +7 -0
- package/lib/esm/src/api/utils/HexaString.test.js +2 -0
- package/lib/esm/src/api/utils/HexaString.test.js.map +7 -0
- package/lib/esm/src/di.js +2 -0
- package/lib/esm/src/di.js.map +7 -0
- package/lib/esm/src/di.stub.js +2 -0
- package/lib/esm/src/di.stub.js.map +7 -0
- package/lib/esm/src/index.js +2 -0
- package/lib/esm/src/index.js.map +7 -0
- package/lib/esm/src/internal/config/data/ConfigDataSource.js +1 -0
- package/lib/esm/src/internal/config/data/ConfigDataSource.js.map +7 -0
- package/lib/esm/src/internal/config/data/Dto.js +1 -0
- package/lib/esm/src/internal/config/data/Dto.js.map +7 -0
- package/lib/esm/src/internal/config/data/LocalConfigDataSource.js +2 -0
- package/lib/esm/src/internal/config/data/LocalConfigDataSource.js.map +7 -0
- package/lib/esm/src/internal/config/data/LocalConfigDataSource.stub.js +2 -0
- package/lib/esm/src/internal/config/data/LocalConfigDataSource.stub.js.map +7 -0
- package/lib/esm/src/internal/config/data/LocalConfigDataSource.test.js +2 -0
- package/lib/esm/src/internal/config/data/LocalConfigDataSource.test.js.map +7 -0
- package/lib/esm/src/internal/config/data/RemoteConfigDataSource.js +2 -0
- package/lib/esm/src/internal/config/data/RemoteConfigDataSource.js.map +7 -0
- package/lib/esm/src/internal/config/data/RemoteConfigDataSource.stub.js +2 -0
- package/lib/esm/src/internal/config/data/RemoteConfigDataSource.stub.js.map +7 -0
- package/lib/esm/src/internal/config/data/RemoteConfigDataSource.test.js +2 -0
- package/lib/esm/src/internal/config/data/RemoteConfigDataSource.test.js.map +7 -0
- package/lib/esm/src/internal/config/data/__mocks__/LocalConfigDataSource.js +2 -0
- package/lib/esm/src/internal/config/data/__mocks__/LocalConfigDataSource.js.map +7 -0
- package/lib/esm/src/internal/config/data/__mocks__/RemoteConfigDataSource.js +2 -0
- package/lib/esm/src/internal/config/data/__mocks__/RemoteConfigDataSource.js.map +7 -0
- package/lib/esm/src/internal/config/di/configModule.js +2 -0
- package/lib/esm/src/internal/config/di/configModule.js.map +7 -0
- package/lib/esm/src/internal/config/di/configModule.test.js +2 -0
- package/lib/esm/src/internal/config/di/configModule.test.js.map +7 -0
- package/lib/esm/src/internal/config/di/configTypes.js +2 -0
- package/lib/esm/src/internal/config/di/configTypes.js.map +7 -0
- package/lib/esm/src/internal/config/model/Config.js +2 -0
- package/lib/esm/src/internal/config/model/Config.js.map +7 -0
- package/lib/esm/src/internal/config/model/Errors.js +2 -0
- package/lib/esm/src/internal/config/model/Errors.js.map +7 -0
- package/lib/esm/src/internal/config/service/ConfigService.js +1 -0
- package/lib/esm/src/internal/config/service/ConfigService.js.map +7 -0
- package/lib/esm/src/internal/config/service/DefaultConfigService.js +2 -0
- package/lib/esm/src/internal/config/service/DefaultConfigService.js.map +7 -0
- package/lib/esm/src/internal/config/service/DefaultConfigService.test.js +2 -0
- package/lib/esm/src/internal/config/service/DefaultConfigService.test.js.map +7 -0
- package/lib/esm/src/internal/config/use-case/GetDmkVersionUseCase.js +2 -0
- package/lib/esm/src/internal/config/use-case/GetDmkVersionUseCase.js.map +7 -0
- package/lib/esm/src/internal/config/use-case/GetDmkVersionUseCase.test.js +2 -0
- package/lib/esm/src/internal/config/use-case/GetDmkVersionUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/device-model/data/DeviceModelDataSource.js +1 -0
- package/lib/esm/src/internal/device-model/data/DeviceModelDataSource.js.map +7 -0
- package/lib/esm/src/internal/device-model/data/StaticDeviceModelDataSource.js +2 -0
- package/lib/esm/src/internal/device-model/data/StaticDeviceModelDataSource.js.map +7 -0
- package/lib/esm/src/internal/device-model/data/StaticDeviceModelDataSource.test.js +2 -0
- package/lib/esm/src/internal/device-model/data/StaticDeviceModelDataSource.test.js.map +7 -0
- package/lib/esm/src/internal/device-model/di/deviceModelModule.js +2 -0
- package/lib/esm/src/internal/device-model/di/deviceModelModule.js.map +7 -0
- package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js +2 -0
- package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js.map +7 -0
- package/lib/esm/src/internal/device-model/di/deviceModelTypes.js +2 -0
- package/lib/esm/src/internal/device-model/di/deviceModelTypes.js.map +7 -0
- package/lib/esm/src/internal/device-model/model/DeviceModel.js +2 -0
- package/lib/esm/src/internal/device-model/model/DeviceModel.js.map +7 -0
- package/lib/esm/src/internal/device-model/model/DeviceModel.stub.js +2 -0
- package/lib/esm/src/internal/device-model/model/DeviceModel.stub.js.map +7 -0
- package/lib/esm/src/internal/device-model/model/DeviceModel.test.js +2 -0
- package/lib/esm/src/internal/device-model/model/DeviceModel.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/data/ApduResponseConst.js +2 -0
- package/lib/esm/src/internal/device-session/data/ApduResponseConst.js.map +7 -0
- package/lib/esm/src/internal/device-session/data/DeviceSessionRefresherConst.js +2 -0
- package/lib/esm/src/internal/device-session/data/DeviceSessionRefresherConst.js.map +7 -0
- package/lib/esm/src/internal/device-session/data/FramerConst.js +2 -0
- package/lib/esm/src/internal/device-session/data/FramerConst.js.map +7 -0
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +2 -0
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +7 -0
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js +2 -0
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js +2 -0
- package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/DeviceSession.js +2 -0
- package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js +2 -0
- package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js +2 -0
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js +2 -0
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/Errors.js +2 -0
- package/lib/esm/src/internal/device-session/model/Errors.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/Frame.js +2 -0
- package/lib/esm/src/internal/device-session/model/Frame.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/FrameHeader.js +2 -0
- package/lib/esm/src/internal/device-session/model/FrameHeader.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/ApduReceiverService.js +1 -0
- package/lib/esm/src/internal/device-session/service/ApduReceiverService.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/ApduSenderService.js +1 -0
- package/lib/esm/src/internal/device-session/service/ApduSenderService.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.js +2 -0
- package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.stub.js +2 -0
- package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.stub.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.test.js +2 -0
- package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js +2 -0
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.stub.js +2 -0
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.stub.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js +2 -0
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.js +2 -0
- package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js +2 -0
- package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/DeviceSessionService.js +1 -0
- package/lib/esm/src/internal/device-session/service/DeviceSessionService.js.map +7 -0
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.js +2 -0
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.js.map +7 -0
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseState.test.js +2 -0
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseState.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.js +2 -0
- package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.js.map +7 -0
- package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +2 -0
- package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/utils/FramerUtils.js +2 -0
- package/lib/esm/src/internal/device-session/utils/FramerUtils.js.map +7 -0
- package/lib/esm/src/internal/device-session/utils/FramerUtils.test.js +2 -0
- package/lib/esm/src/internal/device-session/utils/FramerUtils.test.js.map +7 -0
- package/lib/esm/src/internal/discovery/di/discoveryModule.js +2 -0
- package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +7 -0
- package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +2 -0
- package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +7 -0
- package/lib/esm/src/internal/discovery/di/discoveryTypes.js +2 -0
- package/lib/esm/src/internal/discovery/di/discoveryTypes.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +2 -0
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.js +2 -0
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.js.map +7 -0
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js +2 -0
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js.map +7 -0
- package/lib/esm/src/internal/logger-publisher/di/loggerTypes.js +2 -0
- package/lib/esm/src/internal/logger-publisher/di/loggerTypes.js.map +7 -0
- package/lib/esm/src/internal/logger-publisher/model/LogPublisherOptions.js +1 -0
- package/lib/esm/src/internal/logger-publisher/model/LogPublisherOptions.js.map +7 -0
- package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.js +2 -0
- package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.js.map +7 -0
- package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +2 -0
- package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js.map +7 -0
- package/lib/esm/src/internal/logger-publisher/service/LoggerPublisherService.js +1 -0
- package/lib/esm/src/internal/logger-publisher/service/LoggerPublisherService.js.map +7 -0
- package/lib/esm/src/internal/logger-publisher/service/__mocks__/DefaultLoggerService.js +2 -0
- package/lib/esm/src/internal/logger-publisher/service/__mocks__/DefaultLoggerService.js.map +7 -0
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +2 -0
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +7 -0
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +2 -0
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +7 -0
- package/lib/esm/src/internal/manager-api/data/ManagerApiDataSource.js +1 -0
- package/lib/esm/src/internal/manager-api/data/ManagerApiDataSource.js.map +7 -0
- package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js +2 -0
- package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js.map +7 -0
- package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +2 -0
- package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +7 -0
- package/lib/esm/src/internal/manager-api/di/managerApiModule.js +2 -0
- package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +7 -0
- package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +2 -0
- package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +7 -0
- package/lib/esm/src/internal/manager-api/di/managerApiTypes.js +2 -0
- package/lib/esm/src/internal/manager-api/di/managerApiTypes.js.map +7 -0
- package/lib/esm/src/internal/manager-api/model/Const.js +2 -0
- package/lib/esm/src/internal/manager-api/model/Const.js.map +7 -0
- package/lib/esm/src/internal/manager-api/model/Errors.js +2 -0
- package/lib/esm/src/internal/manager-api/model/Errors.js.map +7 -0
- package/lib/esm/src/internal/manager-api/model/ManagerApiType.js +2 -0
- package/lib/esm/src/internal/manager-api/model/ManagerApiType.js.map +7 -0
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +2 -0
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +7 -0
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +2 -0
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +7 -0
- package/lib/esm/src/internal/manager-api/service/ManagerApiService.js +1 -0
- package/lib/esm/src/internal/manager-api/service/ManagerApiService.js.map +7 -0
- package/lib/esm/src/internal/send/di/sendModule.js +2 -0
- package/lib/esm/src/internal/send/di/sendModule.js.map +7 -0
- package/lib/esm/src/internal/send/di/sendModule.test.js +2 -0
- package/lib/esm/src/internal/send/di/sendModule.test.js.map +7 -0
- package/lib/esm/src/internal/send/di/sendTypes.js +2 -0
- package/lib/esm/src/internal/send/di/sendTypes.js.map +7 -0
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.js +2 -0
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.js.map +7 -0
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js +2 -0
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/transport/ble/di/bleDiTypes.js +2 -0
- package/lib/esm/src/internal/transport/ble/di/bleDiTypes.js.map +7 -0
- package/lib/esm/src/internal/transport/ble/di/bleModule.js +2 -0
- package/lib/esm/src/internal/transport/ble/di/bleModule.js.map +7 -0
- package/lib/esm/src/internal/transport/ble/di/bleModule.test.js +2 -0
- package/lib/esm/src/internal/transport/ble/di/bleModule.test.js.map +7 -0
- package/lib/esm/src/internal/transport/ble/model/BleDevice.stub.js +2 -0
- package/lib/esm/src/internal/transport/ble/model/BleDevice.stub.js.map +7 -0
- package/lib/esm/src/internal/transport/ble/model/BleDeviceInfos.js +2 -0
- package/lib/esm/src/internal/transport/ble/model/BleDeviceInfos.js.map +7 -0
- package/lib/esm/src/internal/transport/ble/service/BleDeviceConnectionFactory.js +2 -0
- package/lib/esm/src/internal/transport/ble/service/BleDeviceConnectionFactory.js.map +7 -0
- package/lib/esm/src/internal/transport/ble/service/BleDeviceConnectionFactory.stub.js +2 -0
- package/lib/esm/src/internal/transport/ble/service/BleDeviceConnectionFactory.stub.js.map +7 -0
- package/lib/esm/src/internal/transport/ble/transport/BleDeviceConnection.js +2 -0
- package/lib/esm/src/internal/transport/ble/transport/BleDeviceConnection.js.map +7 -0
- package/lib/esm/src/internal/transport/ble/transport/BleDeviceConnection.test.js +2 -0
- package/lib/esm/src/internal/transport/ble/transport/BleDeviceConnection.test.js.map +7 -0
- package/lib/esm/src/internal/transport/ble/transport/WebBleTransport.js +2 -0
- package/lib/esm/src/internal/transport/ble/transport/WebBleTransport.js.map +7 -0
- package/lib/esm/src/internal/transport/ble/transport/WebBleTransport.test.js +2 -0
- package/lib/esm/src/internal/transport/ble/transport/WebBleTransport.test.js.map +7 -0
- package/lib/esm/src/internal/transport/ble/transport/__mocks__/WebBleTransport.js +2 -0
- package/lib/esm/src/internal/transport/ble/transport/__mocks__/WebBleTransport.js.map +7 -0
- package/lib/esm/src/internal/transport/data/TransportDataSource.js +2 -0
- package/lib/esm/src/internal/transport/data/TransportDataSource.js.map +7 -0
- package/lib/esm/src/internal/transport/di/transportDiTypes.js +2 -0
- package/lib/esm/src/internal/transport/di/transportDiTypes.js.map +7 -0
- package/lib/esm/src/internal/transport/di/transportModule.js +2 -0
- package/lib/esm/src/internal/transport/di/transportModule.js.map +7 -0
- package/lib/esm/src/internal/transport/mockserver/MockserverTransport.js +2 -0
- package/lib/esm/src/internal/transport/mockserver/MockserverTransport.js.map +7 -0
- package/lib/esm/src/internal/transport/model/DeviceConnection.js +1 -0
- package/lib/esm/src/internal/transport/model/DeviceConnection.js.map +7 -0
- package/lib/esm/src/internal/transport/model/Errors.js +2 -0
- package/lib/esm/src/internal/transport/model/Errors.js.map +7 -0
- package/lib/esm/src/internal/transport/model/InternalConnectedDevice.js +2 -0
- package/lib/esm/src/internal/transport/model/InternalConnectedDevice.js.map +7 -0
- package/lib/esm/src/internal/transport/model/InternalConnectedDevice.stub.js +2 -0
- package/lib/esm/src/internal/transport/model/InternalConnectedDevice.stub.js.map +7 -0
- package/lib/esm/src/internal/transport/model/InternalConnectedDevice.test.js +2 -0
- package/lib/esm/src/internal/transport/model/InternalConnectedDevice.test.js.map +7 -0
- package/lib/esm/src/internal/transport/model/InternalDiscoveredDevice.js +1 -0
- package/lib/esm/src/internal/transport/model/InternalDiscoveredDevice.js.map +7 -0
- package/lib/esm/src/internal/transport/usb/data/UsbHidConfig.js +2 -0
- package/lib/esm/src/internal/transport/usb/data/UsbHidConfig.js.map +7 -0
- package/lib/esm/src/internal/transport/usb/di/usbDiTypes.js +2 -0
- package/lib/esm/src/internal/transport/usb/di/usbDiTypes.js.map +7 -0
- package/lib/esm/src/internal/transport/usb/di/usbModule.js +2 -0
- package/lib/esm/src/internal/transport/usb/di/usbModule.js.map +7 -0
- package/lib/esm/src/internal/transport/usb/di/usbModule.test.js +2 -0
- package/lib/esm/src/internal/transport/usb/di/usbModule.test.js.map +7 -0
- package/lib/esm/src/internal/transport/usb/model/HIDDevice.stub.js +2 -0
- package/lib/esm/src/internal/transport/usb/model/HIDDevice.stub.js.map +7 -0
- package/lib/esm/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.js +2 -0
- package/lib/esm/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.js.map +7 -0
- package/lib/esm/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.stub.js +2 -0
- package/lib/esm/src/internal/transport/usb/service/UsbHidDeviceConnectionFactory.stub.js.map +7 -0
- package/lib/esm/src/internal/transport/usb/transport/UsbHidDeviceConnection.js +2 -0
- package/lib/esm/src/internal/transport/usb/transport/UsbHidDeviceConnection.js.map +7 -0
- package/lib/esm/src/internal/transport/usb/transport/UsbHidDeviceConnection.test.js +2 -0
- package/lib/esm/src/internal/transport/usb/transport/UsbHidDeviceConnection.test.js.map +7 -0
- package/lib/esm/src/internal/transport/usb/transport/WebUsbHidTransport.js +2 -0
- package/lib/esm/src/internal/transport/usb/transport/WebUsbHidTransport.js.map +7 -0
- package/lib/esm/src/internal/transport/usb/transport/WebUsbHidTransport.test.js +2 -0
- package/lib/esm/src/internal/transport/usb/transport/WebUsbHidTransport.test.js.map +7 -0
- package/lib/esm/src/internal/transport/usb/transport/__mocks__/WebUsbHidTransport.js +2 -0
- package/lib/esm/src/internal/transport/usb/transport/__mocks__/WebUsbHidTransport.js.map +7 -0
- package/lib/types/src/api/{DeviceSdk.d.ts → DeviceManagementKit.d.ts} +38 -23
- package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -0
- package/lib/types/src/api/DeviceManagementKit.test.d.ts +2 -0
- package/lib/types/src/api/DeviceManagementKit.test.d.ts.map +1 -0
- package/lib/types/src/api/DeviceManagementKitBuilder.d.ts +35 -0
- package/lib/types/src/api/DeviceManagementKitBuilder.d.ts.map +1 -0
- package/lib/types/src/api/DeviceManagementKitBuilder.test.d.ts +2 -0
- package/lib/types/src/api/DeviceManagementKitBuilder.test.d.ts.map +1 -0
- package/lib/types/src/api/DmkConfig.d.ts +5 -0
- package/lib/types/src/api/DmkConfig.d.ts.map +1 -0
- package/lib/types/src/api/Error.d.ts +2 -2
- package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts +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 +2 -2
- package/lib/types/src/api/apdu/utils/ApduParser.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/AppBuilderError.d.ts +5 -5
- package/lib/types/src/api/apdu/utils/AppBuilderError.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts +1 -1
- package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts +1 -1
- package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts.map +1 -1
- package/lib/types/src/api/command/Command.d.ts +4 -4
- package/lib/types/src/api/command/Command.d.ts.map +1 -1
- package/lib/types/src/api/command/Errors.d.ts +6 -6
- package/lib/types/src/api/command/Errors.d.ts.map +1 -1
- package/lib/types/src/api/command/model/CommandResult.d.ts +3 -3
- package/lib/types/src/api/command/model/CommandResult.d.ts.map +1 -1
- package/lib/types/src/api/command/os/CloseAppCommand.d.ts +4 -4
- package/lib/types/src/api/command/os/CloseAppCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/os/GetAppAndVersionCommand.d.ts +4 -4
- package/lib/types/src/api/command/os/GetAppAndVersionCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/os/GetBatteryStatusCommand.d.ts +4 -4
- package/lib/types/src/api/command/os/GetBatteryStatusCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +4 -4
- package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/os/ListAppsCommand.d.ts +5 -5
- package/lib/types/src/api/command/os/ListAppsCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/os/OpenAppCommand.d.ts +5 -5
- package/lib/types/src/api/command/os/OpenAppCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/CommandErrors.d.ts +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 +1 -1
- package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/GlobalCommandError.d.ts +4 -4
- package/lib/types/src/api/command/utils/GlobalCommandError.d.ts.map +1 -1
- package/lib/types/src/api/device-action/DeviceAction.d.ts +8 -8
- 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 +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 +4 -4
- package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
- package/lib/types/src/api/device-action/__test-utils__/testDeviceActionStates.d.ts +4 -4
- package/lib/types/src/api/device-action/__test-utils__/testDeviceActionStates.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/Errors.d.ts +4 -4
- package/lib/types/src/api/device-action/os/Errors.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts +5 -5
- package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceStatus/types.d.ts +6 -6
- package/lib/types/src/api/device-action/os/GetDeviceStatus/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.d.ts +5 -5
- 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 +5 -5
- package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/ListApps/ListAppsDeviceAction.d.ts +4 -4
- package/lib/types/src/api/device-action/os/ListApps/ListAppsDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/ListApps/types.d.ts +6 -6
- package/lib/types/src/api/device-action/os/ListApps/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts +9 -9
- package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/ListAppsWithMetadata/types.d.ts +8 -8
- package/lib/types/src/api/device-action/os/ListAppsWithMetadata/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts +7 -9
- 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 +7 -6
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.d.ts +6 -6
- 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 +3 -3
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-action/use-case/ExecuteDeviceActionUseCase.d.ts +3 -3
- package/lib/types/src/api/device-action/xstate-utils/StateMachineTypes.d.ts +1 -1
- package/lib/types/src/api/device-action/xstate-utils/StateMachineTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts +6 -6
- package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-session/ApduResponse.stub.d.ts +1 -1
- package/lib/types/src/api/device-session/ApduResponse.stub.d.ts.map +1 -1
- package/lib/types/src/api/device-session/DeviceSessionState.d.ts +4 -4
- package/lib/types/src/api/device-session/DeviceSessionState.d.ts.map +1 -1
- package/lib/types/src/api/index.d.ts +3 -3
- package/lib/types/src/api/index.d.ts.map +1 -1
- package/lib/types/src/api/logger-subscriber/service/ConsoleLogger.d.ts +2 -2
- package/lib/types/src/api/logger-subscriber/service/ConsoleLogger.d.ts.map +1 -1
- package/lib/types/src/api/logger-subscriber/service/LoggerSubscriberService.d.ts +9 -4
- package/lib/types/src/api/logger-subscriber/service/LoggerSubscriberService.d.ts.map +1 -1
- package/lib/types/src/api/logger-subscriber/service/WebLogsExporterLogger.d.ts +2 -2
- package/lib/types/src/api/logger-subscriber/service/WebLogsExporterLogger.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/ConnectedDevice.d.ts +7 -4
- package/lib/types/src/api/transport/model/ConnectedDevice.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts +2 -2
- package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/Transport.d.ts +10 -9
- package/lib/types/src/api/transport/model/Transport.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/TransportIdentifier.d.ts +1 -0
- package/lib/types/src/api/transport/model/TransportIdentifier.d.ts.map +1 -1
- package/lib/types/src/api/types.d.ts +1 -1
- package/lib/types/src/api/types.d.ts.map +1 -1
- package/lib/types/src/di.d.ts +5 -5
- package/lib/types/src/di.d.ts.map +1 -1
- package/lib/types/src/internal/config/data/ConfigDataSource.d.ts +3 -3
- package/lib/types/src/internal/config/data/ConfigDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/config/data/__mocks__/LocalConfigDataSource.d.ts +1 -1
- package/lib/types/src/internal/config/data/__mocks__/LocalConfigDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/config/data/__mocks__/RemoteConfigDataSource.d.ts +1 -1
- package/lib/types/src/internal/config/data/__mocks__/RemoteConfigDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/config/di/configTypes.d.ts +1 -1
- package/lib/types/src/internal/config/service/ConfigService.d.ts +2 -2
- package/lib/types/src/internal/config/service/ConfigService.d.ts.map +1 -1
- package/lib/types/src/internal/config/service/DefaultConfigService.d.ts +1 -1
- package/lib/types/src/internal/config/use-case/GetDmkVersionUseCase.d.ts +12 -0
- package/lib/types/src/internal/config/use-case/{GetSdkVersionUseCase.d.ts.map → GetDmkVersionUseCase.d.ts.map} +1 -1
- package/lib/types/src/internal/config/use-case/GetDmkVersionUseCase.test.d.ts +2 -0
- package/lib/types/src/internal/config/use-case/GetDmkVersionUseCase.test.d.ts.map +1 -0
- package/lib/types/src/internal/device-model/data/DeviceModelDataSource.d.ts +5 -2
- package/lib/types/src/internal/device-model/data/DeviceModelDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/device-model/data/StaticDeviceModelDataSource.d.ts +3 -0
- package/lib/types/src/internal/device-model/data/StaticDeviceModelDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/device-model/model/DeviceModel.stub.d.ts +1 -1
- package/lib/types/src/internal/device-model/model/DeviceModel.stub.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/data/DeviceSessionRefresherConst.d.ts +2 -0
- package/lib/types/src/internal/device-session/data/DeviceSessionRefresherConst.d.ts.map +1 -0
- package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/di/deviceSessionTypes.d.ts +0 -1
- package/lib/types/src/internal/device-session/di/deviceSessionTypes.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +11 -11
- package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts +2 -2
- package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts +28 -4
- package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/Errors.d.ts +6 -6
- package/lib/types/src/internal/device-session/model/Errors.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/Frame.d.ts +1 -1
- package/lib/types/src/internal/device-session/model/Frame.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/FrameHeader.d.ts +1 -1
- package/lib/types/src/internal/device-session/model/FrameHeader.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/service/ApduReceiverService.d.ts +4 -4
- package/lib/types/src/internal/device-session/service/ApduReceiverService.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/service/ApduSenderService.d.ts +1 -1
- package/lib/types/src/internal/device-session/service/ApduSenderService.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/service/DefaultApduReceiverService.stub.d.ts +3 -3
- package/lib/types/src/internal/device-session/service/DefaultApduReceiverService.stub.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/service/DefaultApduSenderService.stub.d.ts +3 -3
- package/lib/types/src/internal/device-session/service/DefaultApduSenderService.stub.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/service/DefaultDeviceSessionService.d.ts +4 -1
- package/lib/types/src/internal/device-session/service/DefaultDeviceSessionService.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/service/DeviceSessionService.d.ts +7 -5
- package/lib/types/src/internal/device-session/service/DeviceSessionService.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/use-case/CloseSessionsUseState.test.d.ts +2 -0
- package/lib/types/src/internal/device-session/use-case/CloseSessionsUseState.test.d.ts.map +1 -0
- package/lib/types/src/internal/discovery/di/discoveryModule.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts +3 -0
- package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/use-case/DisconnectUseCase.d.ts +1 -1
- package/lib/types/src/internal/discovery/use-case/GetConnectedDeviceUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/{device-session/use-case/ListDeviceSessionsUseCase.d.ts → discovery/use-case/ListConnectedDevicesUseCase.d.ts} +5 -5
- package/lib/types/src/internal/discovery/use-case/ListConnectedDevicesUseCase.d.ts.map +1 -0
- package/lib/types/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.d.ts +2 -0
- package/lib/types/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.d.ts.map +1 -0
- package/lib/types/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.d.ts +14 -0
- package/lib/types/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.d.ts.map +1 -0
- package/lib/types/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.d.ts +2 -0
- package/lib/types/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.d.ts.map +1 -0
- package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.d.ts +13 -0
- package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.d.ts.map +1 -0
- package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.d.ts +2 -0
- package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.d.ts.map +1 -0
- package/lib/types/src/internal/logger-publisher/di/loggerModule.d.ts +1 -1
- package/lib/types/src/internal/logger-publisher/di/loggerModule.d.ts.map +1 -1
- package/lib/types/src/internal/logger-publisher/service/LoggerPublisherService.d.ts +2 -2
- package/lib/types/src/internal/logger-publisher/service/LoggerPublisherService.d.ts.map +1 -1
- package/lib/types/src/internal/logger-publisher/service/__mocks__/DefaultLoggerService.d.ts +1 -1
- package/lib/types/src/internal/logger-publisher/service/__mocks__/DefaultLoggerService.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +2 -2
- package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +3 -3
- package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +1 -1
- 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 +2 -2
- 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 -1
- package/lib/types/src/internal/manager-api/model/Errors.d.ts +2 -2
- package/lib/types/src/internal/manager-api/model/Errors.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +4 -4
- package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
- package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts +1 -1
- package/lib/types/src/internal/transport/ble/di/bleDiTypes.d.ts +4 -0
- package/lib/types/src/internal/transport/ble/di/bleDiTypes.d.ts.map +1 -0
- package/lib/types/src/internal/transport/ble/di/bleModule.d.ts +3 -0
- package/lib/types/src/internal/transport/ble/di/bleModule.d.ts.map +1 -0
- package/lib/types/src/internal/transport/ble/di/bleModule.test.d.ts +2 -0
- package/lib/types/src/internal/transport/ble/di/bleModule.test.d.ts.map +1 -0
- package/lib/types/src/internal/transport/ble/model/BleDevice.stub.d.ts +3 -0
- package/lib/types/src/internal/transport/ble/model/BleDevice.stub.d.ts.map +1 -0
- package/lib/types/src/internal/transport/ble/model/BleDeviceInfos.d.ts +10 -0
- package/lib/types/src/internal/transport/ble/model/BleDeviceInfos.d.ts.map +1 -0
- package/lib/types/src/internal/transport/ble/service/BleDeviceConnectionFactory.d.ts +13 -0
- package/lib/types/src/internal/transport/ble/service/BleDeviceConnectionFactory.d.ts.map +1 -0
- package/lib/types/src/internal/transport/ble/service/BleDeviceConnectionFactory.stub.d.ts +3 -0
- package/lib/types/src/internal/transport/ble/service/BleDeviceConnectionFactory.stub.d.ts.map +1 -0
- package/lib/types/src/internal/transport/ble/transport/BleDeviceConnection.d.ts +104 -0
- package/lib/types/src/internal/transport/ble/transport/BleDeviceConnection.d.ts.map +1 -0
- package/lib/types/src/internal/transport/ble/transport/BleDeviceConnection.test.d.ts +2 -0
- package/lib/types/src/internal/transport/ble/transport/BleDeviceConnection.test.d.ts.map +1 -0
- package/lib/types/src/internal/transport/ble/transport/WebBleTransport.d.ts +97 -0
- package/lib/types/src/internal/transport/ble/transport/WebBleTransport.d.ts.map +1 -0
- package/lib/types/src/internal/transport/ble/transport/WebBleTransport.test.d.ts +2 -0
- package/lib/types/src/internal/transport/ble/transport/WebBleTransport.test.d.ts.map +1 -0
- package/lib/types/src/internal/transport/ble/transport/__mocks__/WebBleTransport.d.ts +14 -0
- package/lib/types/src/internal/transport/ble/transport/__mocks__/WebBleTransport.d.ts.map +1 -0
- package/lib/types/src/internal/transport/data/TransportDataSource.d.ts +2 -2
- package/lib/types/src/internal/transport/data/TransportDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/transport/di/transportDiTypes.d.ts +1 -1
- package/lib/types/src/internal/transport/di/transportModule.d.ts +4 -4
- package/lib/types/src/internal/transport/di/transportModule.d.ts.map +1 -1
- package/lib/types/src/internal/transport/mockserver/MockserverTransport.d.ts +6 -5
- package/lib/types/src/internal/transport/mockserver/MockserverTransport.d.ts.map +1 -1
- package/lib/types/src/internal/transport/model/DeviceConnection.d.ts +5 -5
- package/lib/types/src/internal/transport/model/DeviceConnection.d.ts.map +1 -1
- package/lib/types/src/internal/transport/model/Errors.d.ts +34 -14
- package/lib/types/src/internal/transport/model/Errors.d.ts.map +1 -1
- package/lib/types/src/internal/transport/model/InternalConnectedDevice.d.ts +5 -5
- package/lib/types/src/internal/transport/model/InternalConnectedDevice.d.ts.map +1 -1
- package/lib/types/src/internal/transport/model/InternalConnectedDevice.stub.d.ts +1 -1
- package/lib/types/src/internal/transport/model/InternalConnectedDevice.stub.d.ts.map +1 -1
- package/lib/types/src/internal/transport/model/InternalDiscoveredDevice.d.ts +3 -3
- package/lib/types/src/internal/transport/model/InternalDiscoveredDevice.d.ts.map +1 -1
- package/lib/types/src/internal/transport/usb/transport/UsbHidDeviceConnection.d.ts +2 -2
- package/lib/types/src/internal/transport/usb/transport/WebUsbHidTransport.d.ts +27 -33
- package/lib/types/src/internal/transport/usb/transport/WebUsbHidTransport.d.ts.map +1 -1
- package/lib/types/src/internal/transport/usb/transport/__mocks__/WebUsbHidTransport.d.ts +2 -1
- package/lib/types/src/internal/transport/usb/transport/__mocks__/WebUsbHidTransport.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +17 -13
- package/lib/types/src/api/DeviceSdk.d.ts.map +0 -1
- package/lib/types/src/api/DeviceSdk.test.d.ts +0 -2
- package/lib/types/src/api/DeviceSdk.test.d.ts.map +0 -1
- package/lib/types/src/api/DeviceSdkBuilder.d.ts +0 -35
- package/lib/types/src/api/DeviceSdkBuilder.d.ts.map +0 -1
- package/lib/types/src/api/DeviceSdkBuilder.test.d.ts +0 -2
- package/lib/types/src/api/DeviceSdkBuilder.test.d.ts.map +0 -1
- package/lib/types/src/api/SdkConfig.d.ts +0 -5
- package/lib/types/src/api/SdkConfig.d.ts.map +0 -1
- package/lib/types/src/internal/config/use-case/GetSdkVersionUseCase.d.ts +0 -12
- package/lib/types/src/internal/config/use-case/GetSdkVersionUseCase.test.d.ts +0 -2
- package/lib/types/src/internal/config/use-case/GetSdkVersionUseCase.test.d.ts.map +0 -1
- package/lib/types/src/internal/device-session/use-case/ListDeviceSessionsUseCase.d.ts.map +0 -1
- package/lib/types/src/internal/device-session/use-case/ListDeviceSessionsUseCase.test.d.ts +0 -2
- package/lib/types/src/internal/device-session/use-case/ListDeviceSessionsUseCase.test.d.ts.map +0 -1
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.ts"],
|
4
|
+
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { Observable } from \"rxjs\";\nimport { tap, timeout } from \"rxjs/operators\";\nimport { assign, fromObservable, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetAppAndVersionCommand,\n type GetAppAndVersionCommandResult,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\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 {\n DeviceLockedError,\n DeviceNotOnboardedError,\n} from \"@api/device-action/os/Errors\";\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 GetDeviceStatusDAError,\n type GetDeviceStatusDAInput,\n type GetDeviceStatusDAIntermediateValue,\n type GetDeviceStatusDAOutput,\n} from \"./types\";\n\ntype GetDeviceStatusMachineInternalState = {\n readonly onboarded: boolean;\n readonly locked: boolean;\n readonly currentApp: string | null;\n readonly currentAppVersion: string | null;\n readonly error: GetDeviceStatusDAError | null;\n};\n\nexport type MachineDependencies = {\n readonly getAppAndVersion: () => Promise<GetAppAndVersionCommandResult>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly waitForDeviceUnlock: (args: {\n input: { unlockTimeout: number };\n }) => Observable<void>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n readonly isDeviceOnboarded: () => boolean;\n};\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class GetDeviceStatusDeviceAction extends XStateDeviceAction<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n > {\n type types = StateMachineTypes<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n >;\n\n const {\n getAppAndVersion,\n getDeviceSessionState,\n setDeviceSessionState,\n waitForDeviceUnlock,\n isDeviceOnboarded,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\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 getAppAndVersion: fromPromise(getAppAndVersion),\n waitForDeviceUnlock: fromObservable(waitForDeviceUnlock),\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 isDeviceUnlocked: () =>\n getDeviceSessionState().deviceStatus !== DeviceStatus.LOCKED,\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 assignErrorDeviceLocked: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceLockedError(),\n }),\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\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 assignNoUserActionNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignUserActionUnlockNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHEwBcAiYBuBLAxmAMpoCGaArrFnoQIL5q4D2AdgHQ0FgBKYpEAJ4BiANoAGALqJQAB2axcTNjJAAPRAFoArAHZx7AIwAmQ7oCcugMyHzANmMAWYwBoQgxI8vsAHOJM+VuLmVj5e2gC+EW6omDjcJORUXPSMLBwA8qwARsykAE4QuKxQAMIAFmD4ANZiUqryisqsqhoImo4O7OGhPj4h5n6Obh4IunZ2RoZ+ena6nYaGUTHoKcRklN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n6CShaFE-1JMkWzPgXpCjh+Faw3Mjq5jdOlJhGvo-RzRr3uvr79VjgFzQtWFpARVFnWxcHQNCylCBm+eKPjJL4jWMEdNww4O46vSFVsfyD5Nlj3na9KRAUPghCwPAIdV20QIR7e-RzOYbNK98cN7ndgR-BSzgo+YmdfYPOfSgAovkQ75MbyVtItehmSrJgcijz2uHD+pmXyQSQnyVLs2tQA */\n id: \"GetDeviceStatusDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n const sessionState = getDeviceSessionState();\n const { sessionStateType } = sessionState;\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n onboarded: false, // we don't know how to check yet\n locked: sessionState.deviceStatus === DeviceStatus.LOCKED,\n currentApp:\n sessionStateType ===\n DeviceSessionStateType.ReadyWithoutSecureChannel\n ? sessionState.currentApp.name\n : null,\n currentAppVersion: null,\n error: null,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"OnboardingCheck\",\n },\n },\n OnboardingCheck: {\n // TODO: we don't have this info for now\n always: [\n {\n guard: {\n type: \"isDeviceOnboarded\",\n },\n target: \"LockingCheck\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n onboarded: true,\n }),\n }),\n },\n {\n target: \"Error\",\n actions: \"assignErrorDeviceNotOnboarded\",\n },\n ],\n },\n LockingCheck: {\n // We check if the device is locked in the session state\n always: [\n {\n target: \"AppAndVersionCheck\",\n guard: {\n type: \"isDeviceUnlocked\",\n },\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n locked: false,\n }),\n }),\n },\n {\n target: \"UserActionUnlockDevice\",\n },\n ],\n },\n UserActionUnlockDevice: {\n // we wait for the device to be unlocked (default timeout is 15s)\n entry: \"assignUserActionUnlockNeeded\",\n exit: \"assignNoUserActionNeeded\",\n invoke: {\n id: \"UserActionUnlockDevice\",\n src: \"waitForDeviceUnlock\",\n input: (_) => ({\n unlockTimeout,\n }),\n onDone: {\n target: \"AppAndVersionCheck\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n locked: false,\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorDeviceLocked\",\n },\n },\n },\n AppAndVersionCheck: {\n // We check the current app and version using the getAppAndVersion command\n invoke: {\n src: \"getAppAndVersion\",\n onDone: {\n target: \"ApplicationAvailableResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n const state: DeviceSessionState = getDeviceSessionState();\n // Narrow the type to ReadyWithoutSecureChannelState or ReadyWithSecureChannelState\n if (\n state.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n setDeviceSessionState({\n ...state,\n currentApp: _.event.output.data,\n });\n }\n return {\n ..._.context._internalState,\n currentApp: _.event.output.data.name,\n currentAppVersion: _.event.output.data.version,\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 ApplicationAvailableResultCheck: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (args) => {\n // TODO: instead we should rely on the current state (\"Success\" or \"Error\")\n const { context } = args;\n const { error, currentApp, currentAppVersion } = context._internalState;\n if (error) {\n return Left(error);\n }\n return Right<GetDeviceStatusDAOutput>({\n currentApp: currentApp!,\n currentAppVersion: currentAppVersion!,\n });\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const getAppAndVersion = () => {\n return internalApi.sendCommand(new GetAppAndVersionCommand());\n };\n\n const waitForDeviceUnlock = ({\n input,\n }: {\n input: { unlockTimeout: number };\n }) =>\n new Observable<void>((subscriber) => {\n const inner = internalApi\n .getDeviceSessionStateObservable()\n .pipe(\n tap((state) => {\n if (state.deviceStatus === DeviceStatus.CONNECTED) {\n subscriber.complete();\n inner.unsubscribe();\n }\n }),\n )\n .subscribe();\n\n return () => {\n inner.unsubscribe();\n };\n }).pipe(timeout(input.unlockTimeout));\n\n return {\n getAppAndVersion,\n waitForDeviceUnlock,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n isDeviceOnboarded: () => true, // TODO: we don't have this info for now\n };\n }\n}\n"],
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,qBAC5BC,EAA2B,gBAC3BC,EAA6B,0BAC7BC,EAA2D,kBAE3DC,EAAuC,4CACvCC,EAGO,mDACPC,EAA6B,oCAE7BC,EAAwC,4DACxCC,EAA0C,uCAC1CC,EAGO,wCAEPC,EAGO,8DACPC,EAGO,kDAiCA,MAAMb,UAAoC,oBAM/C,CACA,iBACEc,EAOA,CASA,KAAM,CACJ,iBAAAC,EACA,sBAAAC,EACA,sBAAAC,EACA,oBAAAC,EACA,kBAAAC,CACF,EAAI,KAAK,oBAAoBL,CAAW,EAElCM,EAAgB,KAAK,MAAM,eAAiB,4BAElD,SAAO,SAAM,CACX,MAAO,CACL,MAAO,CACL,cAAAA,CACF,EACA,QAAS,CAAC,EACV,OAAQ,CAAC,CACX,EACA,OAAQ,CACN,oBAAkB,eAAYL,CAAgB,EAC9C,uBAAqB,kBAAeG,CAAmB,CACzD,EACA,OAAQ,CACN,kBAAmB,IAAMC,EAAkB,EAC3C,iBAAkB,IAChBH,EAAsB,EAAE,eAAiB,eAAa,OACxD,SAAU,CAAC,CAAE,QAAAK,CAAQ,IAAMA,EAAQ,eAAe,QAAU,IAC9D,EACA,QAAS,CACP,iCAA+B,UAAO,CACpC,eAAiBC,IAAO,CACtB,GAAGA,EAAE,QAAQ,eACb,MAAO,IAAI,yBACb,EACF,CAAC,EACD,2BAAyB,UA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B,CAAC,CACH,CACF,CAAC,CACH,CAEA,oBAAoBf,EAA+C,CA4BjE,MAAO,CACL,iBA5BuB,IAChBA,EAAY,YAAY,IAAI,yBAAyB,EA4B5D,oBAzB0B,CAAC,CAC3B,MAAAgB,CACF,IAGE,IAAI,aAAkBC,GAAe,CACnC,MAAMC,EAAQlB,EACX,gCAAgC,EAChC,QACC,OAAKW,GAAU,CACTA,EAAM,eAAiB,eAAa,YACtCM,EAAW,SAAS,EACpBC,EAAM,YAAY,EAEtB,CAAC,CACH,EACC,UAAU,EAEb,MAAO,IAAM,CACXA,EAAM,YAAY,CACpB,CACF,CAAC,EAAE,QAAK,WAAQF,EAAM,aAAa,CAAC,EAKpC,sBAAuB,IAAMhB,EAAY,sBAAsB,EAC/D,sBAAwBW,GACtBX,EAAY,sBAAsBW,CAAK,EACzC,kBAAmB,IAAM,EAC3B,CACF,CACF",
|
6
|
+
"names": ["GetDeviceStatusDeviceAction_exports", "__export", "GetDeviceStatusDeviceAction", "__toCommonJS", "import_purify_ts", "import_rxjs", "import_operators", "import_xstate", "import_CommandResult", "import_GetAppAndVersionCommand", "import_DeviceStatus", "import_UserInteractionRequired", "import_Const", "import_Errors", "import_XStateDeviceAction", "import_DeviceSessionState", "internalApi", "getAppAndVersion", "getDeviceSessionState", "setDeviceSessionState", "waitForDeviceUnlock", "isDeviceOnboarded", "unlockTimeout", "context", "_", "sessionState", "sessionStateType", "state", "args", "error", "currentApp", "currentAppVersion", "input", "subscriber", "inner"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var u=require("rxjs"),S=require("../../../command/model/CommandResult"),h=require("../../../command/utils/GlobalCommandError"),i=require("../../../device/DeviceStatus"),a=require("../../../device-action/__test-utils__/makeInternalApi"),d=require("../../../device-action/__test-utils__/testDeviceActionStates"),t=require("../../../device-action/model/DeviceActionState"),c=require("../../../device-action/model/UserInteractionRequired"),v=require("../../../device-action/os/Errors"),s=require("../../../device-session/DeviceSessionState"),p=require("./GetDeviceStatusDeviceAction");describe("GetDeviceStatusDeviceAction",()=>{const A=jest.fn(),l=jest.fn(),C=jest.fn(),b=jest.fn(),y=jest.fn();function D(){return{getAppAndVersion:A,getDeviceSessionState:l,waitForDeviceUnlock:C,setDeviceSessionState:b,isDeviceOnboarded:y}}const{sendCommand:O,getDeviceSessionState:R,getDeviceSessionStateObservable:V}=(0,a.makeDeviceActionInternalApiMock)();beforeEach(()=>{jest.resetAllMocks(),y.mockReturnValue(!0)}),describe("without overriding `extractDependencies`",()=>{it("should run the device action with an unlocked device",r=>{const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});R.mockReturnValue({sessionStateType:s.DeviceSessionStateType.Connected,deviceStatus:i.DeviceStatus.CONNECTED}),O.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should run the device action with a locked device",r=>{const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});R.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[]}),V.mockImplementation(()=>new u.Observable(o=>{const m=(0,u.interval)(50).subscribe({next:k=>{k>2?(o.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[]}),o.complete()):o.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[]})}});return()=>{m.unsubscribe()}})),O.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)})}),describe("success cases",()=>{it("should return the device status if the device is unlocked",r=>{l.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),A.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:void 0}});jest.spyOn(e,"extractDependencies").mockReturnValue(D());const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should return the device status if the device is locked and the user unlocks the device",r=>{l.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),A.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}})),C.mockImplementation(()=>new u.Observable(o=>{const m=(0,u.interval)(50).subscribe({next:k=>{k>2?(o.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),o.complete()):o.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{m.unsubscribe()}}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(D());const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)})}),describe("errors cases",()=>{it("should end in an error if the device is not onboarded",r=>{l.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),y.mockReturnValue(!1);const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(D());const n=[{error:new v.DeviceNotOnboardedError,status:t.DeviceActionStatus.Error}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should end in an error if the device is locked and the user does not unlock",r=>{l.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),V.mockImplementation(()=>new u.Observable(o=>{const m=(0,u.interval)(200).subscribe({next:()=>{o.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[]})}});return()=>{m.unsubscribe()}}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(D());const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{error:new v.DeviceLockedError("Device locked."),status:t.DeviceActionStatus.Error}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should end in an error if the GetAppAndVersion command fails",r=>{l.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}});const e=new h.GlobalCommandError({...h.GLOBAL_ERRORS[5501],errorCode:"5501"});A.mockResolvedValue((0,S.CommandResultFactory)({error:e})),C.mockImplementation(()=>new u.Observable(m=>{const k=(0,u.interval)(50).subscribe({next:f=>{f>2?(m.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),m.complete()):m.next({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{k.unsubscribe()}}));const n=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(n,"extractDependencies").mockReturnValue(D());const o=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:e,status:t.DeviceActionStatus.Error}];(0,d.testDeviceActionStates)(n,o,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should end in an error if getAppAndVersion actor throws an error",r=>{l.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),A.mockImplementation(()=>{throw new v.UnknownDAError("error")}),C.mockImplementation(()=>new u.Observable(o=>{o.complete()}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(D());const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:new v.UnknownDAError("error"),status:t.DeviceActionStatus.Error}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)})}),it("should emit a stopped state if the action is cancelled",r=>{R.mockReturnValue({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[]}),O.mockResolvedValue((0,S.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}}),n=[{status:t.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None}},{status:t.DeviceActionStatus.Stopped}],{cancel:o}=(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r);o()})});
|
2
|
+
//# sourceMappingURL=GetDeviceStatusDeviceAction.test.js.map
|
package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.ts"],
|
4
|
+
"sourcesContent": ["import { interval, Observable } from \"rxjs\";\n\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport {\n GLOBAL_ERRORS,\n GlobalCommandError,\n} from \"@api/command/utils/GlobalCommandError\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\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 { GetDeviceStatusDeviceAction } from \"./GetDeviceStatusDeviceAction\";\nimport { type GetDeviceStatusDAState } from \"./types\";\n\ndescribe(\"GetDeviceStatusDeviceAction\", () => {\n const getAppAndVersionMock = jest.fn();\n const getDeviceSessionStateMock = jest.fn();\n const waitForDeviceUnlockMock = jest.fn();\n const setDeviceSessionState = jest.fn();\n const isDeviceOnboardedMock = jest.fn();\n\n function extractDependenciesMock() {\n return {\n getAppAndVersion: getAppAndVersionMock,\n getDeviceSessionState: getDeviceSessionStateMock,\n waitForDeviceUnlock: waitForDeviceUnlockMock,\n setDeviceSessionState: setDeviceSessionState,\n isDeviceOnboarded: isDeviceOnboardedMock,\n };\n }\n\n const {\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n getDeviceSessionStateObservable: apiGetDeviceSessionStateObservableMock,\n } = makeDeviceActionInternalApiMock();\n beforeEach(() => {\n jest.resetAllMocks();\n isDeviceOnboardedMock.mockReturnValue(true);\n });\n\n describe(\"without overriding `extractDependencies`\", () => {\n it(\"should run the device action with an unlocked device\", (done) => {\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n });\n\n sendCommandMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should run the device action with a locked device\", (done) => {\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n });\n\n apiGetDeviceSessionStateObservableMock.mockImplementation(\n () =>\n new Observable((o) => {\n const inner = interval(50).subscribe({\n next: (i) => {\n if (i > 2) {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n });\n o.complete();\n } else {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n });\n }\n },\n });\n\n return () => {\n inner.unsubscribe();\n };\n }),\n );\n\n sendCommandMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"success cases\", () => {\n it(\"should return the device status if the device is unlocked\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: undefined },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Completed,\n output: {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should return the device status if the device is locked and the user unlocks the device\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n waitForDeviceUnlockMock.mockImplementation(\n () =>\n new Observable((o) => {\n const inner = interval(50).subscribe({\n next: (i) => {\n if (i > 2) {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n o.complete();\n } else {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n }\n },\n });\n\n return () => {\n inner.unsubscribe();\n };\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Completed,\n output: {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"errors cases\", () => {\n it(\"should end in an error if the device is not onboarded\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n isDeviceOnboardedMock.mockReturnValue(false);\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n error: new DeviceNotOnboardedError(),\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should end in an error if the device is locked and the user does not unlock\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n apiGetDeviceSessionStateObservableMock.mockImplementation(\n () =>\n new Observable((o) => {\n const inner = interval(200).subscribe({\n next: () => {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n });\n },\n });\n\n return () => {\n inner.unsubscribe();\n };\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n error: new DeviceLockedError(\"Device locked.\"),\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should end in an error if the GetAppAndVersion command fails\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n const error = new GlobalCommandError({\n ...GLOBAL_ERRORS[\"5501\"],\n errorCode: \"5501\",\n });\n\n getAppAndVersionMock.mockResolvedValue(CommandResultFactory({ error }));\n\n waitForDeviceUnlockMock.mockImplementation(\n () =>\n new Observable((o) => {\n const inner = interval(50).subscribe({\n next: (i) => {\n if (i > 2) {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n o.complete();\n } else {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n }\n },\n });\n\n return () => {\n inner.unsubscribe();\n };\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n error,\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should end in an error if getAppAndVersion actor throws an error\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n getAppAndVersionMock.mockImplementation(() => {\n throw new UnknownDAError(\"error\");\n });\n\n waitForDeviceUnlockMock.mockImplementation(\n () =>\n new Observable((o) => {\n o.complete();\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n error: new UnknownDAError(\"error\"),\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n it(\"should emit a stopped state if the action is cancelled\", (done) => {\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n });\n\n sendCommandMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Stopped,\n },\n ];\n\n const { cancel } = testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n cancel();\n });\n});\n"],
|
5
|
+
"mappings": "aAAA,IAAAA,EAAqC,gBAErCC,EAAqC,4CACrCC,EAGO,iDACPC,EAA6B,oCAC7BC,EAAgD,6DAChDC,EAAuC,oEACvCC,EAAmC,sDACnCC,EAAwC,4DACxCC,EAIO,wCACPC,EAAuC,kDAEvCC,EAA4C,yCAG5C,SAAS,8BAA+B,IAAM,CAC5C,MAAMC,EAAuB,KAAK,GAAG,EAC/BC,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3B,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,CACF,EACA,CACE,OAAQ,qBAAmB,OAC7B,CACF,EAEM,CAAE,OAAAK,CAAO,KAAI,0BACjBN,EACAC,KACA,mCAAgC,EAChCF,CACF,EACAO,EAAO,CACT,CAAC,CACH,CAAC",
|
6
|
+
"names": ["import_rxjs", "import_CommandResult", "import_GlobalCommandError", "import_DeviceStatus", "import_makeInternalApi", "import_testDeviceActionStates", "import_DeviceActionState", "import_UserInteractionRequired", "import_Errors", "import_DeviceSessionState", "import_GetDeviceStatusDeviceAction", "getAppAndVersionMock", "getDeviceSessionStateMock", "waitForDeviceUnlockMock", "setDeviceSessionState", "isDeviceOnboardedMock", "extractDependenciesMock", "sendCommandMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "done", "getDeviceStateDeviceAction", "expectedStates", "inner", "i", "error", "o", "cancel"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var p=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of a(e))!u.call(t,r)&&r!==n&&i(t,r,{get:()=>e[r],enumerable:!(o=c(e,r))||o.enumerable});return t};var D=t=>p(i({},"__esModule",{value:!0}),t);var d={};module.exports=D(d);
|
2
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../src/api/device-action/os/GetDeviceStatus/types.ts"],
|
4
|
+
"sourcesContent": ["import { type CommandErrorResult } from \"@api/command/model/CommandResult\";\nimport { type DeviceActionState } from \"@api/device-action/model/DeviceActionState\";\nimport { type UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport {\n type DeviceLockedError,\n type DeviceNotOnboardedError,\n type UnknownDAError,\n} from \"@api/device-action/os/Errors\";\n\nexport type GetDeviceStatusDAOutput = {\n readonly currentApp: string;\n readonly currentAppVersion: string;\n};\nexport type GetDeviceStatusDAInput = {\n readonly unlockTimeout?: number;\n};\n\nexport type GetDeviceStatusDAError =\n | DeviceNotOnboardedError\n | DeviceLockedError\n | UnknownDAError\n | CommandErrorResult[\"error\"];\n\nexport type GetDeviceStatusDARequiredInteraction =\n | UserInteractionRequired.None\n | UserInteractionRequired.UnlockDevice;\n\nexport type GetDeviceStatusDAIntermediateValue = {\n requiredUserInteraction: GetDeviceStatusDARequiredInteraction;\n};\n\nexport type GetDeviceStatusDAState = DeviceActionState<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue\n>;\n"],
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
6
|
+
"names": ["types_exports", "__toCommonJS"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var c=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var f=(a,t)=>{for(var s in t)c(a,s,{get:t[s],enumerable:!0})},C=(a,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of b(t))!x.call(a,n)&&n!==s&&c(a,n,{get:()=>t[n],enumerable:!(i=G(t,n))||i.enumerable});return a};var E=a=>C(c({},"__esModule",{value:!0}),a);var k={};f(k,{GoToDashboardDeviceAction:()=>I});module.exports=E(k);var p=require("purify-ts"),r=require("xstate"),u=require("../../../command/model/CommandResult"),D=require("../../../command/os/CloseAppCommand"),l=require("../../../command/os/GetAppAndVersionCommand"),S=require("../../../device-action/model/UserInteractionRequired"),A=require("../../../device-action/os/Const"),m=require("../../../device-action/os/Errors"),h=require("../../../device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),v=require("../../../device-action/xstate-utils/XStateDeviceAction"),y=require("../../../device-session/DeviceSessionState");class I extends v.XStateDeviceAction{makeStateMachine(t){const{getDeviceSessionState:s,setDeviceSessionState:i,closeApp:n,getAppAndVersion:g}=this.extractDependencies(t),d=this.input.unlockTimeout??A.DEFAULT_UNLOCK_TIMEOUT_MS,T=new h.GetDeviceStatusDeviceAction({input:{unlockTimeout:d}}).makeStateMachine(t);return(0,r.setup)({types:{input:{unlockTimeout:d},context:{},output:{}},actors:{getAppAndVersion:(0,r.fromPromise)(g),closeApp:(0,r.fromPromise)(n),getDeviceStatus:T},guards:{hasError:({context:e})=>e._internalState.error!==null,isDashboardOpen:({context:e})=>e._internalState.currentApp==="BOLOS"},actions:{assignErrorFromEvent:(0,r.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"GoToDashboardDeviceAction",initial:"DeviceReady",context:e=>{const o=s();return{input:{unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:S.UserInteractionRequired.None},_internalState:{currentApp:"currentApp"in o?o.currentApp.name:null,error:null}}},states:{DeviceReady:{always:{target:"GetDeviceStatus"}},GetDeviceStatus:{invoke:{id:"deviceStatus",src:"getDeviceStatus",input:e=>({unlockTimeout:e.context.input.unlockTimeout}),onSnapshot:{actions:(0,r.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{target:"CheckDeviceStatus",actions:(0,r.assign)({_internalState:e=>e.event.output.caseOf({Right:o=>({...e.context._internalState,currentApp:o.currentApp}),Left:o=>({...e.context._internalState,error:o})})})}}},CheckDeviceStatus:{always:[{target:"Error",guard:"hasError"},{target:"DashboardCheck"}]},DashboardCheck:{always:[{target:"Success",guard:"isDashboardOpen"},{target:"Error",guard:"hasError"},{target:"Error",guard:e=>e.context._internalState.currentApp===null,actions:(0,r.assign)({_internalState:e=>({...e.context._internalState,error:new m.UnknownDAError("currentApp === null")})})},{target:"CloseApp"}]},CloseApp:{invoke:{src:"closeApp",onDone:{target:"CloseAppCheck",actions:(0,r.assign)({_internalState:e=>(0,u.isSuccessCommandResult)(e.event.output)?e.context._internalState:{...e.context._internalState,error:e.event.output.error}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},CloseAppCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetAppAndVersion",reenter:!0}]},GetAppAndVersion:{invoke:{src:"getAppAndVersion",onDone:{target:"DashboardCheck",actions:(0,r.assign)({_internalState:e=>{if((0,u.isSuccessCommandResult)(e.event.output)){const o=s();return o.sessionStateType!==y.DeviceSessionStateType.Connected&&i({...o,currentApp:e.event.output.data}),{...e.context._internalState,currentApp:e.event.output.data.name}}return{...e.context._internalState,error:e.event.output.error}}})}}},Success:{type:"final"},Error:{type:"final"}},output:e=>e.context._internalState.error?(0,p.Left)(e.context._internalState.error):(0,p.Right)(void 0)})}extractDependencies(t){return{closeApp:async()=>t.sendCommand(new D.CloseAppCommand),getAppAndVersion:async()=>t.sendCommand(new l.GetAppAndVersionCommand),getDeviceSessionState:()=>t.getDeviceSessionState(),setDeviceSessionState:n=>t.setDeviceSessionState(n)}}}0&&(module.exports={GoToDashboardDeviceAction});
|
2
|
+
//# sourceMappingURL=GoToDashboardDeviceAction.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.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 GetAppAndVersionCommand,\n type GetAppAndVersionCommandResult,\n} from \"@api/command/os/GetAppAndVersionCommand\";\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 { UnknownDAError } 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 type {\n GoToDashboardDAError,\n GoToDashboardDAInput,\n GoToDashboardDAIntermediateValue,\n GoToDashboardDAOutput,\n} from \"./types\";\n\ntype GoToDashboardMachineInternalState = {\n readonly currentApp: string | null;\n readonly error: GoToDashboardDAError | null;\n};\n\nexport type MachineDependencies = {\n readonly getAppAndVersion: () => Promise<GetAppAndVersionCommandResult>;\n readonly closeApp: () => Promise<CloseAppCommandResult>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n};\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class GoToDashboardDeviceAction extends XStateDeviceAction<\n GoToDashboardDAOutput,\n GoToDashboardDAInput,\n GoToDashboardDAError,\n GoToDashboardDAIntermediateValue,\n GoToDashboardMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GoToDashboardDAOutput,\n GoToDashboardDAInput,\n GoToDashboardDAError,\n GoToDashboardDAIntermediateValue,\n GoToDashboardMachineInternalState\n > {\n type types = StateMachineTypes<\n GoToDashboardDAOutput,\n GoToDashboardDAInput,\n GoToDashboardDAError,\n GoToDashboardDAIntermediateValue,\n GoToDashboardMachineInternalState\n >;\n\n const {\n getDeviceSessionState,\n setDeviceSessionState,\n closeApp,\n getAppAndVersion,\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 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 getAppAndVersion: fromPromise(getAppAndVersion),\n closeApp: fromPromise(closeApp),\n getDeviceStatus: getDeviceStatusMachine,\n },\n guards: {\n hasError: ({ context }: { context: types[\"context\"] }) => {\n return context._internalState.error !== null;\n },\n isDashboardOpen: ({ context }: { context: types[\"context\"] }) =>\n context._internalState.currentApp === \"BOLOS\",\n },\n actions: {\n // assignGetDeviceStatusUnknownError: assign({\n // _internalState: (_) => ({\n // ..._.context._internalState,\n // error: new UnknownDAError(\"GetDeviceUnknownStatusError\"),\n // }),\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 N4IgpgJg5mDOIC5QHED2AVVARAhrAFgEao4BOEWYAbgJYDGYAgnQC42oB2AdJbQwEpgcEAJ4BiANoAGALqJQAB1SwabTvJAAPRAHYAjFwDMATikA2MwA5DOnQBYArGeOGANCBGI9VrlcvmpRyknQwcAXzD3NExcAmIyCmp6JlZ2bmQwFl5kgGUWHBYAV1gxCE4wLhoOKlQAawqIJIY8guLpOSQQJRU1Dg1tBAAmOy49QYcpHQdBvR0pMcszO3dPBEM7My4HYz1pqWNLPRsdJYiojGw8IhJybIZmXq4AYXwwOlq7sBaikvaNbtUaX6iDsgy2g3Wdksjn8JlBDhWiAchk2OkMgysB2RzlBZxA0UucRuiT4KUeLzeHyaX3yP0keg6imUgPUnQGgxmo3hdkcemMwwcG0RCGxXDRGMsWJRxlxkXxF1i1wSnweaR4V3i5Ap70ksn+zN6wIQfMsYsG0LMg2MZlm60mwucDi4HMli0GgX0zjxBMVmpJyVVnHVRIS2tq9MZXQNQLZII5XEcoQx5kO3mWHkQjud5oOlo93mM3oVGu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: (_) => {\n const sessionState = getDeviceSessionState();\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n currentApp:\n \"currentApp\" in sessionState\n ? sessionState.currentApp.name\n : null,\n error: null,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"GetDeviceStatus\",\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<GoToDashboardMachineInternalState>(\n {\n Right: (output) => ({\n ..._.context._internalState,\n currentApp: output.currentApp,\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: \"DashboardCheck\",\n },\n ],\n },\n DashboardCheck: {\n // We check if the dashboard is open\n always: [\n {\n target: \"Success\",\n guard: \"isDashboardOpen\",\n },\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"Error\",\n guard: (_) => {\n return _.context._internalState.currentApp === null;\n },\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new UnknownDAError(\"currentApp === null\"),\n }),\n }),\n },\n {\n target: \"CloseApp\",\n },\n ],\n },\n CloseApp: {\n invoke: {\n src: \"closeApp\",\n onDone: {\n target: \"CloseAppCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return _.context._internalState;\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 CloseAppCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"GetAppAndVersion\",\n reenter: true,\n },\n ],\n },\n GetAppAndVersion: {\n invoke: {\n src: \"getAppAndVersion\",\n onDone: {\n target: \"DashboardCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n const state: DeviceSessionState = getDeviceSessionState();\n // Narrow the type to ReadyWithoutSecureChannelState or ReadyWithSecureChannelState\n if (\n state.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n setDeviceSessionState({\n ...state,\n currentApp: _.event.output.data,\n });\n }\n return {\n ..._.context._internalState,\n currentApp: _.event.output.data.name,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\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(undefined);\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const closeApp = async () => internalApi.sendCommand(new CloseAppCommand());\n const getAppAndVersion = async () =>\n internalApi.sendCommand(new GetAppAndVersionCommand());\n\n return {\n closeApp,\n getAppAndVersion,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,qBAC5BC,EAA2C,kBAE3CC,EAAuC,4CACvCC,EAGO,2CACPC,EAGO,mDAEPC,EAAwC,4DACxCC,EAA0C,uCAC1CC,EAA+B,w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AAM,MAAM,EAAG,CAC1C,MAAMI,EAA4BX,EAAsB,EAExD,OACEW,EAAM,mBACN,yBAAuB,WAEvBV,EAAsB,CACpB,GAAGU,EACH,WAAYJ,EAAE,MAAM,OAAO,IAC7B,CAAC,EAEI,CACL,GAAGA,EAAE,QAAQ,eACb,WAAYA,EAAE,MAAM,OAAO,KAAK,IAClC,CACF,CACA,MAAO,CACL,GAAGA,EAAE,QAAQ,eACb,MAAOA,EAAE,MAAM,OAAO,KACxB,CACF,CACF,CAAC,CACH,CACF,CACF,EACA,QAAS,CACP,KAAM,OACR,EACA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAASA,GACHA,EAAE,QAAQ,eAAe,SACpB,QAAKA,EAAE,QAAQ,eAAe,KAAK,KAGrC,SAAM,MAAS,CAE1B,CAAC,CACH,CAEA,oBAAoBR,EAA+C,CAKjE,MAAO,CACL,SALe,SAAYA,EAAY,YAAY,IAAI,iBAAiB,EAMxE,iBALuB,SACvBA,EAAY,YAAY,IAAI,yBAAyB,EAKrD,sBAAuB,IAAMA,EAAY,sBAAsB,EAC/D,sBAAwBY,GACtBZ,EAAY,sBAAsBY,CAAK,CAC3C,CACF,CACF",
|
6
|
+
"names": ["GoToDashboardDeviceAction_exports", "__export", "GoToDashboardDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandResult", "import_CloseAppCommand", "import_GetAppAndVersionCommand", "import_UserInteractionRequired", "import_Const", "import_Errors", "import_GetDeviceStatusDeviceAction", "import_XStateDeviceAction", "import_DeviceSessionState", "internalApi", "getDeviceSessionState", "setDeviceSessionState", "closeApp", "getAppAndVersion", "unlockTimeout", "getDeviceStatusMachine", "context", "_", "sessionState", "output", "error", "state"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var i=require("../../../command/model/CommandResult"),v=require("../../../command/utils/GlobalCommandError"),s=require("../../../device/DeviceStatus"),a=require("../../../device-action/__test-utils__/makeInternalApi"),c=require("../../../device-action/__test-utils__/setupTestMachine"),u=require("../../../device-action/__test-utils__/testDeviceActionStates"),e=require("../../../device-action/model/DeviceActionState"),t=require("../../../device-action/model/UserInteractionRequired"),S=require("../../../device-action/os/Errors"),d=require("../../../device-session/DeviceSessionState"),h=require("../../../../../src"),p=require("./GoToDashboardDeviceAction");jest.mock("@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction");describe("GoToDashboardDeviceAction",()=>{const m=jest.fn(),D=jest.fn(),l=jest.fn(),k=jest.fn();function A(){return{closeApp:m,getAppAndVersion:D,getDeviceSessionState:l,setDeviceSessionState:k}}const{sendCommand:T,getDeviceSessionState:V}=(0,a.makeDeviceActionInternalApiMock)();beforeEach(()=>{jest.resetAllMocks()}),describe("without overriding `extractDependencies`",()=>{it("should run the device action with device already on dashboard",o=>{(0,c.setupGetDeviceStatusMock)();const n=new p.GoToDashboardDeviceAction({input:{unlockTimeout:500}});V.mockReturnValue({sessionStateType:d.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:s.DeviceStatus.CONNECTED,currentApp:{name:"BOLOS",version:"1.5.0"},installedApps:[]});const r=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{output:void 0,status:e.DeviceActionStatus.Completed}];(0,u.testDeviceActionStates)(n,r,(0,a.makeDeviceActionInternalApiMock)(),o)}),it("should run the device action with device not on dashboard",o=>{(0,c.setupGetDeviceStatusMock)([{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]);const n=new p.GoToDashboardDeviceAction({input:{unlockTimeout:500}});V.mockReturnValue({sessionStateType:d.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:s.DeviceStatus.CONNECTED,currentApp:{name:"Bitcoin",version:"1.0.0"},installedApps:[]}),T.mockResolvedValueOnce((0,i.CommandResultFactory)({data:void 0})).mockResolvedValueOnce((0,i.CommandResultFactory)({data:{name:"BOLOS",version:"1.5.0"}}));const r=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{output:void 0,status:e.DeviceActionStatus.Completed}];(0,u.testDeviceActionStates)(n,r,(0,a.makeDeviceActionInternalApiMock)(),o)})}),describe("success cases",()=>{it("should success if the device is already on dashboard",o=>{(0,c.setupGetDeviceStatusMock)();const n=new p.GoToDashboardDeviceAction({input:{unlockTimeout:500}});l.mockReturnValue({sessionStateType:d.DeviceSessionStateType.Connected,deviceStatus:s.DeviceStatus.CONNECTED,currentApp:{name:"BOLOS",version:"1.5.0"}}),D.mockReturnValue({app:"BOLOS",version:"1.5.0"}),jest.spyOn(n,"extractDependencies").mockReturnValue(A());const r=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{output:void 0,status:e.DeviceActionStatus.Completed}];(0,u.testDeviceActionStates)(n,r,(0,a.makeDeviceActionInternalApiMock)(),o)}),it("should success if the device is not on dashboard",o=>{(0,c.setupGetDeviceStatusMock)();const n=new p.GoToDashboardDeviceAction({input:{unlockTimeout:500}});jest.spyOn(n,"extractDependencies").mockReturnValue(A()),l.mockReturnValue({sessionStateType:d.DeviceSessionStateType.Connected,deviceStatus:s.DeviceStatus.CONNECTED}),m.mockResolvedValue((0,i.CommandResultFactory)({data:void 0})),D.mockReturnValue((0,i.CommandResultFactory)({data:{name:"BOLOS",version:"1.5.0"}}));const r=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{output:void 0,status:e.DeviceActionStatus.Completed}];(0,u.testDeviceActionStates)(n,r,(0,a.makeDeviceActionInternalApiMock)(),o)})}),describe("error cases",()=>{it("should return an error if GetDeviceStatus return an error",o=>{(0,c.setupGetDeviceStatusMock)([new S.UnknownDAError("Unknown error")]);const n=new p.GoToDashboardDeviceAction({input:{unlockTimeout:500}});V.mockReturnValue({sessionStateType:d.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:s.DeviceStatus.CONNECTED,currentApp:{name:"BOLOS",version:"1.5.0"},installedApps:[]});const r=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{status:e.DeviceActionStatus.Error,error:new S.UnknownDAError("Unknown error")}];(0,u.testDeviceActionStates)(n,r,(0,a.makeDeviceActionInternalApiMock)(),o)}),describe("not on dashboard",()=>{it("should return an error if closeApp fails",o=>{(0,c.setupGetDeviceStatusMock)([{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]);const n=new p.GoToDashboardDeviceAction({input:{}});jest.spyOn(n,"extractDependencies").mockReturnValue(A()),l.mockReturnValue({sessionStateType:d.DeviceSessionStateType.Connected,deviceStatus:s.DeviceStatus.CONNECTED,currentApp:"Bitcoin"}),m.mockReturnValue((0,i.CommandResultFactory)({error:new h.UnknownDeviceExchangeError("Close app failed")}));const r=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{status:e.DeviceActionStatus.Error,error:new h.UnknownDeviceExchangeError("Close app failed")}];(0,u.testDeviceActionStates)(n,r,(0,a.makeDeviceActionInternalApiMock)(),o)}),it("should return an error if getAppAndVersion fails",o=>{(0,c.setupGetDeviceStatusMock)([{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]);const n=new p.GoToDashboardDeviceAction({input:{unlockTimeout:500}}),r=new v.GlobalCommandError({...v.GLOBAL_ERRORS[5501],errorCode:"5501"});jest.spyOn(n,"extractDependencies").mockReturnValue(A()),l.mockReturnValue({sessionStateType:d.DeviceSessionStateType.Connected,deviceStatus:s.DeviceStatus.CONNECTED,currentApp:"Bitcoin"}),m.mockResolvedValue((0,i.CommandResultFactory)({data:void 0})),D.mockResolvedValue((0,i.CommandResultFactory)({error:r}));const g=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{status:e.DeviceActionStatus.Error,error:r}];(0,u.testDeviceActionStates)(n,g,(0,a.makeDeviceActionInternalApiMock)(),o)}),it("should return an error if getAppAndVersion does not return an app name",o=>{(0,c.setupGetDeviceStatusMock)([{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]);const n=new p.GoToDashboardDeviceAction({input:{unlockTimeout:500}});jest.spyOn(n,"extractDependencies").mockReturnValue(A()),l.mockReturnValue({sessionStateType:d.DeviceSessionStateType.Connected,deviceStatus:s.DeviceStatus.CONNECTED,currentApp:"Bitcoin"}),m.mockResolvedValue((0,i.CommandResultFactory)({data:void 0})),D.mockResolvedValue((0,i.CommandResultFactory)({data:{name:null,version:"1.0.0"}}));const r=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{status:e.DeviceActionStatus.Error,error:new S.UnknownDAError("currentApp === null")}];(0,u.testDeviceActionStates)(n,r,(0,a.makeDeviceActionInternalApiMock)(),o)})})})});
|
2
|
+
//# sourceMappingURL=GoToDashboardDeviceAction.test.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.ts"],
|
4
|
+
"sourcesContent": ["import { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport {\n GLOBAL_ERRORS,\n GlobalCommandError,\n} from \"@api/command/utils/GlobalCommandError\";\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 { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport { UnknownDeviceExchangeError } from \"@root/src\";\n\nimport { GoToDashboardDeviceAction } from \"./GoToDashboardDeviceAction\";\nimport { type GoToDashboardDAState } from \"./types\";\n\njest.mock(\"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\");\n\ndescribe(\"GoToDashboardDeviceAction\", () => {\n const closeAppMock = jest.fn();\n const getAppAndVersionMock = jest.fn();\n const getDeviceSessionStateMock = jest.fn();\n const setDeviceSessionStateMock = jest.fn();\n\n function extractDependenciesMock() {\n return {\n closeApp: closeAppMock,\n getAppAndVersion: getAppAndVersionMock,\n getDeviceSessionState: getDeviceSessionStateMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n };\n }\n\n const {\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n } = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n describe(\"without overriding `extractDependencies`\", () => {\n it(\"should run the device action with device already on dashboard\", (done) => {\n setupGetDeviceStatusMock();\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"1.5.0\" },\n installedApps: [],\n });\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GetDeviceStatus events (mocked for tests)\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: undefined,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should run the device action with device not on dashboard\", (done) => {\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"Bitcoin\", version: \"1.0.0\" },\n installedApps: [],\n });\n\n sendCommandMock\n .mockResolvedValueOnce(CommandResultFactory({ data: undefined }))\n .mockResolvedValueOnce(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.5.0\",\n },\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: undefined,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"success cases\", () => {\n it(\"should success if the device is already on dashboard\", (done) => {\n setupGetDeviceStatusMock();\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"1.5.0\" },\n });\n\n getAppAndVersionMock.mockReturnValue({\n app: \"BOLOS\",\n version: \"1.5.0\",\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: undefined,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should success if the device is not on dashboard\", (done) => {\n setupGetDeviceStatusMock();\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n });\n\n closeAppMock.mockResolvedValue(CommandResultFactory({ data: undefined }));\n getAppAndVersionMock.mockReturnValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.5.0\",\n },\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: undefined,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"error cases\", () => {\n it(\"should return an error if GetDeviceStatus return an error\", (done) => {\n setupGetDeviceStatusMock([new UnknownDAError(\"Unknown error\")]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"1.5.0\" },\n installedApps: [],\n });\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Unknown error\"),\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n describe(\"not on dashboard\", () => {\n it(\"should return an error if closeApp fails\", (done) => {\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: {},\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: \"Bitcoin\",\n });\n\n closeAppMock.mockReturnValue(\n CommandResultFactory({\n error: new UnknownDeviceExchangeError(\"Close app failed\"),\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDeviceExchangeError(\"Close app failed\"),\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should return an error if getAppAndVersion fails\", (done) => {\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n const error = new GlobalCommandError({\n ...GLOBAL_ERRORS[\"5501\"],\n errorCode: \"5501\",\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: \"Bitcoin\",\n });\n\n closeAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n error,\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Error,\n error,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should return an error if getAppAndVersion does not return an app name\", (done) => {\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: \"Bitcoin\",\n });\n\n closeAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: null,\n version: \"1.0.0\",\n },\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"currentApp === null\"),\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n });\n});\n"],
|
5
|
+
"mappings": "aAAA,IAAAA,EAAqC,4CACrCC,EAGO,iDACPC,EAA6B,oCAC7BC,EAAgD,6DAChDC,EAAyC,8DACzCC,EAAuC,oEACvCC,EAAmC,sDACnCC,EAAwC,4DACxCC,EAA+B,wCAC/BC,EAAuC,kDACvCC,EAA2C,qBAE3CC,EAA0C,uCAG1C,KAAK,KAAK,mEAAmE,EAE7E,SAAS,4BAA6B,IAAM,CAC1C,MAAMC,EAAe,KAAK,GAAG,EACvBC,EAAuB,KAAK,GAAG,EAC/BC,EAA4B,KAAK,GAAG,EACpCC,EAA4B,KAAK,GAAG,EAE1C,SAASC,GAA0B,CACjC,MAAO,CACL,SAAUJ,EACV,iBAAkBC,EAClB,sBAAuBC,EACvB,sBAAuBC,CACzB,CACF,CAEA,KAAM,CACJ,YAAaE,EACb,sBAAuBC,CACzB,KAAI,mCAAgC,EAEpC,WAAW,IAAM,CACf,KAAK,cAAc,CACrB,CAAC,EAED,SAAS,2CAA4C,IAAM,CACzD,GAAG,gEAAkEC,GAAS,IAC5E,4BAAyB,EAEzB,MAAMC,EAA4B,IAAI,4BAA0B,CAC9D,MAAO,CAAE,cAAe,GAAI,CAC9B,CAAC,EAEDF,EAA6B,gBAAgB,CAC3C,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,WAAY,CAAE,KAAM,QAAS,QAAS,OAAQ,E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,CACE,WAAY,UACZ,kBAAmB,OACrB,CACF,CAAC,EAED,MAAMC,EAA4B,IAAI,4BAA0B,CAC9D,MAAO,CAAE,cAAe,GAAI,CAC9B,CAAC,EAED,KACG,MAAMA,EAA2B,qBAAqB,EACtD,gBAAgBJ,EAAwB,CAAC,EAE5CF,EAA0B,gBAAgB,CACxC,iBAAkB,yBAAuB,UACzC,aAAc,eAAa,UAC3B,WAAY,SACd,CAAC,EAEDF,EAAa,qBACX,wBAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,EACAC,EAAqB,qBACnB,wBAAqB,CACnB,KAAM,CACJ,KAAM,KACN,QAAS,OACX,CACF,CAAC,CACH,EAEA,MAAMQ,EAA8C,CAClD,CACE,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,EACA,OAAQ,qBAAmB,OAC7B,EACA,CACE,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,EACA,OAAQ,qBAAmB,OAC7B,EACA,CACE,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,EACA,OAAQ,qBAAmB,OAC7B,EACA,CACE,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,EACA,OAAQ,qBAAmB,OAC7B,EACA,CACE,OAAQ,qBAAmB,MAC3B,MAAO,IAAI,iBAAe,qBAAqB,CACjD,CACF,KAEA,0BACED,EACAC,KACA,mCAAgC,EAChCF,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
|
6
|
+
"names": ["import_CommandResult", "import_GlobalCommandError", "import_DeviceStatus", "import_makeInternalApi", "import_setupTestMachine", "import_testDeviceActionStates", "import_DeviceActionState", "import_UserInteractionRequired", "import_Errors", "import_DeviceSessionState", "import_src", "import_GoToDashboardDeviceAction", "closeAppMock", "getAppAndVersionMock", "getDeviceSessionStateMock", "setDeviceSessionStateMock", "extractDependenciesMock", "sendCommandMock", "apiGetDeviceSessionStateMock", "done", "goToDashboardDeviceAction", "expectedStates", "error"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var a=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var u=(t,e,D,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of n(e))!p.call(t,r)&&r!==D&&a(t,r,{get:()=>e[r],enumerable:!(o=i(e,r))||o.enumerable});return t};var d=t=>u(a({},"__esModule",{value:!0}),t);var s={};module.exports=d(s);
|
2
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../src/api/device-action/os/GoToDashboard/types.ts"],
|
4
|
+
"sourcesContent": ["import { type CommandErrorResult } from \"@api/command/model/CommandResult\";\nimport { type DeviceActionState } from \"@api/device-action/model/DeviceActionState\";\nimport { type UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { type UnknownDAError } from \"@api/device-action/os/Errors\";\nimport {\n type GetDeviceStatusDAError,\n type GetDeviceStatusDAInput,\n type GetDeviceStatusDAIntermediateValue,\n} from \"@api/device-action/os/GetDeviceStatus/types\";\n\nexport type GoToDashboardDAOutput = void;\nexport type GoToDashboardDAInput = GetDeviceStatusDAInput;\n\nexport type GoToDashboardDAError =\n | GetDeviceStatusDAError\n | UnknownDAError\n | CommandErrorResult[\"error\"];\n\nexport type GoToDashboardDARequiredInteraction = UserInteractionRequired.None;\n\nexport type GoToDashboardDAIntermediateValue =\n | GetDeviceStatusDAIntermediateValue\n | {\n readonly requiredUserInteraction: GoToDashboardDARequiredInteraction;\n };\n\nexport type GoToDashboardDAState = DeviceActionState<\n GoToDashboardDAOutput,\n GoToDashboardDAError,\n GoToDashboardDAIntermediateValue\n>;\n"],
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
6
|
+
"names": ["types_exports", "__toCommonJS"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var u=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var S=(o,e)=>{for(var a in e)u(o,a,{get:e[a],enumerable:!0})},g=(o,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of L(e))!y.call(o,r)&&r!==a&&u(o,r,{get:()=>e[r],enumerable:!(s=D(e,r))||s.enumerable});return o};var x=o=>g(u({},"__esModule",{value:!0}),o);var v={};S(v,{ListAppsDeviceAction:()=>E});module.exports=x(v);var p=require("purify-ts"),n=require("xstate"),c=require("../../../command/model/CommandResult"),l=require("../../../command/os/ListAppsCommand"),i=require("../../../device-action/model/UserInteractionRequired"),A=require("../../../device-action/os/Const"),m=require("../../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),d=require("../../../device-action/xstate-utils/XStateDeviceAction");class E extends d.XStateDeviceAction{makeStateMachine(e){const{listApps:a}=this.extractDependencies(e),s=this.input.unlockTimeout??A.DEFAULT_UNLOCK_TIMEOUT_MS,r=new m.GoToDashboardDeviceAction({input:{unlockTimeout:s}}).makeStateMachine(e);return(0,n.setup)({types:{input:{unlockTimeout:s},context:{},output:{}},actors:{listApps:(0,n.fromPromise)(a),goToDashboard:r},guards:{hasError:({context:t})=>t._internalState.error!==null,hasMoreApps:t=>t.context._internalState.shouldContinue},actions:{assignAllowListApps:(0,n.assign)({intermediateValue:t=>({requiredUserInteraction:i.UserInteractionRequired.AllowListApps})}),assignErrorFromEvent:(0,n.assign)({_internalState:t=>({...t.context._internalState,error:t.event.error})})}}).createMachine({id:"ListAppsDeviceAction",initial:"DeviceReady",context:t=>({input:{unlockTimeout:t.input.unlockTimeout},intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None},_internalState:{error:null,apps:[],shouldContinue:!1}}),states:{DeviceReady:{always:{target:"GoToDashboard"}},GoToDashboard:{invoke:{id:"dashboard",src:"goToDashboard",input:t=>({unlockTimeout:t.context.input.unlockTimeout}),onSnapshot:{actions:(0,n.assign)({intermediateValue:t=>t.event.snapshot.context.intermediateValue})},onDone:{target:"GoToDashboardCheck",actions:(0,n.assign)({_internalState:t=>t.event.output.caseOf({Right:()=>t.context._internalState,Left:h=>({...t.context._internalState,error:h})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GoToDashboardCheck:{always:[{target:"Error",guard:"hasError"},{target:"ListApps"}]},ListApps:{entry:"assignAllowListApps",invoke:{src:"listApps",input:t=>!1,onDone:{target:"Continue",actions:(0,n.assign)({_internalState:t=>(0,c.isSuccessCommandResult)(t.event.output)?{...t.context._internalState,apps:t.context._internalState.apps.concat(t.event.output.data),shouldContinue:t.event.output.data.length===2}:{...t.context._internalState,error:t.event.output.error},intermediateValue:t=>({...t.context.intermediateValue,requiredUserInteraction:i.UserInteractionRequired.None})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},ListAppsCheck:{always:[{target:"Error",guard:"hasError"},"ListAppsContinue"]},ListAppsContinue:{invoke:{src:"listApps",input:t=>!0,onDone:{target:"Continue",actions:(0,n.assign)({_internalState:t=>(0,c.isSuccessCommandResult)(t.event.output)?{...t.context._internalState,apps:t.context._internalState.apps.concat(t.event.output.data),shouldContinue:t.event.output.data.length===2}:{...t.context._internalState,error:t.event.output.error}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},Continue:{always:[{target:"ListAppsContinue",guard:"hasMoreApps"},{target:"Success"}]},Success:{type:"final"},Error:{type:"final"}},output:t=>t.context._internalState.error?(0,p.Left)(t.context._internalState.error):(0,p.Right)(t.context._internalState.apps)})}extractDependencies(e){return{listApps:async({input:s})=>{const r=new l.ListAppsCommand({isContinue:s});return e.sendCommand(r)}}}}0&&(module.exports={ListAppsDeviceAction});
|
2
|
+
//# sourceMappingURL=ListAppsDeviceAction.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,qBAC5BC,EAA2C,kBAE3CC,EAAuC,4CACvCC,EAIO,2CAEPC,EAAwC,4DACxCC,EAA0C,uCAC1CC,EAA0C,yEAE1CC,EAGO,8DA2BA,MAAMT,UAA6B,oBAMxC,CACA,iBACEU,EAOA,CASA,KAAM,CAAE,SAAAC,CAAS,EAAI,KAAK,oBAAoBD,CAAW,EAEnDE,EAAgB,KAAK,MAAM,eAAiB,4BAE5CC,EAAuB,IAAI,4BAA0B,CACzD,MAAO,CACL,cAAAD,CACF,CACF,CAAC,EAAE,iBAAiBF,CAAW,EAE/B,SAAO,SAAM,CACX,MAAO,CACL,MAAO,CACL,cAAAE,CACF,EACA,QAAS,CAAC,EACV,OAAQ,CAAC,CACX,EACA,OAAQ,CACN,YAAU,eAA4CD,CAAQ,EAC9D,cAAeE,CACjB,EACA,OAAQ,CACN,SA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,MAAAO,CAAM,IAA0B,CACxD,MAAMC,EAAU,IAAI,kBAAgB,CAAE,WAAYD,CAAM,CAAC,EACzD,OAAOP,EAAY,YAAYQ,CAAO,CACxC,CAIA,CACF,CACF",
|
6
|
+
"names": ["ListAppsDeviceAction_exports", "__export", "ListAppsDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandResult", "import_ListAppsCommand", "import_UserInteractionRequired", "import_Const", "import_GoToDashboardDeviceAction", "import_XStateDeviceAction", "internalApi", "listApps", "unlockTimeout", "goToDashboardMachine", "context", "_", "error", "input", "command"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var a=require("../../../command/model/CommandResult"),m=require("../../../command/utils/GlobalCommandError"),t=require("../../../device-action/__test-utils__/data"),o=require("../../../device-action/__test-utils__/makeInternalApi"),d=require("../../../device-action/__test-utils__/setupTestMachine"),u=require("../../../device-action/__test-utils__/testDeviceActionStates"),e=require("../../../device-action/model/DeviceActionState"),n=require("../../../device-action/model/UserInteractionRequired"),p=require("../../../device-action/os/Errors"),c=require("./ListAppsDeviceAction");jest.mock("@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction");describe("ListAppsDeviceAction",()=>{const{sendCommand:l}=(0,o.makeDeviceActionInternalApiMock)();beforeEach(()=>{jest.resetAllMocks()}),describe("success cases",()=>{it("should run the device action with no apps installed",r=>{(0,d.setupGoToDashboardMock)();const s=new c.ListAppsDeviceAction({input:{}});l.mockResolvedValue((0,a.CommandResultFactory)({data:[]}));const i=[{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{output:[],status:e.DeviceActionStatus.Completed}];(0,u.testDeviceActionStates)(s,i,(0,o.makeDeviceActionInternalApiMock)(),r)}),it("should run the device action with one app installed",r=>{(0,d.setupGoToDashboardMock)();const s=new c.ListAppsDeviceAction({input:{unlockTimeout:500}});l.mockResolvedValueOnce((0,a.CommandResultFactory)({data:[t.BTC_APP]}));const i=[{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{output:[t.BTC_APP],status:e.DeviceActionStatus.Completed}];(0,u.testDeviceActionStates)(s,i,(0,o.makeDeviceActionInternalApiMock)(),r)}),it("should run the device action with two app installed",r=>{(0,d.setupGoToDashboardMock)();const s=new c.ListAppsDeviceAction({input:{unlockTimeout:500}});l.mockResolvedValueOnce((0,a.CommandResultFactory)({data:[t.BTC_APP,t.CUSTOM_LOCK_SCREEN_APP]})).mockResolvedValueOnce((0,a.CommandResultFactory)({data:[]}));const i=[{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{output:[t.BTC_APP,t.CUSTOM_LOCK_SCREEN_APP],status:e.DeviceActionStatus.Completed}];(0,u.testDeviceActionStates)(s,i,(0,o.makeDeviceActionInternalApiMock)(),r)}),it("should run the device action with three app installed",r=>{(0,d.setupGoToDashboardMock)();const s=new c.ListAppsDeviceAction({input:{unlockTimeout:500}});l.mockResolvedValueOnce((0,a.CommandResultFactory)({data:[t.BTC_APP,t.CUSTOM_LOCK_SCREEN_APP]})).mockResolvedValueOnce((0,a.CommandResultFactory)({data:[t.ETH_APP]}));const i=[{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{output:[t.BTC_APP,t.CUSTOM_LOCK_SCREEN_APP,t.ETH_APP],status:e.DeviceActionStatus.Completed}];(0,u.testDeviceActionStates)(s,i,(0,o.makeDeviceActionInternalApiMock)(),r)}),it("should run the device action with four app installed",r=>{(0,d.setupGoToDashboardMock)();const s=new c.ListAppsDeviceAction({input:{unlockTimeout:500}});l.mockResolvedValueOnce((0,a.CommandResultFactory)({data:[t.BTC_APP,t.CUSTOM_LOCK_SCREEN_APP]})).mockResolvedValueOnce((0,a.CommandResultFactory)({data:[t.ETH_APP,t.SOLANA_APP]})).mockResolvedValueOnce((0,a.CommandResultFactory)({data:[]}));const i=[{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{output:[t.BTC_APP,t.CUSTOM_LOCK_SCREEN_APP,t.ETH_APP,t.SOLANA_APP],status:e.DeviceActionStatus.Completed}];(0,u.testDeviceActionStates)(s,i,(0,o.makeDeviceActionInternalApiMock)(),r)}),it("should run the device action with five app installed",r=>{(0,d.setupGoToDashboardMock)();const s=new c.ListAppsDeviceAction({input:{unlockTimeout:500}});l.mockResolvedValueOnce((0,a.CommandResultFactory)({data:[t.BTC_APP,t.CUSTOM_LOCK_SCREEN_APP]})).mockResolvedValueOnce((0,a.CommandResultFactory)({data:[t.ETH_APP,t.SOLANA_APP]})).mockResolvedValueOnce((0,a.CommandResultFactory)({data:[t.DOGECOIN_APP]}));const i=[{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{output:[t.BTC_APP,t.CUSTOM_LOCK_SCREEN_APP,t.ETH_APP,t.SOLANA_APP,t.DOGECOIN_APP],status:e.DeviceActionStatus.Completed}];(0,u.testDeviceActionStates)(s,i,(0,o.makeDeviceActionInternalApiMock)(),r)})}),describe("error cases",()=>{it("should return an error if GoTodashboard fails",r=>{(0,d.setupGoToDashboardMock)(!0);const s=new c.ListAppsDeviceAction({input:{unlockTimeout:500}});l.mockResolvedValue((0,a.CommandResultFactory)({data:[]}));const i=[{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{error:new p.UnknownDAError("GoToDashboard failed"),status:e.DeviceActionStatus.Error}];(0,u.testDeviceActionStates)(s,i,(0,o.makeDeviceActionInternalApiMock)(),r)}),it("should run the device action if GoTodashboard fails",r=>{(0,d.setupGoToDashboardMock)(!0);const s=new c.ListAppsDeviceAction({input:{unlockTimeout:500}});l.mockResolvedValue((0,a.CommandResultFactory)({data:[]}));const i=[{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{error:new p.UnknownDAError("GoToDashboard failed"),status:e.DeviceActionStatus.Error}];(0,u.testDeviceActionStates)(s,i,(0,o.makeDeviceActionInternalApiMock)(),r)}),it("should return an error if ListApps fails",r=>{(0,d.setupGoToDashboardMock)();const s=new c.ListAppsDeviceAction({input:{unlockTimeout:500}}),i=new m.GlobalCommandError({errorCode:"5501",...m.GLOBAL_ERRORS[5501]});l.mockResolvedValue((0,a.CommandResultFactory)({error:i}));const A=[{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{error:i,status:e.DeviceActionStatus.Error}];(0,u.testDeviceActionStates)(s,A,(0,o.makeDeviceActionInternalApiMock)(),r)}),it("should return an error if ListAppsContinue fails",r=>{(0,d.setupGoToDashboardMock)();const s=new c.ListAppsDeviceAction({input:{unlockTimeout:500}});l.mockResolvedValueOnce((0,a.CommandResultFactory)({data:[t.BTC_APP,t.CUSTOM_LOCK_SCREEN_APP]})).mockRejectedValueOnce(new p.UnknownDAError("mocked error"));const i=[{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{error:new p.UnknownDAError("mocked error"),status:e.DeviceActionStatus.Error}];(0,u.testDeviceActionStates)(s,i,(0,o.makeDeviceActionInternalApiMock)(),r)})})});
|
2
|
+
//# sourceMappingURL=ListAppsDeviceAction.test.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../src/api/device-action/os/ListApps/ListAppsDeviceAction.test.ts"],
|
4
|
+
"sourcesContent": ["import { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport { type ListAppsResponse } from \"@api/command/os/ListAppsCommand\";\nimport {\n GLOBAL_ERRORS,\n GlobalCommandError,\n} from \"@api/command/utils/GlobalCommandError\";\nimport {\n BTC_APP,\n CUSTOM_LOCK_SCREEN_APP,\n DOGECOIN_APP,\n ETH_APP,\n SOLANA_APP,\n} from \"@api/device-action/__test-utils__/data\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { setupGoToDashboardMock } 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 { UnknownDAError } from \"@api/device-action/os/Errors\";\n\nimport { ListAppsDeviceAction } from \"./ListAppsDeviceAction\";\nimport { type ListAppsDAState } from \"./types\";\n\njest.mock(\"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\");\n\ndescribe(\"ListAppsDeviceAction\", () => {\n const { sendCommand: sendCommandMock } = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n describe(\"success cases\", () => {\n it(\"should run the device action with no apps installed\", (done) => {\n setupGoToDashboardMock();\n const listAppsDeviceAction = new ListAppsDeviceAction({\n input: {},\n });\n\n sendCommandMock.mockResolvedValue(CommandResultFactory({ data: [] }));\n\n const expectedStates: Array<ListAppsDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n output: [],\n status: DeviceActionStatus.Completed, // Success\n },\n ];\n\n testDeviceActionStates(\n listAppsDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should run the device action with one app installed\", (done) => {\n setupGoToDashboardMock();\n const listAppsDeviceAction = new ListAppsDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n sendCommandMock.mockResolvedValueOnce(\n CommandResultFactory({ data: [BTC_APP] }),\n );\n\n const expectedStates: Array<ListAppsDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n output: [BTC_APP],\n status: DeviceActionStatus.Completed, // Success\n },\n ];\n\n testDeviceActionStates(\n listAppsDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should run the device action with two app installed\", (done) => {\n setupGoToDashboardMock();\n const listAppsDeviceAction = new ListAppsDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n sendCommandMock\n .mockResolvedValueOnce(\n CommandResultFactory({ data: [BTC_APP, CUSTOM_LOCK_SCREEN_APP] }),\n )\n .mockResolvedValueOnce(CommandResultFactory({ data: [] }));\n\n const expectedStates: Array<ListAppsDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // ContinueListApps\n },\n {\n output: [BTC_APP, CUSTOM_LOCK_SCREEN_APP],\n status: DeviceActionStatus.Completed, // Success\n },\n ];\n\n testDeviceActionStates(\n listAppsDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should run the device action with three app installed\", (done) => {\n setupGoToDashboardMock();\n const listAppsDeviceAction = new ListAppsDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n sendCommandMock\n .mockResolvedValueOnce(\n CommandResultFactory({ data: [BTC_APP, CUSTOM_LOCK_SCREEN_APP] }),\n )\n .mockResolvedValueOnce(CommandResultFactory({ data: [ETH_APP] }));\n\n const expectedStates: Array<ListAppsDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // ContinueListApps\n },\n {\n output: [BTC_APP, CUSTOM_LOCK_SCREEN_APP, ETH_APP],\n status: DeviceActionStatus.Completed, // Success\n },\n ];\n\n testDeviceActionStates(\n listAppsDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should run the device action with four app installed\", (done) => {\n setupGoToDashboardMock();\n const listAppsDeviceAction = new ListAppsDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n sendCommandMock\n .mockResolvedValueOnce(\n CommandResultFactory({ data: [BTC_APP, CUSTOM_LOCK_SCREEN_APP] }),\n )\n .mockResolvedValueOnce(\n CommandResultFactory({ data: [ETH_APP, SOLANA_APP] }),\n )\n .mockResolvedValueOnce(CommandResultFactory({ data: [] }));\n\n const expectedStates: Array<ListAppsDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // ContinueListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // ContinueListApps\n },\n {\n output: [BTC_APP, CUSTOM_LOCK_SCREEN_APP, ETH_APP, SOLANA_APP],\n status: DeviceActionStatus.Completed, // Success\n },\n ];\n\n testDeviceActionStates(\n listAppsDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should run the device action with five app installed\", (done) => {\n setupGoToDashboardMock();\n const listAppsDeviceAction = new ListAppsDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n sendCommandMock\n .mockResolvedValueOnce(\n CommandResultFactory({ data: [BTC_APP, CUSTOM_LOCK_SCREEN_APP] }),\n )\n .mockResolvedValueOnce(\n CommandResultFactory({ data: [ETH_APP, SOLANA_APP] }),\n )\n .mockResolvedValueOnce(CommandResultFactory({ data: [DOGECOIN_APP] }));\n const expectedStates: Array<ListAppsDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // ContinueListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // ContinueListApps\n },\n {\n output: [\n BTC_APP,\n CUSTOM_LOCK_SCREEN_APP,\n ETH_APP,\n SOLANA_APP,\n DOGECOIN_APP,\n ] as ListAppsResponse,\n status: DeviceActionStatus.Completed, // Success\n },\n ];\n\n testDeviceActionStates(\n listAppsDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"error cases\", () => {\n it(\"should return an error if GoTodashboard fails\", (done) => {\n setupGoToDashboardMock(true);\n const listAppsDeviceAction = new ListAppsDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n sendCommandMock.mockResolvedValue(CommandResultFactory({ data: [] }));\n\n const expectedStates: Array<ListAppsDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n error: new UnknownDAError(\"GoToDashboard failed\"),\n status: DeviceActionStatus.Error, // Error\n },\n ];\n\n testDeviceActionStates(\n listAppsDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should run the device action if GoTodashboard fails\", (done) => {\n setupGoToDashboardMock(true);\n const listAppsDeviceAction = new ListAppsDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n sendCommandMock.mockResolvedValue(CommandResultFactory({ data: [] }));\n\n const expectedStates: Array<ListAppsDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n error: new UnknownDAError(\"GoToDashboard failed\"),\n status: DeviceActionStatus.Error, // Error\n },\n ];\n\n testDeviceActionStates(\n listAppsDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should return an error if ListApps fails\", (done) => {\n setupGoToDashboardMock();\n const listAppsDeviceAction = new ListAppsDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n const globalError = new GlobalCommandError({\n errorCode: \"5501\",\n ...GLOBAL_ERRORS[\"5501\"],\n });\n\n sendCommandMock.mockResolvedValue(\n CommandResultFactory({\n error: globalError,\n }),\n );\n\n const expectedStates: Array<ListAppsDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n error: globalError,\n status: DeviceActionStatus.Error, // Error\n },\n ];\n\n testDeviceActionStates(\n listAppsDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should return an error if ListAppsContinue fails\", (done) => {\n setupGoToDashboardMock();\n const listAppsDeviceAction = new ListAppsDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n sendCommandMock\n .mockResolvedValueOnce(\n CommandResultFactory({ data: [BTC_APP, CUSTOM_LOCK_SCREEN_APP] }),\n )\n .mockRejectedValueOnce(new UnknownDAError(\"mocked error\"));\n\n const expectedStates: Array<ListAppsDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // ContinueListApps\n },\n {\n error: new UnknownDAError(\"mocked error\"),\n status: DeviceActionStatus.Error, // Success\n },\n ];\n\n testDeviceActionStates(\n listAppsDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n});\n"],
|
5
|
+
"mappings": "aAAA,IAAAA,EAAqC,4CAErCC,EAGO,iDACPC,EAMO,kDACPC,EAAgD,6DAChDC,EAAuC,8DACvCC,EAAuC,oEACvCC,EAAmC,sDACnCC,EAAwC,4DACxCC,EAA+B,wCAE/BC,EAAqC,kCAGrC,KAAK,KAAK,+DAA+D,EAEzE,SAAS,uBAAwB,IAAM,CACrC,KAAM,CAAE,YAAaC,CAAgB,KAAI,mCAAgC,EAEzE,WAAW,IAAM,CACf,KAAK,cAAc,CACrB,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,sDAAwDC,GAAS,IAClE,0BAAuB,EACvB,MAAMC,EAAuB,IAAI,uBAAqB,CACpD,MAAO,CAAC,CACV,CAAC,EAEDF,EAAgB,qBAAkB,wBAAqB,CAAE,KAAM,CAAC,CAAE,CAAC,CAAC,EAEpE,MAAMG,EAAyC,CAC7C,CACE,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,EACA,OAAQ,qBAAmB,OAC7B,EACA,CACE,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,EACA,OAAQ,qBAAmB,OAC7B,EACA,CACE,kBAAmB,CACjB,wBAAyB,0BAAwB,aACnD,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names": ["import_CommandResult", "import_GlobalCommandError", "import_data", "import_makeInternalApi", "import_setupTestMachine", "import_testDeviceActionStates", "import_DeviceActionState", "import_UserInteractionRequired", "import_Errors", "import_ListAppsDeviceAction", "sendCommandMock", "done", "listAppsDeviceAction", "expectedStates", "globalError"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var p=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var a=(t,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of A(r))!n.call(t,e)&&e!==s&&p(t,e,{get:()=>r[e],enumerable:!(o=i(r,e))||o.enumerable});return t};var D=t=>a(p({},"__esModule",{value:!0}),t);var d={};module.exports=D(d);
|
2
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../src/api/device-action/os/ListApps/types.ts"],
|
4
|
+
"sourcesContent": ["import { type CommandErrorResult } from \"@api/command/model/CommandResult\";\nimport {\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nimport { type DeviceActionState } from \"@api/device-action/model/DeviceActionState\";\nimport { type UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { type UnknownDAError } from \"@api/device-action/os/Errors\";\nimport {\n type GoToDashboardDAError,\n type GoToDashboardDAInput,\n type GoToDashboardDAIntermediateValue,\n} from \"@api/device-action/os/GoToDashboard/types\";\n\nexport type ListAppsDAOutput = ListAppsResponse;\nexport type ListAppsDAInput = GoToDashboardDAInput;\n\nexport type ListAppsDAError =\n | GoToDashboardDAError\n | UnknownDAError\n | CommandErrorResult<ListAppsErrorCodes>[\"error\"];\n\nexport type ListAppsDARequiredInteraction =\n | UserInteractionRequired.None\n | UserInteractionRequired.AllowListApps;\n\nexport type ListAppsDAIntermediateValue =\n | GoToDashboardDAIntermediateValue\n | {\n readonly requiredUserInteraction: ListAppsDARequiredInteraction;\n };\n\nexport type ListAppsDAState = DeviceActionState<\n ListAppsDAOutput,\n ListAppsDAError,\n ListAppsDAIntermediateValue\n>;\n"],
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
6
|
+
"names": ["types_exports", "__toCommonJS"]
|
7
|
+
}
|
package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js
ADDED
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var A=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var W=(n,e)=>{for(var i in e)A(n,i,{get:e[i],enumerable:!0})},E=(n,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of L(e))!g.call(n,p)&&p!==i&&A(n,p,{get:()=>e[p],enumerable:!(r=v(e,p))||r.enumerable});return n};var f=n=>E(A({},"__esModule",{value:!0}),n);var I={};W(I,{ListAppsWithMetadataDeviceAction:()=>x});module.exports=f(I);var o=require("purify-ts"),a=require("xstate"),u=require("../../../device-action/model/UserInteractionRequired"),d=require("../../../device-action/os/Const"),l=require("../../../device-action/os/ListApps/ListAppsDeviceAction"),S=require("../../../device-action/xstate-utils/XStateDeviceAction");class x extends S.XStateDeviceAction{makeStateMachine(e){const{getAppsByHash:i,saveSessionState:r,getDeviceSessionState:p}=this.extractDependencies(e),h=this.input.unlockTimeout??d.DEFAULT_UNLOCK_TIMEOUT_MS,M=new l.ListAppsDeviceAction({input:{unlockTimeout:h}}).makeStateMachine(e);return(0,a.setup)({types:{input:{unlockTimeout:h},context:{},output:{}},actors:{listApps:M,getAppsByHash:(0,a.fromPromise)(i),saveSessionState:(0,a.fromCallback)(({input:t,sendBack:s})=>{const{appsWithMetadata:m}=t,y=m.filter(c=>c!==null),D={...p(),installedApps:y};try{r(D),s({type:"done"})}catch(c){s({type:"error",error:c})}})},guards:{hasError:({context:t})=>t._internalState.error!==null,hasNoAppsInstalled:({context:t})=>t._internalState.apps.length===0},actions:{assignErrorFromEvent:(0,a.assign)({_internalState:t=>({...t.context._internalState,error:t.event.error})})}}).createMachine({id:"ListAppsWithMetadataDeviceAction",initial:"DeviceReady",context:t=>({input:t.input,_internalState:{error:null,apps:[],appsWithMetadata:[]},intermediateValue:{requiredUserInteraction:u.UserInteractionRequired.None}}),states:{DeviceReady:{always:{target:"ListApps"}},ListApps:{invoke:{id:"listApps",src:"listApps",input:t=>({unlockTimeout:t.context.input.unlockTimeout}),onSnapshot:{actions:(0,a.assign)({intermediateValue:t=>t.event.snapshot.context.intermediateValue})},onDone:{target:"ListAppsCheck",actions:(0,a.assign)({intermediateValue:t=>({requiredUserInteraction:u.UserInteractionRequired.None}),_internalState:t=>t.event.output.caseOf({Right:s=>({...t.context._internalState,apps:s}),Left:s=>({...t.context._internalState,error:s})})})}}},ListAppsCheck:{always:[{target:"Error",guard:"hasError"},{target:"Success",guard:"hasNoAppsInstalled",actions:(0,a.assign)({_internalState:t=>({...t.context._internalState,appsWithMetadata:[]})})},{target:"FetchMetadata"}]},FetchMetadata:{invoke:{id:"getAppsByHash",src:"getAppsByHash",input:t=>t.context._internalState.apps,onDone:{target:"FetchMetadataCheck",actions:(0,a.assign)({_internalState:t=>t.event.output.caseOf({Right:s=>({...t.context._internalState,appsWithMetadata:s}),Left:s=>({...t.context._internalState,error:s})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},FetchMetadataCheck:{always:[{target:"Error",guard:"hasError"},{target:"SaveSession"}]},SaveSession:{invoke:{src:"saveSessionState",input:t=>({appsWithMetadata:t.context._internalState.appsWithMetadata})},on:{done:{target:"Success"},error:{target:"Error",actions:"assignErrorFromEvent"}}},Success:{type:"final"},Error:{type:"final"}},output:t=>t.context._internalState.error?(0,o.Left)(t.context._internalState.error):(0,o.Right)(t.context._internalState.appsWithMetadata)})}extractDependencies(e){return{getAppsByHash:({input:i})=>e.getMetadataForAppHashes(i),getDeviceSessionState:()=>e.getDeviceSessionState(),saveSessionState:i=>e.setDeviceSessionState(i)}}}0&&(module.exports={ListAppsWithMetadataDeviceAction});
|
2
|
+
//# sourceMappingURL=ListAppsWithMetadataDeviceAction.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.ts"],
|
4
|
+
"sourcesContent": ["import { type EitherAsync, Left, Right } from \"purify-ts\";\nimport {\n type AnyEventObject,\n assign,\n fromCallback,\n fromPromise,\n setup,\n} from \"xstate\";\n\nimport { type ListAppsResponse } 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 { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nimport { type ListAppsDAOutput } from \"@api/device-action/os/ListApps/types\";\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 { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\nimport { type Application } from \"@internal/manager-api/model/ManagerApiType\";\n\nimport {\n type ListAppsWithMetadataDAError,\n type ListAppsWithMetadataDAInput,\n type ListAppsWithMetadataDAIntermediateValue,\n type ListAppsWithMetadataDAOutput,\n} from \"./types\";\n\ntype ListAppsWithMetadataMachineInternalState = {\n error: ListAppsWithMetadataDAError | null;\n apps: ListAppsResponse;\n appsWithMetadata: ListAppsWithMetadataDAOutput;\n};\n\nexport type MachineDependencies = {\n getAppsByHash: ({\n input,\n }: {\n input: ListAppsDAOutput;\n }) => EitherAsync<HttpFetchApiError, Array<Application | null>>;\n getDeviceSessionState: () => DeviceSessionState;\n saveSessionState: (state: DeviceSessionState) => DeviceSessionState;\n};\n\nexport class ListAppsWithMetadataDeviceAction extends XStateDeviceAction<\n ListAppsWithMetadataDAOutput,\n ListAppsWithMetadataDAInput,\n ListAppsWithMetadataDAError,\n ListAppsWithMetadataDAIntermediateValue,\n ListAppsWithMetadataMachineInternalState\n> {\n makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n ListAppsWithMetadataDAOutput,\n ListAppsWithMetadataDAInput,\n ListAppsWithMetadataDAError,\n ListAppsWithMetadataDAIntermediateValue,\n ListAppsWithMetadataMachineInternalState\n > {\n type types = StateMachineTypes<\n ListAppsWithMetadataDAOutput,\n ListAppsWithMetadataDAInput,\n ListAppsWithMetadataDAError,\n ListAppsWithMetadataDAIntermediateValue,\n ListAppsWithMetadataMachineInternalState\n >;\n\n const { getAppsByHash, saveSessionState, getDeviceSessionState } =\n this.extractDependencies(internalAPI);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const listAppsMachine = new ListAppsDeviceAction({\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: listAppsMachine,\n getAppsByHash: fromPromise(getAppsByHash),\n saveSessionState: fromCallback(\n ({\n input,\n sendBack,\n }: {\n sendBack: (event: AnyEventObject) => void;\n input: {\n appsWithMetadata: Array<Application | null>;\n };\n }) => {\n const { appsWithMetadata } = input;\n\n const filterted = appsWithMetadata.filter((app) => app !== null);\n\n const sessionState = getDeviceSessionState();\n const updatedState = {\n ...sessionState,\n installedApps: filterted,\n };\n try {\n saveSessionState(updatedState);\n sendBack({ type: \"done\" });\n } catch (error) {\n sendBack({ type: \"error\", error });\n }\n },\n ),\n },\n guards: {\n hasError: ({ context }: { context: types[\"context\"] }) => {\n return context._internalState.error !== null;\n },\n hasNoAppsInstalled: ({ context }: { context: types[\"context\"] }) =>\n context._internalState.apps.length === 0,\n },\n actions: {\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 N4IgpgJg5mDOIC5QBkCWsAuBBADj2A6qhgBYCyYGAhhFdQCJgBuqAxmFqxqgPYB2AOkYt2AJTA0AngGIA2gAYAuolA4esYrz4qQAD0QBGAJzyBADgBsAdgNWAzPIAs8+TceOANCEmILAJjMBKwsHOyMjAzN7SIBfGK80TFx8IlIKaloGZjYOLi0BROw8WGkIfjABVD4mHgBrCoAbdCL8BWUkEDUNbn4dfQQAVgCBIz9IgacQ6z8-Lx8Ef1N5OwsBlbs7dyNHCziE5uTCYnJKGjoqYRzOHsFCw+kwACdHnkeBHAa6ADNXgFsBJpJYptHRdTS9Dr9IaBUbjSYrKwzOaIMwGAQTFx2MxmOx+AYDKxGAZ7EB3YqpE4Zc6XdjXfJk-AAYRIYFYtTkSlB6nB2khKKGAj89jCRjCFmWdmRCD8LiCGIMMysqIsCpJDKOaVOmQu2VpeX4BQOxWZrPZsgM7VU3JufX5fkFwvCYolUqVjkFyxlA3FeO9VjVRpSx3SZyyIlyN0NQKZLLZcj8ls61q0toQZgFQo2TqM4o2UosjjsQRC8iFa1GfiJAejGspoZ14bpBoAYpRWHXtaVypVqnUKjAWrAAEKSAASVFgJBBHTBNr5CAM7gsAkcY3TZmW-iMiPzm0Flkc2PX8gMTmrg4pIe1NIj+VbGHbV-OD2er3enwwP0e-wHhxH48nacrW6FN50XHYVzXAYNxWSsd28RA7GMQUMUcaCLFFTZdniUlA1rJ8wyufVBHvR8tXOE04yApMQIhUB+kiVYBFLTYbBmPwCwsKUdjRRxghVMwAlWSIjHPQ5L3Iwi9UjUiOwo2MzQtLlaN5ejDEsAZmL8ViFRmTj8wLSDt3kbFtzGZYxPJYNJIbIjIwAZSoJgwHsuANH4Ls+DAajZ1AtTpQ4wJnH8UyHB9fNgiMjCzCdcUzEcSyg01KkpNvA1HOc1zYHcvgXxeR4fOTOi9EQPSgvkEKYrC0spQJIwRn4pw8QLAwQjiHC+B4CA4B0dUJJS2zpL8mieVTABaLiEIQMbNPCOb5vmyxEvwmybybQQb3EKRlNG+dV3zIVizCxwc3sPxlv6+s1uIqNBx2ud-ICWa1lPexsWMb18ycQUS3FfEFTsb0LusgbrsjdVKNqe7hv6CwogECwCxPQGhSsNCjHzVdmIMMKBgMBV8eMYHkqu3U0pIts5OoaHioY093QCEwMNFJV5Gg-NInRHGKoqnNSzR4mqcG8mBFkgiqEhmnVJKhdVndQTlncKxXCsfF829H6HFsEJvSFbD9hrS7rzJ9aBAyly3OG3zadK-nzAGUUzKsQlxQxqaQnq2xt1XNnnBMuxBfFsH8nsgBXVh2GyqXUzxCqBEB7YxlXGLIisV0cy5sLlcR53RUD1aTZugBRV9Hmj+dY+XBPV0XRnU9qyxzGiiqNwmOxgnamIgA */\n id: \"ListAppsWithMetadataDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n return {\n input: _.input,\n _internalState: {\n error: null,\n apps: [],\n appsWithMetadata: [],\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"ListApps\",\n },\n },\n ListApps: {\n invoke: {\n id: \"listApps\",\n src: \"listApps\",\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: \"ListAppsCheck\",\n actions: assign({\n intermediateValue: (_) => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n _internalState: (_) => {\n return _.event.output.caseOf({\n Right: (apps) => ({\n ..._.context._internalState,\n apps,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n },\n },\n },\n ListAppsCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"Success\",\n guard: \"hasNoAppsInstalled\",\n actions: assign({\n _internalState: (_) => {\n return {\n ..._.context._internalState,\n appsWithMetadata: [],\n };\n },\n }),\n },\n {\n target: \"FetchMetadata\",\n },\n ],\n },\n FetchMetadata: {\n invoke: {\n id: \"getAppsByHash\",\n src: \"getAppsByHash\",\n input: (_) => _.context._internalState.apps,\n onDone: {\n target: \"FetchMetadataCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf({\n Right: (appsWithMetadata) => ({\n ..._.context._internalState,\n appsWithMetadata,\n }),\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 FetchMetadataCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"SaveSession\",\n },\n ],\n },\n SaveSession: {\n invoke: {\n src: \"saveSessionState\",\n input: (_) => ({\n appsWithMetadata: _.context._internalState.appsWithMetadata,\n }),\n },\n on: {\n done: {\n target: \"Success\",\n },\n error: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\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.appsWithMetadata);\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n return {\n getAppsByHash: ({ input }) => internalApi.getMetadataForAppHashes(input),\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n saveSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sCAAAE,IAAA,eAAAC,EAAAH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,EACA,QAAS,CACP,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,mBAAoB,CAClB,OAAQ,CACN,CACE,OAAQ,QACR,MAAO,UACT,EACA,CACE,OAAQ,aACV,CACF,CACF,EACA,YAAa,CACX,OAAQ,CACN,IAAK,mBACL,MAAQE,IAAO,CACb,iBAAkBA,EAAE,QAAQ,eAAe,gBAC7C,EACF,EACA,GAAI,CACF,KAAM,CACJ,OAAQ,SACV,EACA,MAAO,CACL,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,QAAS,CACP,KAAM,OACR,EACA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAASA,GACHA,EAAE,QAAQ,eAAe,SACpB,QAAKA,EAAE,QAAQ,eAAe,KAAK,KAGrC,SAAMA,EAAE,QAAQ,eAAe,gBAAgB,CAE1D,CAAC,CACH,CAEA,oBAAoBE,EAA+C,CACjE,MAAO,CACL,cAAe,CAAC,CAAE,MAAAV,CAAM,IAAMU,EAAY,wBAAwBV,CAAK,EACvE,sBAAuB,IAAMU,EAAY,sBAAsB,EAC/D,iBAAmBC,GACjBD,EAAY,sBAAsBC,CAAK,CAC3C,CACF,CACF",
|
6
|
+
"names": ["ListAppsWithMetadataDeviceAction_exports", "__export", "ListAppsWithMetadataDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_UserInteractionRequired", "import_Const", "import_ListAppsDeviceAction", "import_XStateDeviceAction", "internalAPI", "getAppsByHash", "saveSessionState", "getDeviceSessionState", "unlockTimeout", "listAppsMachine", "input", "sendBack", "appsWithMetadata", "filterted", "app", "updatedState", "error", "context", "_", "apps", "internalApi", "state"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var c=require("purify-ts"),S=require("../../../device/DeviceStatus"),i=require("../../../device-action/__test-utils__/data"),r=require("../../../device-action/__test-utils__/makeInternalApi"),o=require("../../../device-action/__test-utils__/setupTestMachine"),d=require("../../../device-action/__test-utils__/testDeviceActionStates"),e=require("../../../device-action/model/DeviceActionState"),t=require("../../../device-action/model/UserInteractionRequired"),l=require("../../../device-action/os/Errors"),P=require("../../../device-session/DeviceSessionState"),g=require("../../../../internal/manager-api/model/Errors"),p=require("./ListAppsWithMetadataDeviceAction");jest.mock("@api/device-action/os/ListApps/ListAppsDeviceAction");describe("ListAppsWithMetadataDeviceAction",()=>{const{getMetadataForAppHashes:u}=(0,r.makeDeviceActionInternalApiMock)(),A=jest.fn(),m=jest.fn(),h=jest.fn();function v(){return{getAppsByHash:h,getDeviceSessionState:m,saveSessionState:A}}beforeEach(()=>{jest.resetAllMocks()}),describe("success case",()=>{it("should run the device actions with no apps installed",n=>{(0,o.setupListAppsMock)([]);const s=new p.ListAppsWithMetadataDeviceAction({input:{}});u.mockResolvedValue((0,c.Right)([]));const a=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{status:e.DeviceActionStatus.Completed,output:[]}];(0,d.testDeviceActionStates)(s,a,(0,r.makeDeviceActionInternalApiMock)(),n)}),it("should run the device actions with 1 app installed",n=>{(0,o.setupListAppsMock)([i.BTC_APP]);const s=new p.ListAppsWithMetadataDeviceAction({input:{}});u.mockResolvedValue((0,c.Right)([i.BTC_APP_METADATA]));const a=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{status:e.DeviceActionStatus.Completed,output:[i.BTC_APP_METADATA]}];(0,d.testDeviceActionStates)(s,a,(0,r.makeDeviceActionInternalApiMock)(),n)}),it("should run the device actions with 2 apps installed",n=>{(0,o.setupListAppsMock)([i.BTC_APP,i.ETH_APP]);const s=new p.ListAppsWithMetadataDeviceAction({input:{}});u.mockResolvedValue((0,c.Right)([i.BTC_APP_METADATA,i.ETH_APP_METADATA]));const a=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{status:e.DeviceActionStatus.Completed,output:[i.BTC_APP_METADATA,i.ETH_APP_METADATA]}];(0,d.testDeviceActionStates)(s,a,(0,r.makeDeviceActionInternalApiMock)(),n)}),it("should run the device actions with 1 app installed and a custom lock screen",n=>{(0,o.setupListAppsMock)([i.BTC_APP,i.CUSTOM_LOCK_SCREEN_APP]);const s=new p.ListAppsWithMetadataDeviceAction({input:{}});u.mockResolvedValue((0,c.Right)([i.BTC_APP_METADATA,i.CUSTOM_LOCK_SCREEN_APP_METADATA]));const a=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{status:e.DeviceActionStatus.Completed,output:[i.BTC_APP_METADATA,i.CUSTOM_LOCK_SCREEN_APP_METADATA]}];(0,d.testDeviceActionStates)(s,a,(0,r.makeDeviceActionInternalApiMock)(),n)})}),describe("error case",()=>{it("should error when ListApps fails",n=>{(0,o.setupListAppsMock)([],!0);const s=new p.ListAppsWithMetadataDeviceAction({input:{}}),a=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{status:e.DeviceActionStatus.Error,error:new l.UnknownDAError("ListApps failed")}];(0,d.testDeviceActionStates)(s,a,(0,r.makeDeviceActionInternalApiMock)(),n)}),it("should error when getAppsByHash rejects",n=>{(0,o.setupListAppsMock)([i.BTC_APP]);const s=new p.ListAppsWithMetadataDeviceAction({input:{}});u.mockRejectedValue(new l.UnknownDAError("getAppsByHash failed"));const a=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{status:e.DeviceActionStatus.Error,error:new l.UnknownDAError("getAppsByHash failed")}];(0,d.testDeviceActionStates)(s,a,(0,r.makeDeviceActionInternalApiMock)(),n)}),it("should error when getAppsByHash fails but error is known",n=>{(0,o.setupListAppsMock)([i.BTC_APP]);const s=new p.ListAppsWithMetadataDeviceAction({input:{}}),a=new g.HttpFetchApiError(new Error("Failed to fetch data"));u.mockResolvedValue((0,c.Left)(a));const w=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{status:e.DeviceActionStatus.Error,error:a}];(0,d.testDeviceActionStates)(s,w,(0,r.makeDeviceActionInternalApiMock)(),n)}),it("should error when SaveSession fails",n=>{(0,o.setupListAppsMock)([i.BTC_APP]);const s=new p.ListAppsWithMetadataDeviceAction({input:{}});h.mockImplementation(async()=>Promise.resolve((0,c.Right)([i.BTC_APP_METADATA]))),jest.spyOn(s,"extractDependencies").mockReturnValue(v()),m.mockReturnValue({sessionStateType:P.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:S.DeviceStatus.CONNECTED,currentApp:"BOLOS",installedApps:[]}),A.mockImplementation(()=>{throw new l.UnknownDAError("SaveSession failed")});const a=[{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.AllowListApps},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:t.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{status:e.DeviceActionStatus.Error,error:new l.UnknownDAError("SaveSession failed")}];(0,d.testDeviceActionStates)(s,a,(0,r.makeDeviceActionInternalApiMock)(),n)})})});
|
2
|
+
//# sourceMappingURL=ListAppsWithMetadataDeviceAction.test.js.map
|