@ledgerhq/device-management-kit 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -28
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKit.js.map +2 -2
- package/lib/cjs/src/api/apdu/utils/ApduBuilder.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ApduBuilder.js.map +3 -3
- package/lib/cjs/src/api/command/os/GetBackgroundImageSizeCommand.js +2 -0
- package/lib/cjs/src/api/command/os/GetBackgroundImageSizeCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetBackgroundImageSizeCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/GetBackgroundImageSizeCommand.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
- package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/types.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/ListApps/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListApps/types.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/types.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +3 -3
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js.map +3 -3
- package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/index.js +1 -1
- package/lib/cjs/src/api/index.js.map +3 -3
- package/lib/cjs/src/api/logger-publisher/utils/noopLoggerFactory.js +2 -0
- package/lib/cjs/src/api/logger-publisher/utils/noopLoggerFactory.js.map +7 -0
- package/lib/cjs/src/api/logger-publisher/utils/noopLoggerFactory.test.js +2 -0
- package/lib/cjs/src/api/logger-publisher/utils/noopLoggerFactory.test.js.map +7 -0
- package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
- package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js +1 -1
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +3 -3
- package/lib/cjs/src/api/transport/model/Errors.js +1 -1
- package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
- package/lib/cjs/src/api/types.js +1 -1
- package/lib/cjs/src/api/types.js.map +1 -1
- package/lib/cjs/src/api/utils/ApplicationChecker.js +2 -0
- package/lib/cjs/src/api/utils/ApplicationChecker.js.map +7 -0
- package/lib/cjs/src/api/utils/ApplicationChecker.test.js +2 -0
- package/lib/cjs/src/api/utils/ApplicationChecker.test.js.map +7 -0
- package/lib/cjs/src/api/utils/ApplicationResolver.js +2 -0
- package/lib/cjs/src/api/utils/ApplicationResolver.js.map +7 -0
- package/lib/cjs/src/api/utils/Base64String.js +1 -1
- package/lib/cjs/src/api/utils/Base64String.js.map +3 -3
- package/lib/cjs/src/api/utils/Base64String.test.js +1 -1
- package/lib/cjs/src/api/utils/Base64String.test.js.map +3 -3
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
- package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js +1 -1
- package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
- package/lib/cjs/src/internal/device-session/model/DevicePinger.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DevicePinger.js.map +2 -2
- package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js.map +2 -2
- package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSession.test.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSession.test.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +2 -2
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +2 -2
- package/lib/cjs/src/internal/device-session/service/IntentQueueService.js +2 -0
- package/lib/cjs/src/internal/device-session/service/IntentQueueService.js.map +7 -0
- package/lib/cjs/src/internal/device-session/service/IntentQueueService.test.js +2 -0
- package/lib/cjs/src/internal/device-session/service/IntentQueueService.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.js +2 -0
- package/lib/cjs/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.js.map +7 -0
- package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
- package/lib/esm/package.json +1 -1
- package/lib/esm/src/api/DeviceManagementKit.js +1 -1
- package/lib/esm/src/api/DeviceManagementKit.js.map +2 -2
- package/lib/esm/src/api/apdu/utils/ApduBuilder.js +1 -1
- package/lib/esm/src/api/apdu/utils/ApduBuilder.js.map +3 -3
- package/lib/esm/src/api/command/os/GetBackgroundImageSizeCommand.js +2 -0
- package/lib/esm/src/api/command/os/GetBackgroundImageSizeCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/GetBackgroundImageSizeCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/GetBackgroundImageSizeCommand.test.js.map +7 -0
- package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
- package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
- package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
- package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -0
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +4 -4
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js +1 -0
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js.map +4 -4
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
- 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 +4 -4
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +3 -3
- 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 +4 -4
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -0
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js.map +4 -4
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js.map +3 -3
- 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 +4 -4
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
- 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 +4 -4
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -0
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/types.js.map +4 -4
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -0
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js.map +4 -4
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +3 -3
- 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 +4 -4
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js.map +3 -3
- package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
- package/lib/esm/src/api/index.js +1 -1
- package/lib/esm/src/api/index.js.map +3 -3
- package/lib/esm/src/api/logger-publisher/utils/noopLoggerFactory.js +2 -0
- package/lib/esm/src/api/logger-publisher/utils/noopLoggerFactory.js.map +7 -0
- package/lib/esm/src/api/logger-publisher/utils/noopLoggerFactory.test.js +2 -0
- package/lib/esm/src/api/logger-publisher/utils/noopLoggerFactory.test.js.map +7 -0
- package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
- package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +3 -3
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js +1 -1
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +3 -3
- package/lib/esm/src/api/transport/model/Errors.js +1 -1
- package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
- package/lib/esm/src/api/utils/ApplicationChecker.js +2 -0
- package/lib/esm/src/api/utils/ApplicationChecker.js.map +7 -0
- package/lib/esm/src/api/utils/ApplicationChecker.test.js +2 -0
- package/lib/esm/src/api/utils/ApplicationChecker.test.js.map +7 -0
- package/lib/esm/src/api/utils/ApplicationResolver.js +1 -0
- package/lib/esm/src/api/utils/ApplicationResolver.js.map +7 -0
- package/lib/esm/src/api/utils/Base64String.js +1 -1
- package/lib/esm/src/api/utils/Base64String.js.map +3 -3
- package/lib/esm/src/api/utils/Base64String.test.js +1 -1
- package/lib/esm/src/api/utils/Base64String.test.js.map +3 -3
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
- package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js +1 -1
- package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
- package/lib/esm/src/internal/device-session/model/DevicePinger.js +1 -1
- package/lib/esm/src/internal/device-session/model/DevicePinger.js.map +2 -2
- package/lib/esm/src/internal/device-session/model/DevicePinger.test.js +1 -1
- package/lib/esm/src/internal/device-session/model/DevicePinger.test.js.map +2 -2
- package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSession.test.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSession.test.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +2 -2
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +2 -2
- package/lib/esm/src/internal/device-session/service/IntentQueueService.js +2 -0
- package/lib/esm/src/internal/device-session/service/IntentQueueService.js.map +7 -0
- package/lib/esm/src/internal/device-session/service/IntentQueueService.test.js +2 -0
- package/lib/esm/src/internal/device-session/service/IntentQueueService.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.js +2 -0
- package/lib/esm/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.js.map +7 -0
- package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
- package/lib/types/src/api/DeviceManagementKit.d.ts +10 -0
- package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts +7 -0
- package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts.map +1 -1
- package/lib/types/src/api/command/os/GetBackgroundImageSizeCommand.d.ts +17 -0
- package/lib/types/src/api/command/os/GetBackgroundImageSizeCommand.d.ts.map +1 -0
- package/lib/types/src/api/command/os/GetBackgroundImageSizeCommand.test.d.ts +2 -0
- package/lib/types/src/api/command/os/GetBackgroundImageSizeCommand.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/DeviceAction.d.ts +2 -1
- package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
- package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
- package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +4 -1
- package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +9 -1
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +13 -2
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -1
- 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 -0
- 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 +1 -1
- package/lib/types/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts +9 -1
- package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +9 -1
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -1
- 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 -0
- 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.map +1 -1
- package/lib/types/src/api/device-action/os/ListAppsWithMetadata/types.d.ts +8 -1
- 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.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts +12 -2
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +8 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -1
- 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 +9 -1
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts +10 -1
- package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/index.d.ts +11 -4
- package/lib/types/src/api/index.d.ts.map +1 -1
- package/lib/types/src/api/logger-publisher/utils/noopLoggerFactory.d.ts +12 -0
- package/lib/types/src/api/logger-publisher/utils/noopLoggerFactory.d.ts.map +1 -0
- package/lib/types/src/api/logger-publisher/utils/noopLoggerFactory.test.d.ts +2 -0
- package/lib/types/src/api/logger-publisher/utils/noopLoggerFactory.test.d.ts.map +1 -0
- package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +1 -0
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/Errors.d.ts +5 -0
- package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
- package/lib/types/src/api/types.d.ts +1 -0
- package/lib/types/src/api/types.d.ts.map +1 -1
- package/lib/types/src/api/utils/ApplicationChecker.d.ts +14 -0
- package/lib/types/src/api/utils/ApplicationChecker.d.ts.map +1 -0
- package/lib/types/src/api/utils/ApplicationChecker.test.d.ts +2 -0
- package/lib/types/src/api/utils/ApplicationChecker.test.d.ts.map +1 -0
- package/lib/types/src/api/utils/ApplicationResolver.d.ts +12 -0
- package/lib/types/src/api/utils/ApplicationResolver.d.ts.map +1 -0
- package/lib/types/src/api/utils/Base64String.d.ts +1 -0
- package/lib/types/src/api/utils/Base64String.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/di/deviceSessionTypes.d.ts +1 -0
- 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 +13 -2
- package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts +3 -1
- package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts +0 -1
- package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts +1 -0
- package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/service/IntentQueueService.d.ts +101 -0
- package/lib/types/src/internal/device-session/service/IntentQueueService.d.ts.map +1 -0
- package/lib/types/src/internal/device-session/service/IntentQueueService.test.d.ts +2 -0
- package/lib/types/src/internal/device-session/service/IntentQueueService.test.d.ts.map +1 -0
- package/lib/types/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.d.ts +19 -0
- package/lib/types/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.d.ts.map +1 -0
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js +0 -2
- package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js.map +0 -7
- package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js +0 -2
- package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js.map +0 -7
- package/lib/cjs/src/internal/device-session/service/MutexService.js +0 -2
- package/lib/cjs/src/internal/device-session/service/MutexService.js.map +0 -7
- package/lib/cjs/src/internal/device-session/service/MutexService.test.js +0 -2
- package/lib/cjs/src/internal/device-session/service/MutexService.test.js.map +0 -7
- package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js +0 -2
- package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js.map +0 -7
- package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js +0 -2
- package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js.map +0 -7
- package/lib/esm/src/internal/device-session/service/MutexService.js +0 -2
- package/lib/esm/src/internal/device-session/service/MutexService.js.map +0 -7
- package/lib/esm/src/internal/device-session/service/MutexService.test.js +0 -2
- package/lib/esm/src/internal/device-session/service/MutexService.test.js.map +0 -7
- package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts +0 -17
- package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts.map +0 -1
- package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts +0 -2
- package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts.map +0 -1
- package/lib/types/src/internal/device-session/service/MutexService.d.ts +0 -6
- package/lib/types/src/internal/device-session/service/MutexService.d.ts.map +0 -1
- package/lib/types/src/internal/device-session/service/MutexService.test.d.ts +0 -2
- package/lib/types/src/internal/device-session/service/MutexService.test.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/api/device-action/os/ListApps/ListAppsDeviceAction.ts"],
|
|
4
|
-
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n type AppResponse,\n ListAppsCommand,\n type ListAppsCommandResult,\n} from \"@api/command/os/ListAppsCommand\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\n\nimport {\n type ListAppsDAError,\n type ListAppsDAInput,\n type ListAppsDAIntermediateValue,\n type ListAppsDAOutput,\n} from \"./types\";\n\ntype ListAppsMachineInternalState = {\n readonly error: ListAppsDAError | null;\n readonly apps: AppResponse[];\n readonly shouldContinue: boolean;\n};\n\nexport type MachineDependencies = {\n readonly listApps: ({\n input,\n }: {\n input: boolean;\n }) => Promise<ListAppsCommandResult>;\n};\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class ListAppsDeviceAction extends XStateDeviceAction<\n ListAppsDAOutput,\n ListAppsDAInput,\n ListAppsDAError,\n ListAppsDAIntermediateValue,\n ListAppsMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n ListAppsDAOutput,\n ListAppsDAInput,\n ListAppsDAError,\n ListAppsDAIntermediateValue,\n ListAppsMachineInternalState\n > {\n type types = StateMachineTypes<\n ListAppsDAOutput,\n ListAppsDAInput,\n ListAppsDAError,\n ListAppsDAIntermediateValue,\n ListAppsMachineInternalState\n >;\n\n const { listApps } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const goToDashboardMachine = new GoToDashboardDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalApi);\n\n return setup({\n types: {\n input: {\n unlockTimeout,\n } as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n listApps: fromPromise<ListAppsCommandResult, boolean>(listApps),\n goToDashboard: goToDashboardMachine,\n },\n guards: {\n hasError: ({ context }: { context: types[\"context\"] }) => {\n return context._internalState.error !== null;\n },\n hasMoreApps: (_) => _.context._internalState.shouldContinue,\n },\n actions: {\n assignAllowListApps: assign({\n intermediateValue: (_) =>\n ({\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QBkCWsAuBBADj2AImAG6oDGYWZGqA9gHYB0RpFASmAIYQCeAxAG0ADAF1EoHLVioaDcSAAeiAIwBOIYwAcANgDsyzat2HlAJgDMegDQgeKg412ntAVm3mdp1af0uAvn42aJi4+CzklNR0TADitAAqtAScsAAWAEa0nABOEHwQDGCMqPTEtADWRRApGVm5wmJIIJLSsvTySgguquaMACy6rvrKfSOqfTZ2CKZC2v3K2ou6xn2mms7+gSDB2HiEJBFUbYxxiclpmTl5YNnZtNmMOAA2nBgAZvcAtozVF3UQDXkLRk0Q6iG6vQGQ2UIzGE1siE0ykYLiEaLRuiECxcbmUASC6F2YQOFCO0ROCSSNUuuQAwqkwGRyoJRECpCC5E1OsosZpHAZBi5zKpuhjJohTBZHBt3N5UapVGp8dtCaF9qxIsdTlS-ld6YzmQJlI0JOy2mCEDyHPpNILhaKhLpxQg+kI+ZjzGZdD0seYPMqdmrwqSogxGIG9vlCsVShUihHiRqyWGE7AECUymRXtEGoCmsDzVyVAM+cpzGtzKjvdp1ppnZWNNosW4+sLNEJUdo+gHVXtg5ryam+Dc7g9nq8Ptlvqn+8mmKn07Gs21c6z82bQUXLSXGGWK1XVDW1s6XMZ+kKzLaZk3XD2Qn2SQOU738HwFJhXkVOG8MDcABTKKiaIAJR8DOj5zuGL6wHmpqtJuoDcjue6aA21a1s6ejIuo2imDiCy6H0PS6HeRLqocobztBtIMDQ9AAK5gFG9BFBmcZQfeiYUccqY0fQdGMYumbZgwq4ms0G6cohKiaC4pZCOMQjlu4bguPWqyMJKrhdpKmLLNopFBhBlEcWRfECUxI73I8LzvF8plGUmJm8bRJSCWxy45qIsESfBUmKBKMzIjMnpyTitp+uY9ZyburYWDCfQ1ro5aGQ+TnHOZblMT5BYIQFlqoaojDaCK5iuq2XY1s6iW6I4h54bJlheKlXEhhlrkMdlxpsn57RbgYbiMLMeFrLpMxCiewqOOV4xEai6x4sq9C0BAcDyOB6V5bl-mdAAtNozq7S4jAKqdFgKdW+4teRbXkv2HDcFMcEcn10kuqYzowrVTjaR4TXrNds4mdq5y1FcPUvRaazHaVl5Cq66hqQiCDjJpMplQYmijClWwbdx5Ig9S-z6kyEOFm97bIqsh4KsKZYlQdyOSnywrluYsxDJTmwEpxN1PlRvNk3l3IGMiOIDB2ZWtq6H3I5WtV9BePhYm6gymIDxk8dRHWMULO0SlicyyYBPRlt4jXRXM2hqN6lg8j0GubWGmWdXrr35QsOhDbJh5+l44XwlM5hOCixhej4Ip9Ei3a49BQPHAAyvRZAULA8Drr1UM4nMMxeM4NaoR4TrI0KOczX0cWKo7+NhgAorc9xu1DoxFYBuE6O2OgKfWZ46EYimzAsXYBAEQA */\n id: \"ListAppsDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n error: null,\n apps: [],\n shouldContinue: false,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"GoToDashboard\",\n },\n },\n GoToDashboard: {\n invoke: {\n id: \"dashboard\",\n src: \"goToDashboard\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n target: \"GoToDashboardCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<ListAppsMachineInternalState>({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GoToDashboardCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"ListApps\",\n },\n ],\n },\n ListApps: {\n // NOTE: This is a timeout that is currently not used\n // We need to discuss this as a team, how do we want to\n // handle the case when the user does not validate or reject on the device\n // after: {\n // 15000: \"Error\",\n // actions: assign({\n // _internalState: (_) => ({\n // error: new UnknownDAError(\"ListAppsTimeout\"),\n // }),\n // }),\n // },\n entry: \"assignAllowListApps\",\n invoke: {\n src: \"listApps\",\n input: (_) => false,\n onDone: {\n target: \"Continue\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return {\n ..._.context._internalState,\n apps: _.context._internalState.apps.concat(\n _.event.output.data,\n ),\n shouldContinue: _.event.output.data.length >= 2,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n ListAppsCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n \"ListAppsContinue\",\n ],\n },\n ListAppsContinue: {\n invoke: {\n src: \"listApps\",\n input: (_) => true,\n onDone: {\n target: \"Continue\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return {\n ..._.context._internalState,\n apps: _.context._internalState.apps.concat(\n _.event.output.data,\n ),\n shouldContinue: _.event.output.data.length >= 2,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n Continue: {\n always: [\n {\n target: \"ListAppsContinue\",\n guard: \"hasMoreApps\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (_) => {\n if (_.context._internalState.error) {\n return Left(_.context._internalState.error);\n }\n\n return Right(_.context._internalState.apps);\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const listApps = async ({ input }: { input: boolean }) => {\n const command = new ListAppsCommand({ isContinue: input });\n return internalApi.sendCommand(command);\n };\n\n return {\n listApps,\n };\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAC5B,OAAS,UAAAC,EAAQ,eAAAC,EAAa,SAAAC,MAAa,SAE3C,OAAS,0BAAAC,MAA8B,mCACvC,OAEE,mBAAAC,MAEK,kCAEP,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,6BAAAC,MAAiC,8BAC1C,OAAS,6BAAAC,MAAiC,gEAE1C,OAEE,sBAAAC,MACK,
|
|
6
|
-
"names": ["Left", "Right", "assign", "fromPromise", "setup", "isSuccessCommandResult", "ListAppsCommand", "UserInteractionRequired", "DEFAULT_UNLOCK_TIMEOUT_MS", "GoToDashboardDeviceAction", "XStateDeviceAction", "ListAppsDeviceAction", "internalApi", "listApps", "unlockTimeout", "goToDashboardMachine", "context", "_", "error", "input", "command"]
|
|
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 listAppsDAStateStep,\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 step: listAppsDAStateStep.LIST_APPS,\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 step: listAppsDAStateStep.GO_TO_DASHBOARD,\n },\n _internalState: {\n error: null,\n apps: [],\n shouldContinue: false,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"GoToDashboard\",\n },\n },\n GoToDashboard: {\n invoke: {\n id: \"dashboard\",\n src: \"goToDashboard\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n target: \"GoToDashboardCheck\",\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<ListAppsMachineInternalState>({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GoToDashboardCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"ListApps\",\n },\n ],\n },\n ListApps: {\n // NOTE: This is a timeout that is currently not used\n // We need to discuss this as a team, how do we want to\n // handle the case when the user does not validate or reject on the device\n // after: {\n // 15000: \"Error\",\n // actions: assign({\n // _internalState: (_) => ({\n // error: new UnknownDAError(\"ListAppsTimeout\"),\n // }),\n // }),\n // },\n entry: \"assignAllowListApps\",\n invoke: {\n src: \"listApps\",\n input: (_) => false,\n onDone: {\n target: \"Continue\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return {\n ..._.context._internalState,\n apps: _.context._internalState.apps.concat(\n _.event.output.data,\n ),\n shouldContinue: _.event.output.data.length >= 2,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n ListAppsCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n \"ListAppsContinue\",\n ],\n },\n ListAppsContinue: {\n invoke: {\n src: \"listApps\",\n input: (_) => true,\n onDone: {\n target: \"Continue\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n return {\n ..._.context._internalState,\n apps: _.context._internalState.apps.concat(\n _.event.output.data,\n ),\n shouldContinue: _.event.output.data.length >= 2,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n Continue: {\n always: [\n {\n target: \"ListAppsContinue\",\n guard: \"hasMoreApps\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (_) => {\n if (_.context._internalState.error) {\n return Left(_.context._internalState.error);\n }\n\n return Right(_.context._internalState.apps);\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const listApps = async ({ input }: { input: boolean }) => {\n const command = new ListAppsCommand({ isContinue: input });\n return internalApi.sendCommand(command);\n };\n\n return {\n listApps,\n };\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAC5B,OAAS,UAAAC,EAAQ,eAAAC,EAAa,SAAAC,MAAa,SAE3C,OAAS,0BAAAC,MAA8B,mCACvC,OAEE,mBAAAC,MAEK,kCAEP,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,6BAAAC,MAAiC,8BAC1C,OAAS,6BAAAC,MAAiC,gEAE1C,OAEE,sBAAAC,MACK,qDAEP,OAKE,uBAAAC,MACK,UAoBA,MAAMC,UAA6BF,CAMxC,CACA,iBACEG,EAOA,CASA,KAAM,CAAE,SAAAC,CAAS,EAAI,KAAK,oBAAoBD,CAAW,EAEnDE,EAAgB,KAAK,MAAM,eAAiBP,EAE5CQ,EAAuB,IAAIP,EAA0B,CACzD,MAAO,CACL,cAAAM,CACF,CACF,CAAC,EAAE,iBAAiBF,CAAW,EAE/B,OAAOT,EAAM,CACX,MAAO,CACL,MAAO,CACL,cAAAW,CACF,EACA,QAAS,CAAC,EACV,OAAQ,CAAC,CACX,EACA,OAAQ,CACN,SAAUZ,EAA4CW,CAAQ,EAC9D,cAAeE,CACjB,EACA,OAAQ,CACN,SAAU,CAAC,CAAE,QAAAC,CAAQ,IACZA,EAAQ,eAAe,QAAU,KAE1C,YAAcC,GAAMA,EAAE,QAAQ,eAAe,cAC/C,EACA,QAAS,CACP,oBAAqBhB,EAAO,CAC1B,kBAAoBgB,IACjB,CACC,wBAAyBX,EAAwB,cACjD,KAAMI,EAAoB,SAC5B,EACJ,CAAC,EACD,qBAAsBT,EAAO,CAC3B,eAAiBgB,IAAO,CACtB,GAAGA,EAAE,QAAQ,eACb,MAAOA,EAAE,MAAM,KACjB,EACF,CAAC,CACH,CACF,CAAC,EAAE,cAAc,CAEf,GAAI,uBACJ,Q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AAwB,IACnD,EACF,CAAC,CACH,EACA,QAAS,CACP,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,cAAe,CACb,OAAQ,CACN,CACE,OAAQ,QACR,MAAO,UACT,EACA,kBACF,CACF,EACA,iBAAkB,CAChB,OAAQ,CACN,IAAK,WACL,MAAQW,GAAM,GACd,OAAQ,CACN,OAAQ,WACR,QAAShB,EAAO,CACd,eAAiBgB,GACXb,EAAuBa,EAAE,MAAM,MAAM,EAChC,CACL,GAAGA,EAAE,QAAQ,eACb,KAAMA,EAAE,QAAQ,eAAe,KAAK,OAClCA,EAAE,MAAM,OAAO,IACjB,EACA,eAAgBA,EAAE,MAAM,OAAO,KAAK,QAAU,CAChD,EAEK,CACL,GAAGA,EAAE,QAAQ,eACb,MAAOA,EAAE,MAAM,OAAO,KACxB,CAEJ,CAAC,CACH,EACA,QAAS,CACP,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,SAAU,CACR,OAAQ,CACN,CACE,OAAQ,mBACR,MAAO,aACT,EACA,CACE,OAAQ,SACV,CACF,CACF,EACA,QAAS,CACP,KAAM,OACR,EACA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAASA,GACHA,EAAE,QAAQ,eAAe,MACpBlB,EAAKkB,EAAE,QAAQ,eAAe,KAAK,EAGrCjB,EAAMiB,EAAE,QAAQ,eAAe,IAAI,CAE9C,CAAC,CACH,CAEA,oBAAoBL,EAA+C,CAMjE,MAAO,CACL,SANe,MAAO,CAAE,MAAAO,CAAM,IAA0B,CACxD,MAAMC,EAAU,IAAIf,EAAgB,CAAE,WAAYc,CAAM,CAAC,EACzD,OAAOP,EAAY,YAAYQ,CAAO,CACxC,CAIA,CACF,CACF",
|
|
6
|
+
"names": ["Left", "Right", "assign", "fromPromise", "setup", "isSuccessCommandResult", "ListAppsCommand", "UserInteractionRequired", "DEFAULT_UNLOCK_TIMEOUT_MS", "GoToDashboardDeviceAction", "XStateDeviceAction", "listAppsDAStateStep", "ListAppsDeviceAction", "internalApi", "listApps", "unlockTimeout", "goToDashboardMachine", "context", "_", "error", "input", "command"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{CommandResultFactory as
|
|
1
|
+
import{CommandResultFactory as a}from"../../../command/model/CommandResult";import{GLOBAL_ERRORS as V,GlobalCommandError as v}from"../../../command/utils/GlobalCommandError";import{BTC_APP as d,CUSTOM_LOCK_SCREEN_APP as S,DOGECOIN_APP as I,ETH_APP as P,SOLANA_APP as D}from"../../../device-action/__test-utils__/data";import{makeDeviceActionInternalApiMock as u}from"../../../device-action/__test-utils__/makeInternalApi";import{setupGoToDashboardMock as c}from"../../../device-action/__test-utils__/setupTestMachine";import{testDeviceActionStates as l}from"../../../device-action/__test-utils__/testDeviceActionStates";import{DeviceActionStatus as e}from"../../../device-action/model/DeviceActionState";import{UserInteractionRequired as t}from"../../../device-action/model/UserInteractionRequired";import{UnknownDAError as T}from"../../../device-action/os/Errors";import{goToDashboardDAStateStep as A}from"../../../device-action/os/GoToDashboard/types";import{ListAppsDeviceAction as m}from"./ListAppsDeviceAction";import{listAppsDAStateStep as n}from"./types";vi.mock("@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction");describe("ListAppsDeviceAction",()=>{const{sendCommand:p}=u();beforeEach(()=>{vi.resetAllMocks()}),describe("success cases",()=>{it("should run the device action with no apps installed",()=>new Promise((r,s)=>{c();const o=new m({input:{}});p.mockResolvedValue(a({data:[]}));const i=[{intermediateValue:{requiredUserInteraction:t.None,step:n.GO_TO_DASHBOARD},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:A.GET_DEVICE_STATUS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:n.LIST_APPS},status:e.Pending},{output:[],status:e.Completed}];l(o,i,u(),{onDone:r,onError:s})})),it("should run the device action with one app installed",()=>new Promise((r,s)=>{c();const o=new m({input:{unlockTimeout:500}});p.mockResolvedValueOnce(a({data:[d]}));const i=[{intermediateValue:{requiredUserInteraction:t.None,step:n.GO_TO_DASHBOARD},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:A.GET_DEVICE_STATUS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:n.LIST_APPS},status:e.Pending},{output:[d],status:e.Completed}];l(o,i,u(),{onDone:r,onError:s})})),it("should run the device action with two app installed",()=>new Promise((r,s)=>{c();const o=new m({input:{unlockTimeout:500}});p.mockResolvedValueOnce(a({data:[d,S]})).mockResolvedValueOnce(a({data:[]}));const i=[{intermediateValue:{requiredUserInteraction:t.None,step:n.GO_TO_DASHBOARD},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:A.GET_DEVICE_STATUS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:n.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:n.LIST_APPS},status:e.Pending},{output:[d,S],status:e.Completed}];l(o,i,u(),{onDone:r,onError:s})})),it("should run the device action with three app installed",()=>new Promise((r,s)=>{c();const o=new m({input:{unlockTimeout:500}});p.mockResolvedValueOnce(a({data:[d,S]})).mockResolvedValueOnce(a({data:[P]}));const i=[{intermediateValue:{requiredUserInteraction:t.None,step:n.GO_TO_DASHBOARD},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:A.GET_DEVICE_STATUS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:n.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:n.LIST_APPS},status:e.Pending},{output:[d,S,P],status:e.Completed}];l(o,i,u(),{onDone:r,onError:s})})),it("should run the device action with four app installed",()=>new Promise((r,s)=>{c();const o=new m({input:{unlockTimeout:500}});p.mockResolvedValueOnce(a({data:[d,S]})).mockResolvedValueOnce(a({data:[P,D]})).mockResolvedValueOnce(a({data:[]}));const i=[{intermediateValue:{requiredUserInteraction:t.None,step:n.GO_TO_DASHBOARD},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:A.GET_DEVICE_STATUS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:n.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:n.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:n.LIST_APPS},status:e.Pending},{output:[d,S,P,D],status:e.Completed}];l(o,i,u(),{onDone:r,onError:s})})),it("should run the device action with five app installed",()=>new Promise((r,s)=>{c();const o=new m({input:{unlockTimeout:500}});p.mockResolvedValueOnce(a({data:[d,S]})).mockResolvedValueOnce(a({data:[P,D]})).mockResolvedValueOnce(a({data:[I]}));const i=[{intermediateValue:{requiredUserInteraction:t.None,step:n.GO_TO_DASHBOARD},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:A.GET_DEVICE_STATUS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:n.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:n.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:n.LIST_APPS},status:e.Pending},{output:[d,S,P,D,I],status:e.Completed}];l(o,i,u(),{onDone:r,onError:s})}))}),describe("error cases",()=>{it("should return an error if GoTodashboard fails",()=>new Promise((r,s)=>{c(!0);const o=new m({input:{unlockTimeout:500}});p.mockResolvedValue(a({data:[]}));const i=[{intermediateValue:{requiredUserInteraction:t.None,step:n.GO_TO_DASHBOARD},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:A.GET_DEVICE_STATUS},status:e.Pending},{error:new T("GoToDashboard failed"),status:e.Error}];l(o,i,u(),{onDone:r,onError:s})})),it("should run the device action if GoTodashboard fails",()=>new Promise((r,s)=>{c(!0);const o=new m({input:{unlockTimeout:500}});p.mockResolvedValue(a({data:[]}));const i=[{intermediateValue:{requiredUserInteraction:t.None,step:n.GO_TO_DASHBOARD},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:A.GET_DEVICE_STATUS},status:e.Pending},{error:new T("GoToDashboard failed"),status:e.Error}];l(o,i,u(),{onDone:r,onError:s})})),it("should return an error if ListApps fails",()=>new Promise((r,s)=>{c();const o=new m({input:{unlockTimeout:500}}),i=new v({errorCode:"5501",...V[5501]});p.mockResolvedValue(a({error:i}));const _=[{intermediateValue:{requiredUserInteraction:t.None,step:n.GO_TO_DASHBOARD},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:A.GET_DEVICE_STATUS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:n.LIST_APPS},status:e.Pending},{error:i,status:e.Error}];l(o,_,u(),{onDone:r,onError:s})})),it("should return an error if ListAppsContinue fails",()=>new Promise((r,s)=>{c();const o=new m({input:{unlockTimeout:500}});p.mockResolvedValueOnce(a({data:[d,S]})).mockRejectedValueOnce(new T("mocked error"));const i=[{intermediateValue:{requiredUserInteraction:t.None,step:n.GO_TO_DASHBOARD},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:A.GET_DEVICE_STATUS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:n.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:n.LIST_APPS},status:e.Pending},{error:new T("mocked error"),status:e.Error}];l(o,i,u(),{onDone:r,onError:s})}))})});
|
|
2
2
|
//# sourceMappingURL=ListAppsDeviceAction.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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\nvi.mock(\"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\");\n\ndescribe(\"ListAppsDeviceAction\", () => {\n const { sendCommand: sendCommandMock } = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"success cases\", () => {\n it(\"should run the device action with no apps installed\", () =>\n new Promise<void>((resolve, reject) => {\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device action with one app installed\", () =>\n new Promise<void>((resolve, reject) => {\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device action with two app installed\", () =>\n new Promise<void>((resolve, reject) => {\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device action with three app installed\", () =>\n new Promise<void>((resolve, reject) => {\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device action with four app installed\", () =>\n new Promise<void>((resolve, reject) => {\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device action with five app installed\", () =>\n new Promise<void>((resolve, reject) => {\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(\n CommandResultFactory({ data: [DOGECOIN_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 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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n\n describe(\"error cases\", () => {\n it(\"should return an error if GoTodashboard fails\", () =>\n new Promise<void>((resolve, reject) => {\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device action if GoTodashboard fails\", () =>\n new Promise<void>((resolve, reject) => {\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should return an error if ListApps fails\", () =>\n new Promise<void>((resolve, reject) => {\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should return an error if ListAppsContinue fails\", () =>\n new Promise<void>((resolve, reject) => {\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,wBAAAA,MAA4B,mCAErC,OACE,iBAAAC,EACA,sBAAAC,MACK,wCACP,OACE,WAAAC,EACA,0BAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,cAAAC,MACK,yCACP,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,0BAAAC,MAA8B,qDACvC,OAAS,0BAAAC,MAA8B,2DACvC,OAAS,sBAAAC,MAA0B,6CACnC,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,kBAAAC,MAAsB,+
|
|
6
|
-
"names": ["CommandResultFactory", "GLOBAL_ERRORS", "GlobalCommandError", "BTC_APP", "CUSTOM_LOCK_SCREEN_APP", "DOGECOIN_APP", "ETH_APP", "SOLANA_APP", "makeDeviceActionInternalApiMock", "setupGoToDashboardMock", "testDeviceActionStates", "DeviceActionStatus", "UserInteractionRequired", "UnknownDAError", "ListAppsDeviceAction", "sendCommandMock", "resolve", "reject", "listAppsDeviceAction", "expectedStates", "globalError"]
|
|
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\";\nimport { goToDashboardDAStateStep } from \"@api/device-action/os/GoToDashboard/types\";\n\nimport { ListAppsDeviceAction } from \"./ListAppsDeviceAction\";\nimport { type ListAppsDAState, listAppsDAStateStep } from \"./types\";\n\nvi.mock(\"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\");\n\ndescribe(\"ListAppsDeviceAction\", () => {\n const { sendCommand: sendCommandMock } = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"success cases\", () => {\n it(\"should run the device action with no apps installed\", () =>\n new Promise<void>((resolve, reject) => {\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 step: listAppsDAStateStep.GO_TO_DASHBOARD,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: goToDashboardDAStateStep.GET_DEVICE_STATUS,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device action with one app installed\", () =>\n new Promise<void>((resolve, reject) => {\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 step: listAppsDAStateStep.GO_TO_DASHBOARD,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: goToDashboardDAStateStep.GET_DEVICE_STATUS,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device action with two app installed\", () =>\n new Promise<void>((resolve, reject) => {\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 step: listAppsDAStateStep.GO_TO_DASHBOARD,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: goToDashboardDAStateStep.GET_DEVICE_STATUS,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsDAStateStep.LIST_APPS,\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device action with three app installed\", () =>\n new Promise<void>((resolve, reject) => {\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 step: listAppsDAStateStep.GO_TO_DASHBOARD,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: goToDashboardDAStateStep.GET_DEVICE_STATUS,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsDAStateStep.LIST_APPS,\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device action with four app installed\", () =>\n new Promise<void>((resolve, reject) => {\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 step: listAppsDAStateStep.GO_TO_DASHBOARD,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: goToDashboardDAStateStep.GET_DEVICE_STATUS,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ContinueListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsDAStateStep.LIST_APPS,\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device action with five app installed\", () =>\n new Promise<void>((resolve, reject) => {\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(\n CommandResultFactory({ data: [DOGECOIN_APP] }),\n );\n const expectedStates: Array<ListAppsDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsDAStateStep.GO_TO_DASHBOARD,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: goToDashboardDAStateStep.GET_DEVICE_STATUS,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ContinueListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsDAStateStep.LIST_APPS,\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n\n describe(\"error cases\", () => {\n it(\"should return an error if GoTodashboard fails\", () =>\n new Promise<void>((resolve, reject) => {\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 step: listAppsDAStateStep.GO_TO_DASHBOARD,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: goToDashboardDAStateStep.GET_DEVICE_STATUS,\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device action if GoTodashboard fails\", () =>\n new Promise<void>((resolve, reject) => {\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 step: listAppsDAStateStep.GO_TO_DASHBOARD,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: goToDashboardDAStateStep.GET_DEVICE_STATUS,\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should return an error if ListApps fails\", () =>\n new Promise<void>((resolve, reject) => {\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 step: listAppsDAStateStep.GO_TO_DASHBOARD,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: goToDashboardDAStateStep.GET_DEVICE_STATUS,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should return an error if ListAppsContinue fails\", () =>\n new Promise<void>((resolve, reject) => {\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 step: listAppsDAStateStep.GO_TO_DASHBOARD,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: goToDashboardDAStateStep.GET_DEVICE_STATUS,\n },\n status: DeviceActionStatus.Pending, // GoToDashboardCheck\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListApps\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsDAStateStep.LIST_APPS,\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 {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,wBAAAA,MAA4B,mCAErC,OACE,iBAAAC,EACA,sBAAAC,MACK,wCACP,OACE,WAAAC,EACA,0BAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,cAAAC,MACK,yCACP,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,0BAAAC,MAA8B,qDACvC,OAAS,0BAAAC,MAA8B,2DACvC,OAAS,sBAAAC,MAA0B,6CACnC,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,kBAAAC,MAAs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AuB,EACvB,MAAMW,EAAuB,IAAIL,EAAqB,CACpD,MAAO,CAAE,cAAe,GAAI,CAC9B,CAAC,EAEDE,EACG,sBACCjB,EAAqB,CAAE,KAAM,CAACG,EAASC,CAAsB,CAAE,CAAC,CAClE,EACC,sBAAsB,IAAIS,EAAe,cAAc,CAAC,EAE3D,MAAMQ,EAAyC,CAC7C,CACE,kBAAmB,CACjB,wBAAyBT,EAAwB,KACjD,KAAMI,EAAoB,eAC5B,EACA,OAAQL,EAAmB,OAC7B,EACA,CACE,kBAAmB,CACjB,wBAAyBC,EAAwB,KACjD,KAAME,EAAyB,iBACjC,EACA,OAAQH,EAAmB,OAC7B,EACA,CACE,kBAAmB,CACjB,wBAAyBC,EAAwB,cACjD,KAAMI,EAAoB,SAC5B,EACA,OAAQL,EAAmB,OAC7B,EACA,CACE,kBAAmB,CACjB,wBAAyBC,EAAwB,KACjD,KAAMI,EAAoB,SAC5B,EACA,OAAQL,EAAmB,OAC7B,EACA,CACE,MAAO,IAAIE,EAAe,cAAc,EACxC,OAAQF,EAAmB,KAC7B,CACF,EAEAD,EACEU,EACAC,EACAb,EAAgC,EAChC,CACE,OAAQU,EACR,QAASC,CACX,CACF,CACF,CAAC,CAAC,CACN,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["CommandResultFactory", "GLOBAL_ERRORS", "GlobalCommandError", "BTC_APP", "CUSTOM_LOCK_SCREEN_APP", "DOGECOIN_APP", "ETH_APP", "SOLANA_APP", "makeDeviceActionInternalApiMock", "setupGoToDashboardMock", "testDeviceActionStates", "DeviceActionStatus", "UserInteractionRequired", "UnknownDAError", "goToDashboardDAStateStep", "ListAppsDeviceAction", "listAppsDAStateStep", "sendCommandMock", "resolve", "reject", "listAppsDeviceAction", "expectedStates", "globalError"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
4
|
-
"sourcesContent": [],
|
|
5
|
-
"mappings": "",
|
|
6
|
-
"names": []
|
|
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 const listAppsDAStateStep = Object.freeze({\n GO_TO_DASHBOARD: \"os.listApps.steps.goToDashboard\",\n LIST_APPS: \"os.listApps.steps.listApps\",\n} as const);\n\nexport type ListAppsDAStateStep =\n (typeof listAppsDAStateStep)[keyof typeof listAppsDAStateStep];\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 readonly step: ListAppsDAStateStep;\n };\n\nexport type ListAppsDAState = DeviceActionState<\n ListAppsDAOutput,\n ListAppsDAError,\n ListAppsDAIntermediateValue\n>;\n"],
|
|
5
|
+
"mappings": "AAcO,MAAMA,EAAsB,OAAO,OAAO,CAC/C,gBAAiB,kCACjB,UAAW,4BACb,CAAU",
|
|
6
|
+
"names": ["listAppsDAStateStep"]
|
|
7
7
|
}
|
package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Left as d,Right as
|
|
1
|
+
import{Left as d,Right as M}from"purify-ts";import{assign as n,fromCallback as D,fromPromise as y,setup as m}from"xstate";import{UserInteractionRequired as u}from"../../../device-action/model/UserInteractionRequired";import{DEFAULT_UNLOCK_TIMEOUT_MS as L}from"../../../device-action/os/Const";import{ListAppsDeviceAction as v}from"../../../device-action/os/ListApps/ListAppsDeviceAction";import{XStateDeviceAction as g}from"../../../device-action/xstate-utils/XStateDeviceAction";import{listAppsWithMetadataDAStateStep as A}from"./types";class F extends g{makeStateMachine(a){const{getAppsByHash:c,setDeviceSessionState:i,getDeviceSessionState:r}=this.extractDependencies(a),s=this.input.unlockTimeout??L,p=new v({input:{unlockTimeout:s}}).makeStateMachine(a);return m({types:{input:{unlockTimeout:s},context:{},output:{}},actors:{listApps:p,getAppsByHash:y(c),updateDeviceSessionState:D(({input:t,sendBack:e})=>{const{appsWithMetadata:h}=t,S=h.filter(o=>o!==null),l={...r(),installedApps:S};try{i(l),e({type:"done"})}catch(o){e({type:"error",error:o})}})},guards:{hasError:({context:t})=>t._internalState.error!==null,hasNoAppsInstalled:({context:t})=>t._internalState.apps.length===0},actions:{assignErrorFromEvent:n({_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.None,step:A.LIST_APPS}}),states:{DeviceReady:{always:{target:"ListApps"}},ListApps:{invoke:{id:"listApps",src:"listApps",input:t=>({unlockTimeout:t.context.input.unlockTimeout}),onSnapshot:{actions:n({intermediateValue:t=>t.event.snapshot.context.intermediateValue})},onDone:{target:"ListAppsCheck",actions:n({intermediateValue:t=>({requiredUserInteraction:u.None,step:A.LIST_APPS}),_internalState:t=>t.event.output.caseOf({Right:e=>({...t.context._internalState,apps:e}),Left:e=>({...t.context._internalState,error:e})})})}}},ListAppsCheck:{always:[{target:"Error",guard:"hasError"},{target:"Success",guard:"hasNoAppsInstalled",actions:n({_internalState:t=>({...t.context._internalState,appsWithMetadata:[]})})},{target:"FetchMetadata"}]},FetchMetadata:{invoke:{id:"getAppsByHash",src:"getAppsByHash",input:t=>t.context._internalState.apps,onDone:{target:"FetchMetadataCheck",actions:n({_internalState:t=>t.event.output.caseOf({Right:e=>({...t.context._internalState,appsWithMetadata:e}),Left:e=>({...t.context._internalState,error:e})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},FetchMetadataCheck:{always:[{target:"Error",guard:"hasError"},{target:"SaveSession"}]},SaveSession:{invoke:{src:"updateDeviceSessionState",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?d(t.context._internalState.error):M(t.context._internalState.appsWithMetadata)})}extractDependencies(a){return{getAppsByHash:({input:i})=>{const r=i.reduce((s,p)=>p.appFullHash?s.concat(p.appFullHash):s,[]);return a.getManagerApiService().getAppsByHash(r)},getDeviceSessionState:()=>a.getDeviceSessionState(),setDeviceSessionState:i=>a.setDeviceSessionState(i)}}}export{F as ListAppsWithMetadataDeviceAction};
|
|
2
2
|
//# sourceMappingURL=ListAppsWithMetadataDeviceAction.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 Application } from \"@internal/manager-api/model/Application\";\nimport { type HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\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 setDeviceSessionState: (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, setDeviceSessionState, 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 updateDeviceSessionState: 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 setDeviceSessionState(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+TceOANCEmILAJjMBKwsHOyMjAzN7SIBfGK80TFx8IlIKaloGZjYOLi0BROw8WGkIfjABVD4mHgBrCoAbdCL8BWUkEDUNbn4dfQQAVg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BAyly3OG3zadK-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: \"updateDeviceSessionState\",\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 const getAppsByHash = ({ input }: { input: ListAppsDAOutput }) => {\n const appHashes = input.reduce<string[]>((acc, app) => {\n if (app.appFullHash) {\n return acc.concat(app.appFullHash);\n }\n return acc;\n }, []);\n return internalApi.getManagerApiService().getAppsByHash(appHashes);\n };\n return {\n getAppsByHash,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAA2B,QAAAA,EAAM,SAAAC,MAAa,YAC9C,OAEE,UAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,SAAAC,MACK,SAIP,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,6BAAAC,MAAiC,8BAC1C,OAAS,wBAAAC,MAA4B,sDAGrC,OAEE,sBAAAC,MACK,
|
|
6
|
-
"names": ["Left", "Right", "assign", "fromCallback", "fromPromise", "setup", "UserInteractionRequired", "DEFAULT_UNLOCK_TIMEOUT_MS", "ListAppsDeviceAction", "XStateDeviceAction", "ListAppsWithMetadataDeviceAction", "internalAPI", "getAppsByHash", "setDeviceSessionState", "getDeviceSessionState", "unlockTimeout", "listAppsMachine", "input", "sendBack", "appsWithMetadata", "filterted", "app", "updatedState", "error", "context", "_", "apps", "internalApi", "appHashes", "acc", "state"]
|
|
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 Application } from \"@internal/manager-api/model/Application\";\nimport { type HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\n\nimport {\n type ListAppsWithMetadataDAError,\n type ListAppsWithMetadataDAInput,\n type ListAppsWithMetadataDAIntermediateValue,\n type ListAppsWithMetadataDAOutput,\n listAppsWithMetadataDAStateStep,\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 setDeviceSessionState: (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, setDeviceSessionState, 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 updateDeviceSessionState: 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 setDeviceSessionState(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 step: listAppsWithMetadataDAStateStep.LIST_APPS,\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 step: listAppsWithMetadataDAStateStep.LIST_APPS,\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: \"updateDeviceSessionState\",\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 const getAppsByHash = ({ input }: { input: ListAppsDAOutput }) => {\n const appHashes = input.reduce<string[]>((acc, app) => {\n if (app.appFullHash) {\n return acc.concat(app.appFullHash);\n }\n return acc;\n }, []);\n return internalApi.getManagerApiService().getAppsByHash(appHashes);\n };\n return {\n getAppsByHash,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAA2B,QAAAA,EAAM,SAAA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AAO,OAAO,CAC3B,MAAQN,IAAsB,CAC5B,GAAGM,EAAE,QAAQ,eACb,iBAAAN,CACF,GACA,KAAOI,IAAW,CAChB,GAAGE,EAAE,QAAQ,eACb,MAAAF,CACF,EACF,CAAC,CAEL,CAAC,CACH,EACA,QAAS,CACP,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,mBAAoB,CAClB,OAAQ,CACN,CACE,OAAQ,QACR,MAAO,UACT,EACA,CACE,OAAQ,aACV,CACF,CACF,EACA,YAAa,CACX,OAAQ,CACN,IAAK,2BACL,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,MACpB1B,EAAK0B,EAAE,QAAQ,eAAe,KAAK,EAGrCzB,EAAMyB,EAAE,QAAQ,eAAe,gBAAgB,CAE1D,CAAC,CACH,CAEA,oBAAoBE,EAA+C,CAUjE,MAAO,CACL,cAVoB,CAAC,CAAE,MAAAV,CAAM,IAAmC,CAChE,MAAMW,EAAYX,EAAM,OAAiB,CAACY,EAAKR,IACzCA,EAAI,YACCQ,EAAI,OAAOR,EAAI,WAAW,EAE5BQ,EACN,CAAC,CAAC,EACL,OAAOF,EAAY,qBAAqB,EAAE,cAAcC,CAAS,CACnE,EAGE,sBAAuB,IAAMD,EAAY,sBAAsB,EAC/D,sBAAwBG,GACtBH,EAAY,sBAAsBG,CAAK,CAC3C,CACF,CACF",
|
|
6
|
+
"names": ["Left", "Right", "assign", "fromCallback", "fromPromise", "setup", "UserInteractionRequired", "DEFAULT_UNLOCK_TIMEOUT_MS", "ListAppsDeviceAction", "XStateDeviceAction", "listAppsWithMetadataDAStateStep", "ListAppsWithMetadataDeviceAction", "internalAPI", "getAppsByHash", "setDeviceSessionState", "getDeviceSessionState", "unlockTimeout", "listAppsMachine", "input", "sendBack", "appsWithMetadata", "filterted", "app", "updatedState", "error", "context", "_", "apps", "internalApi", "appHashes", "acc", "state"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Left as M,Right as
|
|
1
|
+
import{Left as M,Right as P}from"purify-ts";import{DeviceStatus as T}from"../../../device/DeviceStatus";import{BTC_APP as S,BTC_APP_METADATA as A,CUSTOM_LOCK_SCREEN_APP as V,CUSTOM_LOCK_SCREEN_APP_METADATA as L,ETH_APP as _,ETH_APP_METADATA as g}from"../../../device-action/__test-utils__/data";import{makeDeviceActionInternalApiMock as o}from"../../../device-action/__test-utils__/makeInternalApi";import{setupListAppsMock as p}from"../../../device-action/__test-utils__/setupTestMachine";import{testDeviceActionStates as c}from"../../../device-action/__test-utils__/testDeviceActionStates";import{DeviceActionStatus as e}from"../../../device-action/model/DeviceActionState";import{UserInteractionRequired as t}from"../../../device-action/model/UserInteractionRequired";import{UnknownDAError as m}from"../../../device-action/os/Errors";import{listAppsDAStateStep as d}from"../../../device-action/os/ListApps/types";import{DeviceSessionStateType as f}from"../../../device-session/DeviceSessionState";import{HttpFetchApiError as k}from"../../../../internal/manager-api/model/Errors";import{ListAppsWithMetadataDeviceAction as u}from"./ListAppsWithMetadataDeviceAction";import{listAppsWithMetadataDAStateStep as i}from"./types";vi.mock("@api/device-action/os/ListApps/ListAppsDeviceAction");describe("ListAppsWithMetadataDeviceAction",()=>{const{getManagerApiService:l}=o(),v=vi.fn(),h=vi.fn(),I=vi.fn();function w(){return{getAppsByHash:I,getDeviceSessionState:h,setDeviceSessionState:v}}beforeEach(()=>{vi.resetAllMocks()}),describe("success case",()=>{it("should run the device actions with no apps installed",()=>new Promise((r,a)=>{p([]);const s=new u({input:{}});l.mockReturnValue({getAppsByHash:vi.fn().mockResolvedValue(P([]))});const n=[{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:d.LIST_APPS},status:e.Pending},{status:e.Completed,output:[]}];c(s,n,o(),{onDone:r,onError:a})})),it("should run the device actions with 1 app installed",()=>new Promise((r,a)=>{p([S]);const s=new u({input:{}});l.mockReturnValue({getAppsByHash:vi.fn().mockResolvedValue(P([A]))});const n=[{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:d.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{status:e.Completed,output:[A]}];c(s,n,o(),{onDone:r,onError:a})})),it("should run the device actions with 2 apps installed",()=>new Promise((r,a)=>{p([S,_]);const s=new u({input:{}});l.mockReturnValue({getAppsByHash:vi.fn().mockResolvedValue(P([A,g]))});const n=[{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:d.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{status:e.Completed,output:[A,g]}];c(s,n,o(),{onDone:r,onError:a})})),it("should run the device actions with 1 app installed and a custom lock screen",()=>new Promise((r,a)=>{p([S,V]);const s=new u({input:{}});l.mockReturnValue({getAppsByHash:vi.fn().mockResolvedValue(P([A,L]))});const n=[{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:d.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{status:e.Completed,output:[A,L]}];c(s,n,o(),{onDone:r,onError:a})}))}),describe("error case",()=>{it("should error when ListApps fails",()=>new Promise((r,a)=>{p([],!0);const s=new u({input:{}}),n=[{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:d.LIST_APPS},status:e.Pending},{status:e.Error,error:new m("ListApps failed")}];c(s,n,o(),{onDone:r,onError:a})})),it("should error when getAppsByHash rejects",()=>new Promise((r,a)=>{p([S]);const s=new u({input:{}});l.mockReturnValue({getAppsByHash:vi.fn().mockRejectedValue(new m("getAppsByHash failed"))});const n=[{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:d.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{status:e.Error,error:new m("getAppsByHash failed")}];c(s,n,o(),{onDone:r,onError:a})})),it("should error when getAppsByHash fails but error is known",()=>new Promise((r,a)=>{p([S]);const s=new u({input:{}}),n=new k(new Error("Failed to fetch data"));l.mockReturnValue({getAppsByHash:vi.fn().mockResolvedValue(M(n))});const D=[{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:d.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{status:e.Error,error:n}];c(s,D,o(),{onDone:r,onError:a})})),it("should error when SaveSession fails",()=>new Promise((r,a)=>{p([S]);const s=new u({input:{}});I.mockImplementation(async()=>Promise.resolve(P([A]))),vi.spyOn(s,"extractDependencies").mockReturnValue(w()),h.mockReturnValue({sessionStateType:f.ReadyWithoutSecureChannel,deviceStatus:T.CONNECTED,currentApp:"BOLOS",installedApps:[]}),v.mockImplementation(()=>{throw new m("SaveSession failed")});const n=[{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.AllowListApps,step:d.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None,step:i.LIST_APPS},status:e.Pending},{status:e.Error,error:new m("SaveSession failed")}];c(s,n,o(),{onDone:r,onError:a})}))})});
|
|
2
2
|
//# sourceMappingURL=ListAppsWithMetadataDeviceAction.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport {\n BTC_APP,\n BTC_APP_METADATA,\n CUSTOM_LOCK_SCREEN_APP,\n CUSTOM_LOCK_SCREEN_APP_METADATA,\n ETH_APP,\n ETH_APP_METADATA,\n} from \"@api/device-action/__test-utils__/data\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { setupListAppsMock } 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 { HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\n\nimport { ListAppsWithMetadataDeviceAction } from \"./ListAppsWithMetadataDeviceAction\";\nimport { type ListAppsWithMetadataDAState } from \"./types\";\n\nvi.mock(\"@api/device-action/os/ListApps/ListAppsDeviceAction\");\n\ndescribe(\"ListAppsWithMetadataDeviceAction\", () => {\n const { getManagerApiService: getManagerApiServiceMock } =\n makeDeviceActionInternalApiMock();\n\n const setDeviceSessionStateMock = vi.fn();\n const getDeviceSessionStateMock = vi.fn();\n const getAppsByHashMock = vi.fn();\n\n function extractDependenciesMock() {\n return {\n getAppsByHash: getAppsByHashMock,\n getDeviceSessionState: getDeviceSessionStateMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n };\n }\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"success case\", () => {\n it(\"should run the device actions with no apps installed\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n getManagerApiServiceMock.mockReturnValue({\n getAppsByHash: vi.fn().mockResolvedValue(Right([])),\n } as unknown as ManagerApiService);\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n status: DeviceActionStatus.Completed,\n output: [],\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device actions with 1 app installed\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([BTC_APP]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n getManagerApiServiceMock.mockReturnValue({\n getAppsByHash: vi.fn().mockResolvedValue(Right([BTC_APP_METADATA])),\n } as unknown as ManagerApiService);\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // FetchMetadata\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // SaveSession\n },\n {\n status: DeviceActionStatus.Completed,\n output: [BTC_APP_METADATA],\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device actions with 2 apps installed\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([BTC_APP, ETH_APP]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n getManagerApiServiceMock.mockReturnValue({\n getAppsByHash: vi\n .fn()\n .mockResolvedValue(Right([BTC_APP_METADATA, ETH_APP_METADATA])),\n } as unknown as ManagerApiService);\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // FetchMetadata\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // SaveSession\n },\n {\n status: DeviceActionStatus.Completed,\n output: [BTC_APP_METADATA, ETH_APP_METADATA],\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device actions with 1 app installed and a custom lock screen\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([BTC_APP, CUSTOM_LOCK_SCREEN_APP]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n getManagerApiServiceMock.mockReturnValue({\n getAppsByHash: vi\n .fn()\n .mockResolvedValue(\n Right([BTC_APP_METADATA, CUSTOM_LOCK_SCREEN_APP_METADATA]),\n ),\n } as unknown as ManagerApiService);\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // FetchMetadata\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // SaveSession\n },\n {\n status: DeviceActionStatus.Completed,\n output: [BTC_APP_METADATA, CUSTOM_LOCK_SCREEN_APP_METADATA],\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n\n describe(\"error case\", () => {\n it(\"should error when ListApps fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([], true);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"ListApps failed\"),\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should error when getAppsByHash rejects\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([BTC_APP]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n getManagerApiServiceMock.mockReturnValue({\n getAppsByHash: vi\n .fn()\n .mockRejectedValue(new UnknownDAError(\"getAppsByHash failed\")),\n } as unknown as ManagerApiService);\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // FetchMetadata\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"getAppsByHash failed\"),\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should error when getAppsByHash fails but error is known\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([BTC_APP]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n const error = new HttpFetchApiError(new Error(\"Failed to fetch data\"));\n\n getManagerApiServiceMock.mockReturnValue({\n getAppsByHash: vi.fn().mockResolvedValue(Left(error)),\n } as unknown as ManagerApiService);\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // FetchMetadata\n },\n {\n status: DeviceActionStatus.Error,\n error,\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should error when SaveSession fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([BTC_APP]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n getAppsByHashMock.mockImplementation(async () =>\n Promise.resolve(Right([BTC_APP_METADATA])),\n );\n\n vi.spyOn(\n listAppsWithMetadataDeviceAction,\n \"extractDependencies\",\n ).mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: \"BOLOS\",\n installedApps: [],\n });\n\n setDeviceSessionStateMock.mockImplementation(() => {\n throw new UnknownDAError(\"SaveSession failed\");\n });\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // FetchMetadata\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // SaveSession\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"SaveSession failed\"),\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAE5B,OAAS,gBAAAC,MAAoB,2BAC7B,OACE,WAAAC,EACA,oBAAAC,EACA,0BAAAC,EACA,mCAAAC,EACA,WAAAC,EACA,oBAAAC,MACK,yCACP,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,qBAAAC,MAAyB,qDAClC,OAAS,0BAAAC,MAA8B,2DACvC,OAAS,sBAAAC,MAA0B,6CACnC,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,kBAAAC,MAAsB,+BAC/B,OAAS,0BAAAC,MAA8B,yCACvC,OAAS,qBAAAC,MAAyB,qCAGlC,OAAS,oCAAAC,MAAwC,
|
|
6
|
-
"names": ["Left", "Right", "DeviceStatus", "BTC_APP", "BTC_APP_METADATA", "CUSTOM_LOCK_SCREEN_APP", "CUSTOM_LOCK_SCREEN_APP_METADATA", "ETH_APP", "ETH_APP_METADATA", "makeDeviceActionInternalApiMock", "setupListAppsMock", "testDeviceActionStates", "DeviceActionStatus", "UserInteractionRequired", "UnknownDAError", "DeviceSessionStateType", "HttpFetchApiError", "ListAppsWithMetadataDeviceAction", "getManagerApiServiceMock", "setDeviceSessionStateMock", "getDeviceSessionStateMock", "getAppsByHashMock", "extractDependenciesMock", "resolve", "reject", "listAppsWithMetadataDeviceAction", "expectedStates", "error"]
|
|
4
|
+
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport {\n BTC_APP,\n BTC_APP_METADATA,\n CUSTOM_LOCK_SCREEN_APP,\n CUSTOM_LOCK_SCREEN_APP_METADATA,\n ETH_APP,\n ETH_APP_METADATA,\n} from \"@api/device-action/__test-utils__/data\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { setupListAppsMock } 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 { listAppsDAStateStep } from \"@api/device-action/os/ListApps/types\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport { HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\n\nimport { ListAppsWithMetadataDeviceAction } from \"./ListAppsWithMetadataDeviceAction\";\nimport {\n type ListAppsWithMetadataDAState,\n listAppsWithMetadataDAStateStep,\n} from \"./types\";\n\nvi.mock(\"@api/device-action/os/ListApps/ListAppsDeviceAction\");\n\ndescribe(\"ListAppsWithMetadataDeviceAction\", () => {\n const { getManagerApiService: getManagerApiServiceMock } =\n makeDeviceActionInternalApiMock();\n\n const setDeviceSessionStateMock = vi.fn();\n const getDeviceSessionStateMock = vi.fn();\n const getAppsByHashMock = vi.fn();\n\n function extractDependenciesMock() {\n return {\n getAppsByHash: getAppsByHashMock,\n getDeviceSessionState: getDeviceSessionStateMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n };\n }\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"success case\", () => {\n it(\"should run the device actions with no apps installed\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n getManagerApiServiceMock.mockReturnValue({\n getAppsByHash: vi.fn().mockResolvedValue(Right([])),\n } as unknown as ManagerApiService);\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n status: DeviceActionStatus.Completed,\n output: [],\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device actions with 1 app installed\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([BTC_APP]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n getManagerApiServiceMock.mockReturnValue({\n getAppsByHash: vi.fn().mockResolvedValue(Right([BTC_APP_METADATA])),\n } as unknown as ManagerApiService);\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // FetchMetadata\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // SaveSession\n },\n {\n status: DeviceActionStatus.Completed,\n output: [BTC_APP_METADATA],\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device actions with 2 apps installed\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([BTC_APP, ETH_APP]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n getManagerApiServiceMock.mockReturnValue({\n getAppsByHash: vi\n .fn()\n .mockResolvedValue(Right([BTC_APP_METADATA, ETH_APP_METADATA])),\n } as unknown as ManagerApiService);\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // FetchMetadata\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // SaveSession\n },\n {\n status: DeviceActionStatus.Completed,\n output: [BTC_APP_METADATA, ETH_APP_METADATA],\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should run the device actions with 1 app installed and a custom lock screen\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([BTC_APP, CUSTOM_LOCK_SCREEN_APP]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n getManagerApiServiceMock.mockReturnValue({\n getAppsByHash: vi\n .fn()\n .mockResolvedValue(\n Right([BTC_APP_METADATA, CUSTOM_LOCK_SCREEN_APP_METADATA]),\n ),\n } as unknown as ManagerApiService);\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // FetchMetadata\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // SaveSession\n },\n {\n status: DeviceActionStatus.Completed,\n output: [BTC_APP_METADATA, CUSTOM_LOCK_SCREEN_APP_METADATA],\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n\n describe(\"error case\", () => {\n it(\"should error when ListApps fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([], true);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"ListApps failed\"),\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should error when getAppsByHash rejects\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([BTC_APP]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n getManagerApiServiceMock.mockReturnValue({\n getAppsByHash: vi\n .fn()\n .mockRejectedValue(new UnknownDAError(\"getAppsByHash failed\")),\n } as unknown as ManagerApiService);\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // FetchMetadata\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"getAppsByHash failed\"),\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should error when getAppsByHash fails but error is known\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([BTC_APP]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n const error = new HttpFetchApiError(new Error(\"Failed to fetch data\"));\n\n getManagerApiServiceMock.mockReturnValue({\n getAppsByHash: vi.fn().mockResolvedValue(Left(error)),\n } as unknown as ManagerApiService);\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // FetchMetadata\n },\n {\n status: DeviceActionStatus.Error,\n error,\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should error when SaveSession fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupListAppsMock([BTC_APP]);\n const listAppsWithMetadataDeviceAction =\n new ListAppsWithMetadataDeviceAction({\n input: {},\n });\n\n getAppsByHashMock.mockImplementation(async () =>\n Promise.resolve(Right([BTC_APP_METADATA])),\n );\n\n vi.spyOn(\n listAppsWithMetadataDeviceAction,\n \"extractDependencies\",\n ).mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: \"BOLOS\",\n installedApps: [],\n });\n\n setDeviceSessionStateMock.mockImplementation(() => {\n throw new UnknownDAError(\"SaveSession failed\");\n });\n\n const expectedStates: Array<ListAppsWithMetadataDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // Ready\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // ListAppsDeviceAction\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // FetchMetadata\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: listAppsWithMetadataDAStateStep.LIST_APPS,\n },\n status: DeviceActionStatus.Pending, // SaveSession\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"SaveSession failed\"),\n },\n ];\n\n testDeviceActionStates(\n listAppsWithMetadataDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAE5B,OAAS,gBAAAC,MAAoB,2BAC7B,OACE,WAAAC,EACA,oBAAAC,EACA,0BAAAC,EACA,mCAAAC,EACA,WAAAC,EACA,oBAAAC,MACK,yCACP,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,qBAAAC,MAAyB,qDAClC,OAAS,0BAAAC,MAA8B,2DACvC,OAAS,sBAAAC,MAA0B,6CACnC,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,kBAAAC,MAAsB,+BAC/B,OAAS,uBAAAC,MAA2B,uCACpC,OAAS,0BAAAC,MAA8B,yCACvC,OAAS,qBAAAC,MAAyB,qCAGlC,OAAS,oCAAAC,MAAwC,qCACjD,OAEE,mCAAAC,MACK,UAEP,GAAG,KAAK,qDAAqD,EAE7D,SAAS,mCAAoC,IAAM,CACjD,KAAM,CAAE,qBAAsBC,CAAyB,EACrDX,EAAgC,EAE5BY,EAA4B,GAAG,GAAG,EAClCC,EAA4B,GAAG,GAAG,EAClCC,EAAoB,GAAG,GAAG,EAEhC,SAASC,GAA0B,CACjC,MAAO,CACL,cAAeD,EACf,sBAAuBD,EACvB,sBAAuBD,CACzB,CACF,CAEA,WAAW,IAAM,CACf,GAA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AAgC,EAChC,CACE,OAAQgB,EACR,QAASC,CACX,CACF,CACF,CAAC,CAAC,CACN,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["Left", "Right", "DeviceStatus", "BTC_APP", "BTC_APP_METADATA", "CUSTOM_LOCK_SCREEN_APP", "CUSTOM_LOCK_SCREEN_APP_METADATA", "ETH_APP", "ETH_APP_METADATA", "makeDeviceActionInternalApiMock", "setupListAppsMock", "testDeviceActionStates", "DeviceActionStatus", "UserInteractionRequired", "UnknownDAError", "listAppsDAStateStep", "DeviceSessionStateType", "HttpFetchApiError", "ListAppsWithMetadataDeviceAction", "listAppsWithMetadataDAStateStep", "getManagerApiServiceMock", "setDeviceSessionStateMock", "getDeviceSessionStateMock", "getAppsByHashMock", "extractDependenciesMock", "resolve", "reject", "listAppsWithMetadataDeviceAction", "expectedStates", "error"]
|
|
7
7
|
}
|