@ledgerhq/device-management-kit 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/package.json +1 -2
- package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKit.test.js.map +2 -2
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
- package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
- package/lib/cjs/src/api/command/di/commandModule.js +1 -1
- package/lib/cjs/src/api/command/di/commandModule.js.map +3 -3
- package/lib/cjs/src/api/command/di/commandModule.test.js +1 -1
- package/lib/cjs/src/api/command/di/commandModule.test.js.map +2 -2
- package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
- package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
- package/lib/cjs/src/api/command/utils/CommandUtils.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.js.map +2 -2
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js.map +2 -2
- package/lib/cjs/src/api/command/utils/GlobalCommandError.js +1 -1
- package/lib/cjs/src/api/command/utils/GlobalCommandError.js.map +2 -2
- package/lib/cjs/src/api/device/DeviceModel.js +1 -1
- package/lib/cjs/src/api/device/DeviceModel.js.map +2 -2
- package/lib/cjs/src/api/device-action/di/deviceActionModule.js +1 -1
- package/lib/cjs/src/api/device-action/di/deviceActionModule.js.map +3 -3
- package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js +1 -1
- package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/Errors.js +1 -1
- package/lib/cjs/src/api/device-action/os/Errors.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +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/types.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/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/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +1 -1
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +1 -1
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +2 -2
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +1 -1
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +2 -2
- package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
- package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
- package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.js +1 -1
- package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.js.map +2 -2
- package/lib/cjs/src/api/device-model/model/DeviceModel.js +1 -1
- package/lib/cjs/src/api/device-model/model/DeviceModel.js.map +2 -2
- package/lib/cjs/src/api/index.js +1 -1
- package/lib/cjs/src/api/index.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/task/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/types.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/utils.js +1 -1
- package/lib/cjs/src/api/secure-channel/utils.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/utils.test.js +1 -1
- package/lib/cjs/src/api/secure-channel/utils.test.js.map +3 -3
- package/lib/cjs/src/api/transport/model/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 +2 -0
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
- 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/utils/AppName.js +2 -0
- package/lib/cjs/src/api/utils/AppName.js.map +7 -0
- package/lib/cjs/src/api/utils/AppName.test.js +2 -0
- package/lib/cjs/src/api/utils/AppName.test.js.map +7 -0
- package/lib/cjs/src/di.js +1 -1
- package/lib/cjs/src/di.js.map +2 -2
- package/lib/cjs/src/internal/config/di/configModule.js +1 -1
- package/lib/cjs/src/internal/config/di/configModule.js.map +3 -3
- package/lib/cjs/src/internal/config/di/configModule.test.js +1 -1
- package/lib/cjs/src/internal/config/di/configModule.test.js.map +2 -2
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.js +1 -1
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.js.map +3 -3
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js +1 -1
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
- package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
- package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
- package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
- package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js +1 -1
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +1 -1
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
- package/lib/cjs/src/internal/secure-channel/model/Errors.js +1 -1
- package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +3 -3
- package/lib/cjs/src/internal/send/di/sendModule.js +1 -1
- package/lib/cjs/src/internal/send/di/sendModule.js.map +3 -3
- package/lib/cjs/src/internal/send/di/sendModule.test.js +1 -1
- package/lib/cjs/src/internal/send/di/sendModule.test.js.map +2 -2
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js +1 -1
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
- package/lib/cjs/src/internal/transport/di/transportModule.js +1 -1
- package/lib/cjs/src/internal/transport/di/transportModule.js.map +3 -3
- package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
- package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
- package/lib/esm/package.json +1 -2
- package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
- package/lib/esm/src/api/DeviceManagementKit.test.js.map +2 -2
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
- package/lib/esm/src/api/apdu/utils/ByteArrayParser.js +1 -1
- package/lib/esm/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
- package/lib/esm/src/api/command/di/commandModule.js +1 -1
- package/lib/esm/src/api/command/di/commandModule.js.map +3 -3
- package/lib/esm/src/api/command/di/commandModule.test.js +1 -1
- package/lib/esm/src/api/command/di/commandModule.test.js.map +2 -2
- package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
- package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
- package/lib/esm/src/api/command/utils/CommandUtils.js +1 -1
- package/lib/esm/src/api/command/utils/CommandUtils.js.map +3 -3
- package/lib/esm/src/api/command/utils/CommandUtils.test.js +1 -1
- package/lib/esm/src/api/command/utils/CommandUtils.test.js.map +2 -2
- package/lib/esm/src/api/command/utils/GlobalCommandError.js +1 -1
- package/lib/esm/src/api/command/utils/GlobalCommandError.js.map +2 -2
- package/lib/esm/src/api/device/DeviceModel.js +1 -1
- package/lib/esm/src/api/device/DeviceModel.js.map +2 -2
- package/lib/esm/src/api/device-action/di/deviceActionModule.js +1 -1
- package/lib/esm/src/api/device-action/di/deviceActionModule.js.map +3 -3
- package/lib/esm/src/api/device-action/di/deviceActionModule.test.js +1 -1
- package/lib/esm/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/Errors.js +1 -1
- package/lib/esm/src/api/device-action/os/Errors.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js +1 -1
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +3 -3
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +1 -1
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +3 -3
- package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
- package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
- package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.js +1 -1
- package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.js.map +2 -2
- package/lib/esm/src/api/device-model/model/DeviceModel.js +1 -1
- package/lib/esm/src/api/device-model/model/DeviceModel.js.map +2 -2
- package/lib/esm/src/api/index.js +1 -1
- package/lib/esm/src/api/index.js.map +3 -3
- package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +2 -2
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
- package/lib/esm/src/api/secure-channel/task/types.js +1 -1
- package/lib/esm/src/api/secure-channel/task/types.js.map +2 -2
- package/lib/esm/src/api/secure-channel/utils.js +1 -1
- package/lib/esm/src/api/secure-channel/utils.js.map +3 -3
- package/lib/esm/src/api/secure-channel/utils.test.js +1 -1
- package/lib/esm/src/api/secure-channel/utils.test.js.map +3 -3
- package/lib/esm/src/api/transport/model/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 +2 -0
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
- package/lib/esm/src/api/transport/model/Errors.js +1 -1
- package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
- package/lib/esm/src/api/utils/AppName.js +2 -0
- package/lib/esm/src/api/utils/AppName.js.map +7 -0
- package/lib/esm/src/api/utils/AppName.test.js +2 -0
- package/lib/esm/src/api/utils/AppName.test.js.map +7 -0
- package/lib/esm/src/di.js +1 -1
- package/lib/esm/src/di.js.map +2 -2
- package/lib/esm/src/internal/config/di/configModule.js +1 -1
- package/lib/esm/src/internal/config/di/configModule.js.map +3 -3
- package/lib/esm/src/internal/config/di/configModule.test.js +1 -1
- package/lib/esm/src/internal/config/di/configModule.test.js.map +2 -2
- package/lib/esm/src/internal/device-model/di/deviceModelModule.js +1 -1
- package/lib/esm/src/internal/device-model/di/deviceModelModule.js.map +3 -3
- package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js +1 -1
- package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
- package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
- package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
- package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
- package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.js +1 -1
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
- package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
- package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
- package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
- package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +1 -1
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
- package/lib/esm/src/internal/secure-channel/model/Errors.js +1 -1
- package/lib/esm/src/internal/secure-channel/model/Errors.js.map +3 -3
- package/lib/esm/src/internal/send/di/sendModule.js +1 -1
- package/lib/esm/src/internal/send/di/sendModule.js.map +3 -3
- package/lib/esm/src/internal/send/di/sendModule.test.js +1 -1
- package/lib/esm/src/internal/send/di/sendModule.test.js.map +2 -2
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.js +1 -1
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
- package/lib/esm/src/internal/transport/di/transportModule.js +1 -1
- package/lib/esm/src/internal/transport/di/transportModule.js.map +3 -3
- package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
- package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
- package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/ApduParser.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts +28 -0
- package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts +1 -0
- package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts.map +1 -1
- package/lib/types/src/api/command/di/commandModule.d.ts.map +1 -1
- package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/CommandErrors.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/CommandUtils.d.ts +3 -0
- package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/GlobalCommandError.d.ts +1 -1
- package/lib/types/src/api/command/utils/GlobalCommandError.d.ts.map +1 -1
- package/lib/types/src/api/device/DeviceModel.d.ts +2 -1
- package/lib/types/src/api/device/DeviceModel.d.ts.map +1 -1
- package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
- package/lib/types/src/api/device-action/di/deviceActionModule.d.ts.map +1 -1
- package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +1 -0
- package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +0 -1
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/Errors.d.ts +10 -0
- package/lib/types/src/api/device-action/os/Errors.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +2 -1
- 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/GoToDashboard/GoToDashboardDeviceAction.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 +3 -2
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/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 +0 -1
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +0 -1
- 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 +0 -1
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts +2 -2
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -1
- package/lib/types/src/api/device-model/data/StaticDeviceModelDataSource.d.ts.map +1 -1
- package/lib/types/src/api/device-model/model/DeviceModel.d.ts.map +1 -1
- package/lib/types/src/api/device-session/service/DefaultApduReceiverService.stub.d.ts.map +1 -1
- package/lib/types/src/api/device-session/service/DefaultApduSenderService.stub.d.ts.map +1 -1
- package/lib/types/src/api/index.d.ts +1 -1
- package/lib/types/src/api/index.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +5 -2
- package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/task/types.d.ts +6 -1
- package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/utils.d.ts +0 -11
- package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +8 -7
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts +2 -0
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts.map +1 -0
- package/lib/types/src/api/transport/model/Errors.d.ts +5 -0
- package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
- package/lib/types/src/api/utils/AppName.d.ts +2 -0
- package/lib/types/src/api/utils/AppName.d.ts.map +1 -0
- package/lib/types/src/api/utils/AppName.test.d.ts +2 -0
- package/lib/types/src/api/utils/AppName.test.d.ts.map +1 -0
- package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
- package/lib/types/src/di.d.ts.map +1 -1
- package/lib/types/src/internal/config/di/configModule.d.ts.map +1 -1
- package/lib/types/src/internal/device-model/di/deviceModelModule.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/di/discoveryModule.d.ts.map +1 -1
- package/lib/types/src/internal/logger-publisher/di/loggerModule.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/model/Errors.d.ts +22 -2
- package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -1
- package/lib/types/src/internal/send/di/sendModule.d.ts.map +1 -1
- package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts +5 -1
- package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/transport/di/transportModule.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +2 -3
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var t=require("../../device/DeviceModel"),a=require("../../device/DeviceStatus"),r=require("../../device-action/__test-utils__/makeInternalApi"),o=require("../../device-action/os/Errors"),i=require("../../device-session/DeviceSessionState"),s=require("./BuildAppsInstallPlanTask");describe("BuildAppsInstallPlanTask",()=>{const e=(0,r.makeDeviceActionInternalApiMock)();beforeEach(()=>{vi.clearAllMocks(),e.getDeviceModel.mockReturnValue({id:t.DeviceModelId.NANO_X})}),it("Success with no changes needed",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"}],catalog:{applications:[],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum"},{name:"Bitcoin"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[],alreadyInstalled:["Ethereum","Bitcoin"],missingApplications:[]})}),it("Success with no constraints",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"MyShitCoin",version:"0.0.1"},{versionName:"Cardano",version:"1.1.0"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum"},{name:"Solana"},{name:"Cardano"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Solana",version:"1.2.0"},{versionName:"Cardano",version:"1.1.0"}],alreadyInstalled:["Ethereum"],missingApplications:[]})}),it("Success with applicable constraints",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.2.0"},{versionName:"Solana",version:"1.1.0"},{versionName:"Cardano",version:"1.1.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"MyShitCoin",version:"0.0.1"},{versionName:"Cardano",version:"1.2.0"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"1.6.0",applicableModels:[t.DeviceModelId.NANO_X]}]},{name:"Bitcoin",constraints:[{minVersion:"1.2.1",exemptModels:[t.DeviceModelId.NANO_S]}]},{name:"Solana",constraints:[{minVersion:"1.2.0"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"}],alreadyInstalled:[],missingApplications:[]})}),it("Success with non-applicable constraints",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.2.0"},{versionName:"Solana",version:"1.1.0"},{versionName:"Cardano",version:"1.1.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"MyShitCoin",version:"0.0.1"},{versionName:"Cardano",version:"1.2.0"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"1.6.0",exemptModels:[t.DeviceModelId.NANO_X]}]},{name:"Bitcoin",constraints:[{minVersion:"1.2.1",applicableModels:[t.DeviceModelId.NANO_S]}]},{name:"Cardano",constraints:[{minVersion:"1.1.0"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[],alreadyInstalled:["Ethereum","Bitcoin","Cardano"],missingApplications:[]})}),it("Success with applicable constraints latest version",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.1.0"},{versionName:"MyShitCoin",version:"0.0.1"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"Cardano",version:"1.2.0"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"latest"}]},{name:"Bitcoin",constraints:[{minVersion:"latest"}]},{name:"MyShitCoin",constraints:[{minVersion:"latest"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Ethereum",version:"1.6.0"}],alreadyInstalled:["Bitcoin","MyShitCoin"],missingApplications:[]})}),it("Success with dependencies",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"AlreadyInstalledDep",version:"1.2.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0",parentName:void 0},{versionName:"Solana",version:"1.2.0",parentName:void 0},{versionName:"MyEthShitCoin",version:"0.0.1",parentName:"Ethereum"},{versionName:"MySolShitCoin",version:"0.0.1",parentName:"Solana"},{versionName:"MyPumpFunShitCoin",version:"0.0.1",parentName:"Solana"},{versionName:"Cardano",version:"1.2.0",parentName:void 0},{versionName:"AlreadyInstalledDep",version:"1.2.0",parentName:"Cardano"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"MyEthShitCoin"},{name:"MySolShitCoin"},{name:"Solana"},{name:"MyPumpFunShitCoin"},{name:"AlreadyInstalledDep"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Ethereum",version:"1.6.0",parentName:void 0},{versionName:"Solana",version:"1.2.0",parentName:void 0},{versionName:"MyEthShitCoin",version:"0.0.1",parentName:"Ethereum"},{versionName:"MySolShitCoin",version:"0.0.1",parentName:"Solana"},{versionName:"MyPumpFunShitCoin",version:"0.0.1",parentName:"Solana"}],alreadyInstalled:["AlreadyInstalledDep"],missingApplications:[]})}),it("Success with allowed missing applications",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum"},{name:"Solana"},{name:"Cardano"}],allowMissingApplication:!0}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Solana",version:"1.2.0"}],alreadyInstalled:["Ethereum"],missingApplications:["Cardano"]})}),it("Error when device is in incorrect state",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.Connected,deviceStatus:a.DeviceStatus.CONNECTED});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new o.UnknownDAError("Invalid device state")})}),it("Error when device session was not populated",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[]});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new o.UnknownDAError("Device apps metadata not fetched")})}),it("Error when an app is not found in the catalog",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[],catalog:{applications:[],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum"},{name:"Bitcoin"},{name:"Solana"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new o.UnknownDAError("Application Ethereum not found in the catalog")})}),it("Error when an app version is not found in the catalog",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[],catalog:{applications:[{versionName:"Ethereum",version:"1.5.0"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"1.6.0"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new o.UnsupportedFirmwareDAError("Application Ethereum not found in the catalog")})})});
|
2
2
|
//# sourceMappingURL=BuildAppsInstallPlanTask.test.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/device-action/task/BuildAppsInstallPlanTask.test.ts"],
|
4
|
-
"sourcesContent": ["import { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport type { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nimport type { DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport type { Application } from \"@internal/manager-api/model/Application\";\n\nimport { BuildAppsInstallPlanTask } from \"./BuildAppsInstallPlanTask\";\n\ndescribe(\"BuildAppsInstallPlanTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n vi.clearAllMocks();\n apiMock.getDeviceModel.mockReturnValue({\n id: DeviceModelId.NANO_X,\n } as unknown as TransportDeviceModel);\n });\n\n it(\"Success with no changes needed\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }, { name: \"Bitcoin\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [],\n alreadyInstalled: [\"Ethereum\", \"Bitcoin\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with no constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Solana\" },\n { name: \"Cardano\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ],\n alreadyInstalled: [\"Ethereum\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with applicable constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.2.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [\n { minVersion: \"1.6.0\", applicableModels: [DeviceModelId.NANO_X] },\n ],\n },\n {\n name: \"Bitcoin\",\n constraints: [\n { minVersion: \"1.2.1\", exemptModels: [DeviceModelId.NANO_S] },\n ],\n },\n { name: \"Solana\", constraints: [{ minVersion: \"1.2.0\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n ],\n alreadyInstalled: [],\n missingApplications: [],\n });\n });\n\n it(\"Success with non-applicable constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.2.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [\n { minVersion: \"1.6.0\", exemptModels: [DeviceModelId.NANO_X] },\n ],\n },\n {\n name: \"Bitcoin\",\n constraints: [\n { minVersion: \"1.2.1\", applicableModels: [DeviceModelId.NANO_S] },\n ],\n },\n { name: \"Cardano\", constraints: [{ minVersion: \"1.1.0\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [],\n alreadyInstalled: [\"Ethereum\", \"Bitcoin\", \"Cardano\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with applicable constraints latest version\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\", constraints: [{ minVersion: \"latest\" }] },\n { name: \"Bitcoin\", constraints: [{ minVersion: \"latest\" }] },\n { name: \"MyShitCoin\", constraints: [{ minVersion: \"latest\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [{ versionName: \"Ethereum\", version: \"1.6.0\" }],\n alreadyInstalled: [\"Bitcoin\", \"MyShitCoin\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with dependencies\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"AlreadyInstalledDep\", version: \"1.2.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\", parentName: undefined },\n { versionName: \"Solana\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"MyEthShitCoin\",\n version: \"0.0.1\",\n parentName: \"Ethereum\",\n },\n {\n versionName: \"MySolShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n {\n versionName: \"MyPumpFunShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n { versionName: \"Cardano\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"AlreadyInstalledDep\",\n version: \"1.2.0\",\n parentName: \"Cardano\",\n },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"MyEthShitCoin\" },\n { name: \"MySolShitCoin\" },\n { name: \"Solana\" },\n { name: \"MyPumpFunShitCoin\" },\n { name: \"AlreadyInstalledDep\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Ethereum\", version: \"1.6.0\", parentName: undefined },\n { versionName: \"Solana\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"MyEthShitCoin\",\n version: \"0.0.1\",\n parentName: \"Ethereum\",\n },\n {\n versionName: \"MySolShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n {\n versionName: \"MyPumpFunShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n ],\n alreadyInstalled: [\"AlreadyInstalledDep\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with allowed missing applications\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Solana\" },\n { name: \"Cardano\" },\n ],\n allowMissingApplication: true,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [{ versionName: \"Solana\", version: \"1.2.0\" }],\n alreadyInstalled: [\"Ethereum\"],\n missingApplications: [\"Cardano\"],\n });\n });\n\n it(\"Error when device is in incorrect state\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n } as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Invalid device state\"),\n });\n });\n\n it(\"Error when device session was not populated\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Device apps metadata not fetched\"),\n });\n });\n\n it(\"Error when an app is not found in the catalog\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [] as unknown as Application[],\n catalog: {\n applications: [] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Bitcoin\" },\n { name: \"Solana\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\n \"Application Ethereum not found in the catalog\",\n ),\n });\n });\n});\n"],
|
5
|
-
"mappings": "aAAA,IAAAA,EAA8B,mCAC9BC,EAA6B,oCAC7BC,EAAgD,6DAChDC,
|
4
|
+
"sourcesContent": ["import { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport {\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nimport type { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nimport type { DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport type { Application } from \"@internal/manager-api/model/Application\";\n\nimport { BuildAppsInstallPlanTask } from \"./BuildAppsInstallPlanTask\";\n\ndescribe(\"BuildAppsInstallPlanTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n vi.clearAllMocks();\n apiMock.getDeviceModel.mockReturnValue({\n id: DeviceModelId.NANO_X,\n } as unknown as TransportDeviceModel);\n });\n\n it(\"Success with no changes needed\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }, { name: \"Bitcoin\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [],\n alreadyInstalled: [\"Ethereum\", \"Bitcoin\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with no constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Solana\" },\n { name: \"Cardano\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ],\n alreadyInstalled: [\"Ethereum\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with applicable constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.2.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [\n { minVersion: \"1.6.0\", applicableModels: [DeviceModelId.NANO_X] },\n ],\n },\n {\n name: \"Bitcoin\",\n constraints: [\n { minVersion: \"1.2.1\", exemptModels: [DeviceModelId.NANO_S] },\n ],\n },\n { name: \"Solana\", constraints: [{ minVersion: \"1.2.0\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n ],\n alreadyInstalled: [],\n missingApplications: [],\n });\n });\n\n it(\"Success with non-applicable constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.2.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [\n { minVersion: \"1.6.0\", exemptModels: [DeviceModelId.NANO_X] },\n ],\n },\n {\n name: \"Bitcoin\",\n constraints: [\n { minVersion: \"1.2.1\", applicableModels: [DeviceModelId.NANO_S] },\n ],\n },\n { name: \"Cardano\", constraints: [{ minVersion: \"1.1.0\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [],\n alreadyInstalled: [\"Ethereum\", \"Bitcoin\", \"Cardano\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with applicable constraints latest version\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\", constraints: [{ minVersion: \"latest\" }] },\n { name: \"Bitcoin\", constraints: [{ minVersion: \"latest\" }] },\n { name: \"MyShitCoin\", constraints: [{ minVersion: \"latest\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [{ versionName: \"Ethereum\", version: \"1.6.0\" }],\n alreadyInstalled: [\"Bitcoin\", \"MyShitCoin\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with dependencies\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"AlreadyInstalledDep\", version: \"1.2.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\", parentName: undefined },\n { versionName: \"Solana\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"MyEthShitCoin\",\n version: \"0.0.1\",\n parentName: \"Ethereum\",\n },\n {\n versionName: \"MySolShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n {\n versionName: \"MyPumpFunShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n { versionName: \"Cardano\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"AlreadyInstalledDep\",\n version: \"1.2.0\",\n parentName: \"Cardano\",\n },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"MyEthShitCoin\" },\n { name: \"MySolShitCoin\" },\n { name: \"Solana\" },\n { name: \"MyPumpFunShitCoin\" },\n { name: \"AlreadyInstalledDep\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Ethereum\", version: \"1.6.0\", parentName: undefined },\n { versionName: \"Solana\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"MyEthShitCoin\",\n version: \"0.0.1\",\n parentName: \"Ethereum\",\n },\n {\n versionName: \"MySolShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n {\n versionName: \"MyPumpFunShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n ],\n alreadyInstalled: [\"AlreadyInstalledDep\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with allowed missing applications\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Solana\" },\n { name: \"Cardano\" },\n ],\n allowMissingApplication: true,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [{ versionName: \"Solana\", version: \"1.2.0\" }],\n alreadyInstalled: [\"Ethereum\"],\n missingApplications: [\"Cardano\"],\n });\n });\n\n it(\"Error when device is in incorrect state\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n } as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Invalid device state\"),\n });\n });\n\n it(\"Error when device session was not populated\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Device apps metadata not fetched\"),\n });\n });\n\n it(\"Error when an app is not found in the catalog\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [] as unknown as Application[],\n catalog: {\n applications: [] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Bitcoin\" },\n { name: \"Solana\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\n \"Application Ethereum not found in the catalog\",\n ),\n });\n });\n\n it(\"Error when an app version is not found in the catalog\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [{ minVersion: \"1.6.0\" }],\n },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnsupportedFirmwareDAError(\n \"Application Ethereum not found in the catalog\",\n ),\n });\n });\n});\n"],
|
5
|
+
"mappings": "aAAA,IAAAA,EAA8B,mCAC9BC,EAA6B,oCAC7BC,EAAgD,6DAChDC,EAGO,wCAGPC,EAAuC,kDAGvCC,EAAyC,sCAEzC,SAAS,2BAA4B,IAAM,CACzC,MAAMC,KAAU,mCAAgC,EAEhD,WAAW,IAAM,CACf,GAAG,cAAc,EACjBA,EAAQ,eAAe,gB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ACF,CACF,CAAC,CACH,CAAC,EAED,GAAG,wDAAyD,IAAM,CAEhED,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,QAAS,CACP,aAAc,CACZ,CAAE,YAAa,WAAY,QAAS,OAAQ,CAC9C,EACA,iBAAkB,CAAC,CACrB,CACF,CAAkC,EAGlC,MAAMC,EAAS,IAAI,2BAAyBD,EAAS,CACnD,aAAc,CACZ,CACE,KAAM,WACN,YAAa,CAAC,CAAE,WAAY,OAAQ,CAAC,CACvC,CACF,EACA,wBAAyB,EAC3B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,MAAO,IAAI,6BACT,+CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
|
6
6
|
"names": ["import_DeviceModel", "import_DeviceStatus", "import_makeInternalApi", "import_Errors", "import_DeviceSessionState", "import_BuildAppsInstallPlanTask", "apiMock", "result"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var
|
1
|
+
"use strict";var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var I=(o,e,d)=>e in o?l(o,e,{enumerable:!0,configurable:!0,writable:!0,value:d}):o[e]=d;var a=(o,e)=>{for(var d in e)l(o,d,{get:e[d],enumerable:!0})},x=(o,e,d,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!y.call(o,r)&&r!==d&&l(o,r,{get:()=>e[r],enumerable:!(t=m(e,r))||t.enumerable});return o};var N=o=>x(l({},"__esModule",{value:!0}),o),b=(o,e,d,t)=>{for(var r=t>1?void 0:t?m(e,d):e,c=o.length-1,n;c>=0;c--)(n=o[c])&&(r=(t?n(e,d,r):n(r))||r);return t&&r&&l(e,d,r),r};var v=(o,e,d)=>I(o,typeof e!="symbol"?e+"":e,d);var P={};a(P,{StaticDeviceModelDataSource:()=>s});module.exports=N(P);var U=require("inversify"),i=require("../../device/DeviceModel"),p=require("../../device-model/model/BleDeviceInfos"),u=require("../../device-model/model/DeviceModel");let s=class{getAllDeviceModels(){return Object.values(s.deviceModelByIds)}getDeviceModel(e){return s.deviceModelByIds[e.id]}filterDeviceModels(e){return this.getAllDeviceModels().filter(d=>Object.entries(e).every(([t,r])=>d[t]===r))}getBluetoothServicesInfos(){return Object.values(s.deviceModelByIds).reduce((e,d)=>{const{bluetoothSpec:t}=d;return t?{...e,...t.reduce((r,c)=>({...r,[c.serviceUuid]:new p.BleDeviceInfos(d,c.serviceUuid,c.writeUuid,c.writeCmdUuid,c.notifyUuid)}),{})}:e},{})}getBluetoothServices(){return Object.values(s.deviceModelByIds).map(e=>(e.bluetoothSpec||[]).map(d=>d.serviceUuid)).flat().filter(e=>!!e)}};v(s,"deviceModelByIds",{[i.DeviceModelId.APEX]:new u.TransportDeviceModel({id:i.DeviceModelId.APEX,productName:"Ledger Apex",usbProductId:128,bootloaderUsbProductId:8,usbOnly:!1,memorySize:1533*1024,blockSize:32,masks:[859832320],bluetoothSpec:[{serviceUuid:"13d63400-2c97-6004-0000-4c6564676572",notifyUuid:"13d63400-2c97-6004-0001-4c6564676572",writeUuid:"13d63400-2c97-6004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-6004-0003-4c6564676572"}]}),[i.DeviceModelId.NANO_S]:new u.TransportDeviceModel({id:i.DeviceModelId.NANO_S,productName:"Ledger Nano S",usbProductId:16,bootloaderUsbProductId:1,usbOnly:!0,memorySize:320*1024,blockSize:4*1024,masks:[823132160]}),[i.DeviceModelId.NANO_SP]:new u.TransportDeviceModel({id:i.DeviceModelId.NANO_SP,productName:"Ledger Nano S Plus",usbProductId:80,bootloaderUsbProductId:5,usbOnly:!0,memorySize:1533*1024,blockSize:32,masks:[856686592]}),[i.DeviceModelId.NANO_X]:new u.TransportDeviceModel({id:i.DeviceModelId.NANO_X,productName:"Ledger Nano X",usbProductId:64,bootloaderUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,blockSize:4*1024,masks:[855638016],bluetoothSpec:[{serviceUuid:"13d63400-2c97-0004-0000-4c6564676572",notifyUuid:"13d63400-2c97-0004-0001-4c6564676572",writeUuid:"13d63400-2c97-0004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-0004-0003-4c6564676572"}]}),[i.DeviceModelId.STAX]:new u.TransportDeviceModel({id:i.DeviceModelId.STAX,productName:"Ledger Stax",usbProductId:96,bootloaderUsbProductId:6,usbOnly:!1,memorySize:1533*1024,blockSize:32,masks:[857735168],bluetoothSpec:[{serviceUuid:"13d63400-2c97-6004-0000-4c6564676572",notifyUuid:"13d63400-2c97-6004-0001-4c6564676572",writeUuid:"13d63400-2c97-6004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-6004-0003-4c6564676572"}]}),[i.DeviceModelId.FLEX]:new u.TransportDeviceModel({id:i.DeviceModelId.FLEX,productName:"Ledger Flex",usbProductId:112,bootloaderUsbProductId:7,usbOnly:!1,memorySize:1533*1024,blockSize:32,masks:[858783744],bluetoothSpec:[{serviceUuid:"13d63400-2c97-3004-0000-4c6564676572",notifyUuid:"13d63400-2c97-3004-0001-4c6564676572",writeUuid:"13d63400-2c97-3004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-3004-0003-4c6564676572"}]})}),s=b([(0,U.injectable)()],s);0&&(module.exports={StaticDeviceModelDataSource});
|
2
2
|
//# sourceMappingURL=StaticDeviceModelDataSource.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/device-model/data/StaticDeviceModelDataSource.ts"],
|
4
|
-
"sourcesContent": ["import { injectable } from \"inversify\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceModelDataSource } from \"@api/device-model/data/DeviceModelDataSource\";\nimport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nimport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\n\n/**\n * Static/in memory implementation of the device model data source\n */\n@injectable()\nexport class StaticDeviceModelDataSource implements DeviceModelDataSource {\n private static deviceModelByIds: {\n [_key in DeviceModelId]: TransportDeviceModel;\n } = {\n [DeviceModelId.NANO_S]: new TransportDeviceModel({\n id: DeviceModelId.NANO_S,\n productName: \"Ledger Nano S\",\n usbProductId: 0x10,\n bootloaderUsbProductId: 0x0001,\n usbOnly: true,\n memorySize: 320 * 1024,\n blockSize: 4 * 1024,\n masks: [0x31100000],\n }),\n [DeviceModelId.NANO_SP]: new TransportDeviceModel({\n id: DeviceModelId.NANO_SP,\n productName: \"Ledger Nano S Plus\",\n usbProductId: 0x50,\n bootloaderUsbProductId: 0x0005,\n usbOnly: true,\n memorySize: 1533 * 1024,\n blockSize: 32,\n masks: [0x33100000],\n }),\n [DeviceModelId.NANO_X]: new TransportDeviceModel({\n id: DeviceModelId.NANO_X,\n productName: \"Ledger Nano X\",\n usbProductId: 0x40,\n bootloaderUsbProductId: 0x0004,\n usbOnly: false,\n memorySize: 2 * 1024 * 1024,\n blockSize: 4 * 1024,\n masks: [0x33000000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-0004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-0004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-0004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-0004-0003-4c6564676572\",\n },\n ],\n }),\n [DeviceModelId.STAX]: new TransportDeviceModel({\n id: DeviceModelId.STAX,\n productName: \"Ledger Stax\",\n usbProductId: 0x60,\n bootloaderUsbProductId: 0x0006,\n usbOnly: false,\n memorySize: 1533 * 1024,\n blockSize: 32,\n masks: [0x33200000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-6004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-6004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-6004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-6004-0003-4c6564676572\",\n },\n ],\n }),\n [DeviceModelId.FLEX]: new TransportDeviceModel({\n id: DeviceModelId.FLEX,\n productName: \"Ledger Flex\",\n usbProductId: 0x70,\n bootloaderUsbProductId: 0x0007,\n usbOnly: false,\n memorySize: 1533 * 1024,\n blockSize: 32,\n masks: [0x33300000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-3004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-3004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-3004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-3004-0003-4c6564676572\",\n },\n ],\n }),\n };\n\n getAllDeviceModels(): TransportDeviceModel[] {\n return Object.values(StaticDeviceModelDataSource.deviceModelByIds);\n }\n\n getDeviceModel(params: { id: DeviceModelId }): TransportDeviceModel {\n return StaticDeviceModelDataSource.deviceModelByIds[params.id];\n }\n\n /**\n * Returns the list of device models that match all the given parameters\n */\n filterDeviceModels(\n params: Partial<TransportDeviceModel>,\n ): TransportDeviceModel[] {\n return this.getAllDeviceModels().filter((deviceModel) => {\n return Object.entries(params).every(([key, value]) => {\n return deviceModel[key as keyof TransportDeviceModel] === value;\n });\n });\n }\n\n getBluetoothServicesInfos(): Record<string, BleDeviceInfos> {\n return Object.values(StaticDeviceModelDataSource.deviceModelByIds).reduce<\n Record<string, BleDeviceInfos>\n >((acc, deviceModel) => {\n const { bluetoothSpec } = deviceModel;\n if (bluetoothSpec) {\n return {\n ...acc,\n ...bluetoothSpec.reduce<Record<string, BleDeviceInfos>>(\n (serviceToModel, bleSpec) => ({\n ...serviceToModel,\n [bleSpec.serviceUuid]: new BleDeviceInfos(\n deviceModel,\n bleSpec.serviceUuid,\n bleSpec.writeUuid,\n bleSpec.writeCmdUuid,\n bleSpec.notifyUuid,\n ),\n }),\n {},\n ),\n };\n }\n return acc;\n }, {});\n }\n\n getBluetoothServices(): string[] {\n return Object.values(StaticDeviceModelDataSource.deviceModelByIds)\n .map((deviceModel) =>\n (deviceModel.bluetoothSpec || []).map((spec) => spec.serviceUuid),\n )\n .flat()\n .filter((uuid) => !!uuid);\n }\n}\n"],
|
5
|
-
"mappings": "mrBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA2B,qBAE3BC,EAA8B,mCAE9BC,EAA+B,kDAC/BD,EAAqC,+CAM9B,IAAME,EAAN,KAAmE,
|
4
|
+
"sourcesContent": ["import { injectable } from \"inversify\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceModelDataSource } from \"@api/device-model/data/DeviceModelDataSource\";\nimport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nimport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\n\n/**\n * Static/in memory implementation of the device model data source\n */\n@injectable()\nexport class StaticDeviceModelDataSource implements DeviceModelDataSource {\n private static deviceModelByIds: {\n [_key in DeviceModelId]: TransportDeviceModel;\n } = {\n [DeviceModelId.APEX]: new TransportDeviceModel({\n id: DeviceModelId.APEX,\n productName: \"Ledger Apex\",\n usbProductId: 0x80,\n bootloaderUsbProductId: 0x0008,\n usbOnly: false,\n memorySize: 1533 * 1024,\n blockSize: 32,\n masks: [0x33400000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-6004-0000-4c6564676572\", // WILL CHANGE, for now same as Stax\n notifyUuid: \"13d63400-2c97-6004-0001-4c6564676572\", // WILL CHANGE, for now same as Stax\n writeUuid: \"13d63400-2c97-6004-0002-4c6564676572\", // WILL CHANGE, for now same as Stax\n writeCmdUuid: \"13d63400-2c97-6004-0003-4c6564676572\", // WILL CHANGE, for now same as Stax\n },\n ],\n }),\n [DeviceModelId.NANO_S]: new TransportDeviceModel({\n id: DeviceModelId.NANO_S,\n productName: \"Ledger Nano S\",\n usbProductId: 0x10,\n bootloaderUsbProductId: 0x0001,\n usbOnly: true,\n memorySize: 320 * 1024,\n blockSize: 4 * 1024,\n masks: [0x31100000],\n }),\n [DeviceModelId.NANO_SP]: new TransportDeviceModel({\n id: DeviceModelId.NANO_SP,\n productName: \"Ledger Nano S Plus\",\n usbProductId: 0x50,\n bootloaderUsbProductId: 0x0005,\n usbOnly: true,\n memorySize: 1533 * 1024,\n blockSize: 32,\n masks: [0x33100000],\n }),\n [DeviceModelId.NANO_X]: new TransportDeviceModel({\n id: DeviceModelId.NANO_X,\n productName: \"Ledger Nano X\",\n usbProductId: 0x40,\n bootloaderUsbProductId: 0x0004,\n usbOnly: false,\n memorySize: 2 * 1024 * 1024,\n blockSize: 4 * 1024,\n masks: [0x33000000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-0004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-0004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-0004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-0004-0003-4c6564676572\",\n },\n ],\n }),\n [DeviceModelId.STAX]: new TransportDeviceModel({\n id: DeviceModelId.STAX,\n productName: \"Ledger Stax\",\n usbProductId: 0x60,\n bootloaderUsbProductId: 0x0006,\n usbOnly: false,\n memorySize: 1533 * 1024,\n blockSize: 32,\n masks: [0x33200000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-6004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-6004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-6004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-6004-0003-4c6564676572\",\n },\n ],\n }),\n [DeviceModelId.FLEX]: new TransportDeviceModel({\n id: DeviceModelId.FLEX,\n productName: \"Ledger Flex\",\n usbProductId: 0x70,\n bootloaderUsbProductId: 0x0007,\n usbOnly: false,\n memorySize: 1533 * 1024,\n blockSize: 32,\n masks: [0x33300000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-3004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-3004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-3004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-3004-0003-4c6564676572\",\n },\n ],\n }),\n };\n\n getAllDeviceModels(): TransportDeviceModel[] {\n return Object.values(StaticDeviceModelDataSource.deviceModelByIds);\n }\n\n getDeviceModel(params: { id: DeviceModelId }): TransportDeviceModel {\n return StaticDeviceModelDataSource.deviceModelByIds[params.id];\n }\n\n /**\n * Returns the list of device models that match all the given parameters\n */\n filterDeviceModels(\n params: Partial<TransportDeviceModel>,\n ): TransportDeviceModel[] {\n return this.getAllDeviceModels().filter((deviceModel) => {\n return Object.entries(params).every(([key, value]) => {\n return deviceModel[key as keyof TransportDeviceModel] === value;\n });\n });\n }\n\n getBluetoothServicesInfos(): Record<string, BleDeviceInfos> {\n return Object.values(StaticDeviceModelDataSource.deviceModelByIds).reduce<\n Record<string, BleDeviceInfos>\n >((acc, deviceModel) => {\n const { bluetoothSpec } = deviceModel;\n if (bluetoothSpec) {\n return {\n ...acc,\n ...bluetoothSpec.reduce<Record<string, BleDeviceInfos>>(\n (serviceToModel, bleSpec) => ({\n ...serviceToModel,\n [bleSpec.serviceUuid]: new BleDeviceInfos(\n deviceModel,\n bleSpec.serviceUuid,\n bleSpec.writeUuid,\n bleSpec.writeCmdUuid,\n bleSpec.notifyUuid,\n ),\n }),\n {},\n ),\n };\n }\n return acc;\n }, {});\n }\n\n getBluetoothServices(): string[] {\n return Object.values(StaticDeviceModelDataSource.deviceModelByIds)\n .map((deviceModel) =>\n (deviceModel.bluetoothSpec || []).map((spec) => spec.serviceUuid),\n )\n .flat()\n .filter((uuid) => !!uuid);\n }\n}\n"],
|
5
|
+
"mappings": "mrBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA2B,qBAE3BC,EAA8B,mCAE9BC,EAA+B,kDAC/BD,EAAqC,+CAM9B,IAAME,EAAN,KAAmE,C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BACb,aAAc,GACd,uBAAwB,EACxB,QAAS,GACT,WAAY,IAAM,KAClB,UAAW,EAAI,KACf,MAAO,CAAC,SAAU,CACpB,CAAC,EACD,CAAC,gBAAc,OAAO,EAAG,IAAI,uBAAqB,CAChD,GAAI,gBAAc,QAClB,YAAa,qBACb,aAAc,GACd,uBAAwB,EACxB,QAAS,GACT,WAAY,KAAO,KACnB,UAAW,GACX,MAAO,CAAC,SAAU,CACpB,CAAC,EACD,CAAC,gBAAc,MAAM,EAAG,IAAI,uBAAqB,CAC/C,GAAI,gBAAc,OAClB,YAAa,gBACb,aAAc,GACd,uBAAwB,EACxB,QAAS,GACT,WAAY,EAAI,KAAO,KACvB,UAAW,EAAI,KACf,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,CACF,CAAC,EACD,CAAC,gBAAc,IAAI,EAAG,IAAI,uBAAqB,CAC7C,GAAI,gBAAc,KAClB,YAAa,cACb,aAAc,GACd,uBAAwB,EACxB,QAAS,GACT,WAAY,KAAO,KACnB,UAAW,GACX,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,CACF,CAAC,EACD,CAAC,gBAAc,IAAI,EAAG,IAAI,uBAAqB,CAC7C,GAAI,gBAAc,KAClB,YAAa,cACb,aAAc,IACd,uBAAwB,EACxB,QAAS,GACT,WAAY,KAAO,KACnB,UAAW,GACX,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,CACF,CAAC,CACH,GAhGWA,EAANY,EAAA,IADN,cAAW,GACCZ",
|
6
6
|
"names": ["StaticDeviceModelDataSource_exports", "__export", "StaticDeviceModelDataSource", "__toCommonJS", "import_inversify", "import_DeviceModel", "import_BleDeviceInfos", "StaticDeviceModelDataSource", "params", "deviceModel", "key", "value", "acc", "bluetoothSpec", "serviceToModel", "bleSpec", "spec", "uuid", "__publicField", "__decorateClass"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var e=require("../../device/DeviceModel"),
|
1
|
+
"use strict";var e=require("../../device/DeviceModel"),a=require("../../device-model/model/BleDeviceInfos"),i=require("./StaticDeviceModelDataSource");describe("StaticDeviceModelDataSource",()=>{describe("getAllDeviceModels",()=>{it("should return all device models",()=>{const c=new i.StaticDeviceModelDataSource().getAllDeviceModels();expect(c.length).toEqual(6),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.APEX})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_S})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_X})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.STAX})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.FLEX}))})}),describe("getDeviceModel",()=>{it("should return the associated device model",()=>{const t=new i.StaticDeviceModelDataSource,c=t.getDeviceModel({id:e.DeviceModelId.NANO_S});expect(c).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_S}));const o=t.getDeviceModel({id:e.DeviceModelId.NANO_SP});expect(o).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP}));const d=t.getDeviceModel({id:e.DeviceModelId.NANO_X});expect(d).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_X}));const n=t.getDeviceModel({id:e.DeviceModelId.STAX});expect(n).toEqual(expect.objectContaining({id:e.DeviceModelId.STAX}));const l=t.getDeviceModel({id:e.DeviceModelId.FLEX});expect(l).toEqual(expect.objectContaining({id:e.DeviceModelId.FLEX}))})}),describe("filterDeviceModels",()=>{it("should return the device models that match the given single parameter",()=>{const t=new i.StaticDeviceModelDataSource,c=t.filterDeviceModels({usbOnly:!0});expect(c.length).toEqual(2),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_S}));const o=t.filterDeviceModels({usbProductId:16});expect(o.length).toEqual(1),expect(o[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_S}));const d=t.filterDeviceModels({usbProductId:64});expect(d.length).toEqual(1),expect(d[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_X}));const n=t.filterDeviceModels({usbProductId:80});expect(n.length).toEqual(1),expect(n[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP}));const l=t.filterDeviceModels({usbProductId:96});expect(l.length).toEqual(1),expect(l[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.STAX}));const s=t.filterDeviceModels({usbProductId:0});expect(s.length).toEqual(0)}),it("should return the device models that match the given multiple parameters",()=>{const t=new i.StaticDeviceModelDataSource,c=t.filterDeviceModels({usbOnly:!1,usbProductId:64});expect(c.length).toEqual(1),expect(c[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_X}));const o=t.filterDeviceModels({usbOnly:!0,usbProductId:80});expect(o.length).toEqual(1),expect(o[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP}));const d=t.filterDeviceModels({usbOnly:!1,usbProductId:16});expect(d.length).toEqual(0)})}),describe("getBluetoothServicesInfos",()=>{it("should return the ble service infos record",()=>{const t=new i.StaticDeviceModelDataSource,c=t.getBluetoothServicesInfos();expect(c).toStrictEqual({"13d63400-2c97-0004-0000-4c6564676572":new a.BleDeviceInfos(t.getDeviceModel({id:e.DeviceModelId.NANO_X}),"13d63400-2c97-0004-0000-4c6564676572","13d63400-2c97-0004-0002-4c6564676572","13d63400-2c97-0004-0003-4c6564676572","13d63400-2c97-0004-0001-4c6564676572"),"13d63400-2c97-6004-0000-4c6564676572":new a.BleDeviceInfos(t.getDeviceModel({id:e.DeviceModelId.STAX}),"13d63400-2c97-6004-0000-4c6564676572","13d63400-2c97-6004-0002-4c6564676572","13d63400-2c97-6004-0003-4c6564676572","13d63400-2c97-6004-0001-4c6564676572"),"13d63400-2c97-3004-0000-4c6564676572":new a.BleDeviceInfos(t.getDeviceModel({id:e.DeviceModelId.FLEX}),"13d63400-2c97-3004-0000-4c6564676572","13d63400-2c97-3004-0002-4c6564676572","13d63400-2c97-3004-0003-4c6564676572","13d63400-2c97-3004-0001-4c6564676572")})})}),describe("getBluetoothServices",()=>{it("should return the bluetooth services",()=>{const c=new i.StaticDeviceModelDataSource().getBluetoothServices();expect(c).toStrictEqual(["13d63400-2c97-6004-0000-4c6564676572","13d63400-2c97-0004-0000-4c6564676572","13d63400-2c97-6004-0000-4c6564676572","13d63400-2c97-3004-0000-4c6564676572"])})})});
|
2
2
|
//# sourceMappingURL=StaticDeviceModelDataSource.test.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/device-model/data/StaticDeviceModelDataSource.test.ts"],
|
4
|
-
"sourcesContent": ["import { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\n\nimport { StaticDeviceModelDataSource } from \"./StaticDeviceModelDataSource\";\n\ndescribe(\"StaticDeviceModelDataSource\", () => {\n describe(\"getAllDeviceModels\", () => {\n it(\"should return all device models\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n const deviceModels = dataSource.getAllDeviceModels();\n\n
|
5
|
-
"mappings": "aAAA,IAAAA,EAA8B,mCAC9BC,EAA+B,kDAE/BC,EAA4C,yCAE5C,SAAS,8BAA+B,IAAM,CAC5C,SAAS,qBAAsB,IAAM,CACnC,GAAG,kCAAmC,IAAM,CAE1C,MAAMC,EADa,IAAI,8BAA4B,EACnB,mBAAmB,
|
4
|
+
"sourcesContent": ["import { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\n\nimport { StaticDeviceModelDataSource } from \"./StaticDeviceModelDataSource\";\n\ndescribe(\"StaticDeviceModelDataSource\", () => {\n describe(\"getAllDeviceModels\", () => {\n it(\"should return all device models\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n const deviceModels = dataSource.getAllDeviceModels();\n\n expect(deviceModels.length).toEqual(6);\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.APEX }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_S }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_X }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.STAX }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.FLEX }),\n );\n });\n });\n\n describe(\"getDeviceModel\", () => {\n it(\"should return the associated device model\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n\n const deviceModel1 = dataSource.getDeviceModel({\n id: DeviceModelId.NANO_S,\n });\n expect(deviceModel1).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_S }),\n );\n\n const deviceModel2 = dataSource.getDeviceModel({\n id: DeviceModelId.NANO_SP,\n });\n expect(deviceModel2).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n\n const deviceModel3 = dataSource.getDeviceModel({\n id: DeviceModelId.NANO_X,\n });\n expect(deviceModel3).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_X }),\n );\n\n const deviceModel4 = dataSource.getDeviceModel({\n id: DeviceModelId.STAX,\n });\n expect(deviceModel4).toEqual(\n expect.objectContaining({ id: DeviceModelId.STAX }),\n );\n\n const deviceModel5 = dataSource.getDeviceModel({\n id: DeviceModelId.FLEX,\n });\n expect(deviceModel5).toEqual(\n expect.objectContaining({ id: DeviceModelId.FLEX }),\n );\n });\n });\n\n describe(\"filterDeviceModels\", () => {\n it(\"should return the device models that match the given single parameter\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n\n const deviceModels1 = dataSource.filterDeviceModels({ usbOnly: true });\n expect(deviceModels1.length).toEqual(2);\n expect(deviceModels1).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n expect(deviceModels1).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_S }),\n );\n\n const deviceModels2 = dataSource.filterDeviceModels({\n usbProductId: 0x10,\n });\n expect(deviceModels2.length).toEqual(1);\n expect(deviceModels2[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_S }),\n );\n\n const deviceModels3 = dataSource.filterDeviceModels({\n usbProductId: 0x40,\n });\n expect(deviceModels3.length).toEqual(1);\n expect(deviceModels3[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_X }),\n );\n\n const deviceModels4 = dataSource.filterDeviceModels({\n usbProductId: 0x50,\n });\n expect(deviceModels4.length).toEqual(1);\n expect(deviceModels4[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n\n const deviceModels5 = dataSource.filterDeviceModels({\n usbProductId: 0x60,\n });\n expect(deviceModels5.length).toEqual(1);\n expect(deviceModels5[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.STAX }),\n );\n\n const deviceModels6 = dataSource.filterDeviceModels({\n usbProductId: 0x00,\n });\n expect(deviceModels6.length).toEqual(0);\n });\n\n it(\"should return the device models that match the given multiple parameters\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n\n const deviceModels1 = dataSource.filterDeviceModels({\n usbOnly: false,\n usbProductId: 0x40,\n });\n expect(deviceModels1.length).toEqual(1);\n expect(deviceModels1[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_X }),\n );\n\n const deviceModels2 = dataSource.filterDeviceModels({\n usbOnly: true,\n usbProductId: 0x50,\n });\n expect(deviceModels2.length).toEqual(1);\n expect(deviceModels2[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n\n // Nano S is usbOnly\n const deviceModels3 = dataSource.filterDeviceModels({\n usbOnly: false,\n usbProductId: 0x10,\n });\n expect(deviceModels3.length).toEqual(0);\n });\n });\n describe(\"getBluetoothServicesInfos\", () => {\n it(\"should return the ble service infos record\", () => {\n // given\n const dataSource = new StaticDeviceModelDataSource();\n // when\n const bleServiceInfos = dataSource.getBluetoothServicesInfos();\n // then\n expect(bleServiceInfos).toStrictEqual({\n \"13d63400-2c97-0004-0000-4c6564676572\": new BleDeviceInfos(\n dataSource.getDeviceModel({ id: DeviceModelId.NANO_X }),\n \"13d63400-2c97-0004-0000-4c6564676572\",\n \"13d63400-2c97-0004-0002-4c6564676572\",\n \"13d63400-2c97-0004-0003-4c6564676572\",\n \"13d63400-2c97-0004-0001-4c6564676572\",\n ),\n \"13d63400-2c97-6004-0000-4c6564676572\": new BleDeviceInfos(\n dataSource.getDeviceModel({ id: DeviceModelId.STAX }),\n \"13d63400-2c97-6004-0000-4c6564676572\",\n \"13d63400-2c97-6004-0002-4c6564676572\",\n \"13d63400-2c97-6004-0003-4c6564676572\",\n \"13d63400-2c97-6004-0001-4c6564676572\",\n ),\n \"13d63400-2c97-3004-0000-4c6564676572\": new BleDeviceInfos(\n dataSource.getDeviceModel({ id: DeviceModelId.FLEX }),\n \"13d63400-2c97-3004-0000-4c6564676572\",\n \"13d63400-2c97-3004-0002-4c6564676572\",\n \"13d63400-2c97-3004-0003-4c6564676572\",\n \"13d63400-2c97-3004-0001-4c6564676572\",\n ),\n });\n });\n });\n describe(\"getBluetoothServices\", () => {\n it(\"should return the bluetooth services\", () => {\n // given\n const dataSource = new StaticDeviceModelDataSource();\n // when\n const bleServices = dataSource.getBluetoothServices();\n // then\n expect(bleServices).toStrictEqual([\n \"13d63400-2c97-6004-0000-4c6564676572\",\n \"13d63400-2c97-0004-0000-4c6564676572\",\n \"13d63400-2c97-6004-0000-4c6564676572\",\n \"13d63400-2c97-3004-0000-4c6564676572\",\n ]);\n });\n });\n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ACA,uCACA,sCACF,EACA,uCAAwC,IAAI,iBAC1CA,EAAW,eAAe,CAAE,GAAI,gBAAc,IAAK,CAAC,EACpD,uCACA,uCACA,uCACA,sCACF,EACA,uCAAwC,IAAI,iBAC1CA,EAAW,eAAe,CAAE,GAAI,gBAAc,IAAK,CAAC,EACpD,uCACA,uCACA,uCACA,sCACF,CACF,CAAC,CACH,CAAC,CACH,CAAC,EACD,SAAS,uBAAwB,IAAM,CACrC,GAAG,uCAAwC,IAAM,CAI/C,MAAMa,EAFa,IAAI,8BAA4B,EAEpB,qBAAqB,EAEpD,OAAOA,CAAW,EAAE,cAAc,CAChC,uCACA,uCACA,uCACA,sCACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
|
6
6
|
"names": ["import_DeviceModel", "import_BleDeviceInfos", "import_StaticDeviceModelDataSource", "deviceModels", "dataSource", "deviceModel1", "deviceModel2", "deviceModel3", "deviceModel4", "deviceModel5", "deviceModels1", "deviceModels2", "deviceModels3", "deviceModels4", "deviceModels5", "deviceModels6", "bleServiceInfos", "bleServices"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var b=Object.create;var
|
1
|
+
"use strict";var b=Object.create;var s=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty;var S=(t,e)=>{for(var i in e)s(t,i,{get:e[i],enumerable:!0})},c=(t,e,i,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of m(e))!a.call(t,o)&&o!==i&&s(t,o,{get:()=>e[o],enumerable:!(d=n(e,o))||d.enumerable});return t};var h=(t,e,i)=>(i=t!=null?b(l(t)):{},c(e||!t||!t.__esModule?s(i,"default",{value:t,enumerable:!0}):i,t)),g=t=>c(s({},"__esModule",{value:!0}),t);var I={};S(I,{TransportDeviceModel:()=>U});module.exports=g(I);var u=h(require("semver")),r=require("../../device/DeviceModel");class U{id;productName;usbProductId;bootloaderUsbProductId;usbOnly;memorySize;blockSize;masks;bluetoothSpec;constructor(e){this.id=e.id,this.productName=e.productName,this.usbProductId=e.usbProductId,this.bootloaderUsbProductId=e.bootloaderUsbProductId,this.usbOnly=e.usbOnly,this.memorySize=e.memorySize,this.blockSize=e.blockSize,this.masks=e.masks,this.bluetoothSpec=e.bluetoothSpec}getBlockSize(e){switch(this.id){case r.DeviceModelId.NANO_S:return u.default.lt(u.default.coerce(e)??"","2.0.0")?4*1024:2*1024;case r.DeviceModelId.NANO_X:return 4*1024;case r.DeviceModelId.NANO_SP:case r.DeviceModelId.STAX:case r.DeviceModelId.FLEX:case r.DeviceModelId.APEX:return 32}}}0&&(module.exports={TransportDeviceModel});
|
2
2
|
//# sourceMappingURL=DeviceModel.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/device-model/model/DeviceModel.ts"],
|
4
|
-
"sourcesContent": ["import semver from \"semver\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\n/**\n * The info of a device model\n */\nexport class TransportDeviceModel {\n id: DeviceModelId;\n productName: string;\n usbProductId: number;\n bootloaderUsbProductId: number;\n usbOnly: boolean;\n memorySize: number;\n blockSize: number;\n masks: number[];\n bluetoothSpec?: {\n serviceUuid: string;\n writeUuid: string;\n writeCmdUuid: string;\n notifyUuid: string;\n }[];\n\n constructor(props: {\n id: DeviceModelId;\n productName: string;\n usbProductId: number;\n bootloaderUsbProductId: number;\n usbOnly: boolean;\n memorySize: number;\n blockSize: number;\n masks: number[];\n\n bluetoothSpec?: {\n serviceUuid: string;\n writeUuid: string;\n writeCmdUuid: string;\n notifyUuid: string;\n }[];\n }) {\n this.id = props.id;\n this.productName = props.productName;\n this.usbProductId = props.usbProductId;\n this.bootloaderUsbProductId = props.bootloaderUsbProductId;\n this.usbOnly = props.usbOnly;\n this.memorySize = props.memorySize;\n this.blockSize = props.blockSize;\n this.masks = props.masks;\n this.bluetoothSpec = props.bluetoothSpec;\n }\n\n getBlockSize(firmwareVersion: string): number {\n switch (this.id) {\n case DeviceModelId.NANO_S:\n return semver.lt(semver.coerce(firmwareVersion) ?? \"\", \"2.0.0\")\n ? 4 * 1024\n : 2 * 1024;\n case DeviceModelId.NANO_X:\n return 4 * 1024;\n case DeviceModelId.NANO_SP:\n case DeviceModelId.STAX:\n case DeviceModelId.FLEX:\n return 32;\n }\n }\n}\n"],
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmB,qBAEnBC,EAA8B,mCAKvB,MAAMH,CAAqB,CAChC,GACA,YACA,aACA,uBACA,QACA,WACA,UACA,MACA,cAOA,YAAYI,EAgBT,CACD,KAAK,GAAKA,EAAM,GAChB,KAAK,YAAcA,EAAM,YACzB,KAAK,aAAeA,EAAM,aAC1B,KAAK,uBAAyBA,EAAM,uBACpC,KAAK,QAAUA,EAAM,QACrB,KAAK,WAAaA,EAAM,WACxB,KAAK,UAAYA,EAAM,UACvB,KAAK,MAAQA,EAAM,MACnB,KAAK,cAAgBA,EAAM,aAC7B,CAEA,aAAaC,EAAiC,CAC5C,OAAQ,KAAK,GAAI,CACf,KAAK,gBAAc,OACjB,OAAO,EAAAC,QAAO,GAAG,EAAAA,QAAO,OAAOD,CAAe,GAAK,GAAI,OAAO,EAC1D,EAAI,KACJ,EAAI,KACV,KAAK,gBAAc,OACjB,MAAO,GAAI,KACb,KAAK,gBAAc,QACnB,KAAK,gBAAc,KACnB,KAAK,gBAAc,KACjB,MAAO,GACX,CACF,CACF",
|
4
|
+
"sourcesContent": ["import semver from \"semver\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\n/**\n * The info of a device model\n */\nexport class TransportDeviceModel {\n id: DeviceModelId;\n productName: string;\n usbProductId: number;\n bootloaderUsbProductId: number;\n usbOnly: boolean;\n memorySize: number;\n blockSize: number;\n masks: number[];\n bluetoothSpec?: {\n serviceUuid: string;\n writeUuid: string;\n writeCmdUuid: string;\n notifyUuid: string;\n }[];\n\n constructor(props: {\n id: DeviceModelId;\n productName: string;\n usbProductId: number;\n bootloaderUsbProductId: number;\n usbOnly: boolean;\n memorySize: number;\n blockSize: number;\n masks: number[];\n\n bluetoothSpec?: {\n serviceUuid: string;\n writeUuid: string;\n writeCmdUuid: string;\n notifyUuid: string;\n }[];\n }) {\n this.id = props.id;\n this.productName = props.productName;\n this.usbProductId = props.usbProductId;\n this.bootloaderUsbProductId = props.bootloaderUsbProductId;\n this.usbOnly = props.usbOnly;\n this.memorySize = props.memorySize;\n this.blockSize = props.blockSize;\n this.masks = props.masks;\n this.bluetoothSpec = props.bluetoothSpec;\n }\n\n getBlockSize(firmwareVersion: string): number {\n switch (this.id) {\n case DeviceModelId.NANO_S:\n return semver.lt(semver.coerce(firmwareVersion) ?? \"\", \"2.0.0\")\n ? 4 * 1024\n : 2 * 1024;\n case DeviceModelId.NANO_X:\n return 4 * 1024;\n case DeviceModelId.NANO_SP:\n case DeviceModelId.STAX:\n case DeviceModelId.FLEX:\n case DeviceModelId.APEX:\n return 32;\n }\n }\n}\n"],
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmB,qBAEnBC,EAA8B,mCAKvB,MAAMH,CAAqB,CAChC,GACA,YACA,aACA,uBACA,QACA,WACA,UACA,MACA,cAOA,YAAYI,EAgBT,CACD,KAAK,GAAKA,EAAM,GAChB,KAAK,YAAcA,EAAM,YACzB,KAAK,aAAeA,EAAM,aAC1B,KAAK,uBAAyBA,EAAM,uBACpC,KAAK,QAAUA,EAAM,QACrB,KAAK,WAAaA,EAAM,WACxB,KAAK,UAAYA,EAAM,UACvB,KAAK,MAAQA,EAAM,MACnB,KAAK,cAAgBA,EAAM,aAC7B,CAEA,aAAaC,EAAiC,CAC5C,OAAQ,KAAK,GAAI,CACf,KAAK,gBAAc,OACjB,OAAO,EAAAC,QAAO,GAAG,EAAAA,QAAO,OAAOD,CAAe,GAAK,GAAI,OAAO,EAC1D,EAAI,KACJ,EAAI,KACV,KAAK,gBAAc,OACjB,MAAO,GAAI,KACb,KAAK,gBAAc,QACnB,KAAK,gBAAc,KACnB,KAAK,gBAAc,KACnB,KAAK,gBAAc,KACjB,MAAO,GACX,CACF,CACF",
|
6
6
|
"names": ["DeviceModel_exports", "__export", "TransportDeviceModel", "__toCommonJS", "import_semver", "import_DeviceModel", "props", "firmwareVersion", "semver"]
|
7
7
|
}
|
package/lib/cjs/src/api/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var D=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var
|
1
|
+
"use strict";var D=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var de=Object.prototype.hasOwnProperty;var De=(p,o)=>{for(var i in o)D(p,i,{get:o[i],enumerable:!0})},d=(p,o,i,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of Ae(o))!de.call(p,s)&&s!==i&&D(p,s,{get:()=>o[s],enumerable:!(l=xe(o,s))||l.enumerable});return p},r=(p,o,i)=>(d(p,o,"default"),i&&d(i,o,"default"));var le=p=>d(D({},"__esModule",{value:!0}),p);var e={};De(e,{APDU_MAX_PAYLOAD:()=>c.APDU_MAX_PAYLOAD,Apdu:()=>u.Apdu,ApduBuilder:()=>c.ApduBuilder,ApduParser:()=>v.ApduParser,ApduResponse:()=>Y.ApduResponse,AppAlreadyInstalledDAError:()=>t.AppAlreadyInstalledDAError,BatteryStatusType:()=>f.BatteryStatusType,BleDeviceInfos:()=>q.BleDeviceInfos,ByteArrayBuilder:()=>S.ByteArrayBuilder,ByteArrayParser:()=>C.ByteArrayParser,CallTaskInAppDeviceAction:()=>T.CallTaskInAppDeviceAction,CloseAppCommand:()=>L.CloseAppCommand,CommandResultFactory:()=>n.CommandResultFactory,CommandResultStatus:()=>n.CommandResultStatus,CommandUtils:()=>I.CommandUtils,ConnectedDevice:()=>ae.ConnectedDevice,ConsoleLogger:()=>ne.ConsoleLogger,DeviceActionStatus:()=>b.DeviceActionStatus,DeviceConnectionStateMachine:()=>se.DeviceConnectionStateMachine,DeviceLockedError:()=>t.DeviceLockedError,DeviceManagementKit:()=>te.DeviceManagementKit,DeviceManagementKitBuilder:()=>pe.DeviceManagementKitBuilder,DeviceModel:()=>m.DeviceModel,DeviceModelId:()=>m.DeviceModelId,DeviceSessionStateType:()=>j.DeviceSessionStateType,DeviceStatus:()=>O.DeviceStatus,FramerUtils:()=>oe.FramerUtils,GenuineCheckDeviceAction:()=>z.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>g.GetAppAndVersionCommand,GetBatteryStatusCommand:()=>f.GetBatteryStatusCommand,GetDeviceMetadataDeviceAction:()=>U.GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction:()=>P.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>B.GetOsVersionCommand,GlobalCommandError:()=>x.GlobalCommandError,GlobalCommandErrorHandler:()=>x.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>V.GoToDashboardDeviceAction,InstallAppDeviceAction:()=>J.InstallAppDeviceAction,InstallOrUpdateAppsDeviceAction:()=>k.InstallOrUpdateAppsDeviceAction,InvalidStatusWordError:()=>y.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>m.LEDGER_VENDOR_ID,ListAppsCommand:()=>E.ListAppsCommand,ListAppsDeviceAction:()=>W.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>_.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>Q.ListInstalledAppsDeviceAction,LoadCertificateCommand:()=>G.LoadCertificateCommand,LogLevel:()=>ie.LogLevel,OpenAppCommand:()=>M.OpenAppCommand,OpenAppDeviceAction:()=>F.OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction:()=>H.OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError:()=>t.OutOfMemoryDAError,RefusedByUserDAError:()=>t.RefusedByUserDAError,SecureChannelError:()=>$.SecureChannelError,SendCommandInAppDeviceAction:()=>w.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>X.StaticDeviceModelDataSource,TransportConnectedDevice:()=>ce.TransportConnectedDevice,TransportDeviceModel:()=>N.TransportDeviceModel,UninstallAppDeviceAction:()=>Z.UninstallAppDeviceAction,UnknownDAError:()=>t.UnknownDAError,UnsupportedFirmwareDAError:()=>t.UnsupportedFirmwareDAError,UserInteractionRequired:()=>h.UserInteractionRequired,WebLogsExporterLogger:()=>me.WebLogsExporterLogger,XStateDeviceAction:()=>K.XStateDeviceAction,base64StringToBuffer:()=>A.base64StringToBuffer,bufferToHexaString:()=>a.bufferToHexaString,connectedDeviceStubBuilder:()=>fe.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>ee.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>re.defaultApduSenderServiceStubBuilder,hexaStringToBuffer:()=>a.hexaStringToBuffer,isBase64String:()=>A.isBase64String,isCommandErrorCode:()=>R.isCommandErrorCode,isHexaString:()=>a.isHexaString,isSuccessCommandResult:()=>n.isSuccessCommandResult});module.exports=le(e);var u=require("./apdu/model/Apdu"),c=require("./apdu/utils/ApduBuilder"),v=require("./apdu/utils/ApduParser");r(e,require("./apdu/utils/AppBuilderError"),module.exports);var S=require("./apdu/utils/ByteArrayBuilder"),C=require("./apdu/utils/ByteArrayParser"),y=require("./command/Errors"),n=require("./command/model/CommandResult"),L=require("./command/os/CloseAppCommand"),g=require("./command/os/GetAppAndVersionCommand"),f=require("./command/os/GetBatteryStatusCommand"),B=require("./command/os/GetOsVersionCommand"),E=require("./command/os/ListAppsCommand"),G=require("./command/os/LoadCertificateCommand"),M=require("./command/os/OpenAppCommand"),R=require("./command/utils/CommandErrors"),I=require("./command/utils/CommandUtils"),x=require("./command/utils/GlobalCommandError"),m=require("./device/DeviceModel"),O=require("./device/DeviceStatus"),b=require("./device-action/model/DeviceActionState"),h=require("./device-action/model/UserInteractionRequired"),T=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),t=require("./device-action/os/Errors"),U=require("./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction"),P=require("./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),V=require("./device-action/os/GoToDashboard/GoToDashboardDeviceAction"),k=require("./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction"),W=require("./device-action/os/ListApps/ListAppsDeviceAction"),_=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),F=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),H=require("./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction"),w=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),K=require("./device-action/xstate-utils/XStateDeviceAction"),X=require("./device-model/data/StaticDeviceModelDataSource"),q=require("./device-model/model/BleDeviceInfos"),N=require("./device-model/model/DeviceModel"),Y=require("./device-session/ApduResponse");r(e,require("./device-session/data/FramerConst"),module.exports);var j=require("./device-session/DeviceSessionState"),z=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),J=require("./secure-channel/device-action/InstallApp/InstallAppDeviceAction"),Q=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),Z=require("./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction"),$=require("../internal/secure-channel/model/Errors"),ee=require("./device-session/service/DefaultApduReceiverService.stub"),re=require("./device-session/service/DefaultApduSenderService.stub"),oe=require("./device-session/utils/FramerUtils"),te=require("./DeviceManagementKit"),pe=require("./DeviceManagementKitBuilder");r(e,require("./Error"),module.exports);var ie=require("./logger-subscriber/model/LogLevel"),ne=require("./logger-subscriber/service/ConsoleLogger"),me=require("./logger-subscriber/service/WebLogsExporterLogger"),ae=require("./transport/model/ConnectedDevice"),se=require("./transport/model/DeviceConnectionStateMachine");r(e,require("./transport/model/Errors"),module.exports);var ce=require("./transport/model/TransportConnectedDevice"),fe=require("./transport/model/TransportConnectedDevice.stub");r(e,require("./types"),module.exports);var A=require("./utils/Base64String"),a=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,AppAlreadyInstalledDAError,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectedDevice,ConsoleLogger,DeviceActionStatus,DeviceConnectionStateMachine,DeviceLockedError,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceSessionStateType,DeviceStatus,FramerUtils,GenuineCheckDeviceAction,GetAppAndVersionCommand,GetBatteryStatusCommand,GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction,GetOsVersionCommand,GlobalCommandError,GlobalCommandErrorHandler,GoToDashboardDeviceAction,InstallAppDeviceAction,InstallOrUpdateAppsDeviceAction,InvalidStatusWordError,LEDGER_VENDOR_ID,ListAppsCommand,ListAppsDeviceAction,ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction,LoadCertificateCommand,LogLevel,OpenAppCommand,OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError,RefusedByUserDAError,SecureChannelError,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UninstallAppDeviceAction,UnknownDAError,UnsupportedFirmwareDAError,UserInteractionRequired,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,hexaStringToBuffer,isBase64String,isCommandErrorCode,isHexaString,isSuccessCommandResult,...require("./apdu/utils/AppBuilderError"),...require("./device-session/data/FramerConst"),...require("./Error"),...require("./transport/model/Errors"),...require("./types")});
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../src/api/index.ts"],
|
4
|
-
"sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport { InvalidStatusWordError } from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport {\n DeviceLockedError,\n OutOfMemoryDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { InstallAppDeviceAction } from \"@api/secure-channel/device-action/InstallApp/InstallAppDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nexport { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\nexport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\n DeviceConnectionStateMachine,\n type DeviceConnectionStateMachineParams,\n} from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
|
5
|
-
"mappings": "meAAA,IAAAA,EAAA,GAAAC,GAAAD,EAAA,
|
4
|
+
"sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport { InvalidStatusWordError } from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport {\n AppAlreadyInstalledDAError,\n DeviceLockedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { InstallAppDeviceAction } from \"@api/secure-channel/device-action/InstallApp/InstallAppDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nexport { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\nexport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\n DeviceConnectionStateMachine,\n type DeviceConnectionStateMachineParams,\n} from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
|
5
|
+
"mappings": "meAAA,IAAAA,EAAA,GAAAC,GAAAD,EAAA,s5GAAAE,GAAAF,GAEA,IAAAG,EAAqB,gCACrBC,EAA8C,uCAC9CC,EAA2B,sCAC3BC,EAAAN,EAAc,2CALd,gBAMA,IAAAO,EAAiC,4CACjCC,EAAgC,2CAChCC,EAAuC,+BACvCC,EAIO,4CACPC,EAAgC,2CAChCC,EAGO,mDACPC,EAKO,mDACPC,EAGO,+CACPC,EAKO,2CACPC,EAIO,kDACPC,EAGO,0CACPC,EAAmC,4CACnCC,EAA6B,2CAC7BC,EAGO,iDACPC,EAIO,mCACPC,EAA6B,oCAE7BC,EAGO,sDACPC,EAAwC,4DACxCC,EAA0C,qFAC1ChB,EAOO,wCACPiB,EAA8C,iFAC9CC,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAgD,qFAChDC,EAAqC,+DACrCC,EAAiD,uFACjDC,EAAoC,yEACpCC,EAAoD,6FACpDC,EAA6C,2FAC7CC,EAGO,8DACPC,EAA4C,8DAC5CC,EAA+B,kDAC/BhB,EAAqC,+CACrCiB,EAA6B,4CAC7BhC,EAAAN,EAAc,gDAxFd,gBAyFA,IAAAuC,EAGO,kDACPC,EAAyC,mFACzCC,EAAuC,+EACvCC,EAA8C,6FAC9CC,EAAyC,mFACzClC,EAAmC,iDAEnCmC,GAAsD,uEACtDC,GAAoD,qEACpDC,GAA4B,iDAC5BC,GAAoC,oCACpCC,GAA2C,2CAC3C1C,EAAAN,EAAc,sBAxGd,gBAyGA,IAAAiD,GAAyB,iDACzBC,GAA8B,wDAC9BC,GAAsC,gEACtCC,GAAgC,gDAChCC,GAGO,6DACP/C,EAAAN,EAAc,uCAjHd,gBAkHA,IAAAsD,GAAyC,yDACzCA,GAA2C,8DAC3ChD,EAAAN,EAAc,sBApHd,gBAqHA,IAAAuD,EAAqD,mCACrDC,EAIO",
|
6
6
|
"names": ["api_exports", "__export", "__toCommonJS", "import_Apdu", "import_ApduBuilder", "import_ApduParser", "__reExport", "import_ByteArrayBuilder", "import_ByteArrayParser", "import_Errors", "import_CommandResult", "import_CloseAppCommand", "import_GetAppAndVersionCommand", "import_GetBatteryStatusCommand", "import_GetOsVersionCommand", "import_ListAppsCommand", "import_LoadCertificateCommand", "import_OpenAppCommand", "import_CommandErrors", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_DeviceStatus", "import_DeviceActionState", "import_UserInteractionRequired", "import_CallTaskInAppDeviceAction", "import_GetDeviceMetadataDeviceAction", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_InstallOrUpdateAppsDeviceAction", "import_ListAppsDeviceAction", "import_ListAppsWithMetadataDeviceAction", "import_OpenAppDeviceAction", "import_OpenAppWithDependenciesDeviceAction", "import_SendCommandInAppDeviceAction", "import_XStateDeviceAction", "import_StaticDeviceModelDataSource", "import_BleDeviceInfos", "import_ApduResponse", "import_DeviceSessionState", "import_GenuineCheckDeviceAction", "import_InstallAppDeviceAction", "import_ListInstalledAppsDeviceAction", "import_UninstallAppDeviceAction", "import_DefaultApduReceiverService", "import_DefaultApduSenderService", "import_FramerUtils", "import_DeviceManagementKit", "import_DeviceManagementKitBuilder", "import_LogLevel", "import_ConsoleLogger", "import_WebLogsExporterLogger", "import_ConnectedDevice", "import_DeviceConnectionStateMachine", "import_TransportConnectedDevice", "import_Base64String", "import_HexaString"]
|
7
7
|
}
|
package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var g=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var O=(o,t)=>{for(var s in t)g(o,s,{get:t[s],enumerable:!0})},
|
1
|
+
"use strict";var g=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var O=(o,t)=>{for(var s in t)g(o,s,{get:t[s],enumerable:!0})},A=(o,t,s,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of x(t))!w.call(o,a)&&a!==s&&g(o,a,{get:()=>t[a],enumerable:!(u=I(t,a))||u.enumerable});return o};var F=o=>A(g({},"__esModule",{value:!0}),o);var M={};O(M,{GenuineCheckDeviceAction:()=>T});module.exports=F(M);var m=require("purify-ts"),n=require("xstate"),d=require("../../../command/model/CommandResult"),D=require("../../../command/os/GetOsVersionCommand"),l=require("../../../device-action/model/UserInteractionRequired"),V=require("../../../device-action/os/Const"),k=require("../../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),C=require("../../../device-action/xstate-utils/XStateDeviceAction"),G=require("../../../device-session/DeviceSessionState"),f=require("../../../secure-channel/task/ConnectToSecureChannelTask"),h=require("../../../secure-channel/task/types"),E=require("../../../secure-channel/utils");class T extends C.XStateDeviceAction{makeStateMachine(t){const{getOsVersion:s,getDeviceVersion:u,getFirmwareVersion:a,genuineCheck:v,getDeviceSessionState:i,setDeviceSessionState:c}=this.extractDependencies(t),p=this.input.unlockTimeout??V.DEFAULT_UNLOCK_TIMEOUT_MS,S=new k.GoToDashboardDeviceAction({input:{unlockTimeout:p}}).makeStateMachine(t);return(0,n.setup)({types:{input:{},context:{},output:{}},actors:{goToDashboard:S,getOsVersion:(0,n.fromPromise)(s),getDeviceVersion:(0,n.fromPromise)(u),getFirmwareVersion:(0,n.fromPromise)(a),genuineCheck:(0,n.fromObservable)(v)},guards:{hasError:e=>e.context._internalState.error!==null},actions:{assignErrorFromEvent:(0,n.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"GenuineCheckDeviceAction",initial:"DeviceReady",context:e=>({input:{unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:l.UserInteractionRequired.None},_internalState:{error:null,result:{isGenuine:!1},getOsVersionResponse:null,deviceVersion:null,firmwareVersion:null}}),states:{DeviceReady:{always:{target:"GoToDashboard"}},GoToDashboard:{invoke:{id:"goToDashboard",src:"goToDashboard",input:e=>({unlockTimeout:e.context.input.unlockTimeout}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:e.event.snapshot.context.intermediateValue.requiredUserInteraction})})},onDone:{target:"GoToDashboardCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GoToDashboardCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetOsVersion"}]},GetOsVersion:{invoke:{id:"getOsVersion",src:"getOsVersion",input:e=>{},onDone:{target:"GetOsVersionCheck",actions:(0,n.assign)({_internalState:e=>{if((0,d.isSuccessCommandResult)(e.event.output)){const r=i(),y=e.event.output.data.secureElementFlags.isSecureConnectionAllowed;return r.sessionStateType!==G.DeviceSessionStateType.Connected&&c({...r,isSecureConnectionAllowed:y}),{...e.context._internalState,getOsVersionResponse:e.event.output.data}}return{...e.context._internalState,error:e.event.output.error}}})}}},GetOsVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetDeviceVersion"}]},GetDeviceVersion:{invoke:{id:"getDeviceVersion",src:"getDeviceVersion",input:e=>({deviceInfo:e.context._internalState.getOsVersionResponse}),onDone:{target:"GetDeviceVersionCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:r=>({...e.context._internalState,deviceVersion:r}),Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetDeviceVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetFirmwareVersion"}]},GetFirmwareVersion:{invoke:{id:"getFirmwareVersion",src:"getFirmwareVersion",input:e=>({deviceInfo:e.context._internalState.getOsVersionResponse,deviceVersion:e.context._internalState.deviceVersion}),onDone:{target:"GetFirmwareVersionCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:r=>({...e.context._internalState,firmwareVersion:r}),Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetFirmwareVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GenuineCheck"}]},GenuineCheck:{invoke:{id:"genuineCheck",src:"genuineCheck",input:e=>({deviceInfo:e.context._internalState.getOsVersionResponse,finalFirmware:e.context._internalState.firmwareVersion}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>{switch(e.event.snapshot.context?.type){case h.SecureChannelEventType.PermissionRequested:return{requiredUserInteraction:l.UserInteractionRequired.AllowSecureConnection};case h.SecureChannelEventType.PermissionGranted:return{requiredUserInteraction:l.UserInteractionRequired.None};default:return{...e.context.intermediateValue}}},_internalState:e=>e.event.snapshot.context?.type===h.SecureChannelEventType.Error?{...e.context._internalState,error:e.event.snapshot.context.error.mapDAErrors()}:e.event.snapshot.context?.type===h.SecureChannelEventType.Result?{...e.context._internalState,result:{isGenuine:(0,E.isDeviceGenuine)(e.event.snapshot.context.payload)}}:e.context._internalState})},onDone:{target:"GenuineCheckCheck"},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GenuineCheckCheck:{always:[{target:"Error",guard:"hasError"},{target:"Success"}]},Success:{type:"final"},Error:{type:"final"}},output:e=>e.context._internalState.error?(0,m.Left)(e.context._internalState.error):(0,m.Right)(e.context._internalState.result)})}extractDependencies(t){return{getOsVersion:()=>t.sendCommand(new D.GetOsVersionCommand),getDeviceVersion:({input:i})=>{const{deviceInfo:c}=i;return t.getManagerApiService().getDeviceVersion(c)},getFirmwareVersion:({input:i})=>{const{deviceInfo:c,deviceVersion:p}=i;return t.getManagerApiService().getFirmwareVersion(c,p)},genuineCheck:({input:i})=>{const{deviceInfo:c,finalFirmware:p}=i,S=t.getSecureChannelService().genuineCheck(c,p);return new f.ConnectToSecureChannelTask(t,{connection:S}).run()},getDeviceSessionState:()=>t.getDeviceSessionState(),setDeviceSessionState:i=>t.setDeviceSessionState(i)}}}0&&(module.exports={GenuineCheckDeviceAction});
|
2
2
|
//# sourceMappingURL=GenuineCheckDeviceAction.js.map
|