@ledgerhq/device-management-kit 0.0.0-try-to-fix-20250429171448 → 0.0.0-web-ble-29-08---20250829104351

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (669) hide show
  1. package/lib/cjs/package.json +22 -23
  2. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  3. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +2 -2
  4. package/lib/cjs/src/api/DeviceManagementKitBuilder.js +1 -1
  5. package/lib/cjs/src/api/DeviceManagementKitBuilder.js.map +2 -2
  6. package/lib/cjs/src/api/DmkConfig.js +1 -1
  7. package/lib/cjs/src/api/DmkConfig.js.map +1 -1
  8. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
  9. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
  10. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
  11. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
  12. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js +1 -1
  13. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
  14. package/lib/cjs/src/api/command/di/commandModule.js +1 -1
  15. package/lib/cjs/src/api/command/di/commandModule.js.map +3 -3
  16. package/lib/cjs/src/api/command/di/commandModule.test.js +1 -1
  17. package/lib/cjs/src/api/command/di/commandModule.test.js.map +2 -2
  18. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js +2 -0
  19. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js.map +7 -0
  20. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js +2 -0
  21. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js.map +7 -0
  22. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js +1 -1
  23. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  24. package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js +1 -1
  25. package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
  26. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.js +2 -0
  27. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.js.map +7 -0
  28. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.test.js +2 -0
  29. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.test.js.map +7 -0
  30. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  31. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  32. package/lib/cjs/src/api/command/utils/CommandUtils.js +1 -1
  33. package/lib/cjs/src/api/command/utils/CommandUtils.js.map +2 -2
  34. package/lib/cjs/src/api/command/utils/CommandUtils.test.js +1 -1
  35. package/lib/cjs/src/api/command/utils/CommandUtils.test.js.map +2 -2
  36. package/lib/cjs/src/api/command/utils/GlobalCommandError.js +1 -1
  37. package/lib/cjs/src/api/command/utils/GlobalCommandError.js.map +2 -2
  38. package/lib/cjs/src/api/device/DeviceModel.js +1 -1
  39. package/lib/cjs/src/api/device/DeviceModel.js.map +2 -2
  40. package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
  41. package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
  42. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  43. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  44. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  45. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  46. package/lib/cjs/src/api/device-action/di/deviceActionModule.js +1 -1
  47. package/lib/cjs/src/api/device-action/di/deviceActionModule.js.map +3 -3
  48. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js +1 -1
  49. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  50. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
  51. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  52. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  53. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
  54. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  55. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  56. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -1
  57. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +1 -1
  58. package/lib/cjs/src/api/device-action/os/Errors.js +1 -1
  59. package/lib/cjs/src/api/device-action/os/Errors.js.map +3 -3
  60. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +2 -0
  61. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +7 -0
  62. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +2 -0
  63. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +7 -0
  64. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js +2 -0
  65. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +7 -0
  66. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  67. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
  68. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  69. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
  70. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
  71. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
  72. package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js +1 -1
  73. package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js.map +1 -1
  74. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
  75. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
  76. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
  77. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
  78. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +2 -0
  79. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
  80. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
  81. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +2 -2
  82. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  83. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
  84. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  85. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
  86. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -1
  87. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js.map +1 -1
  88. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
  89. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
  90. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
  91. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
  92. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js +2 -0
  93. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
  94. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  95. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
  96. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  97. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  98. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js +1 -1
  99. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +1 -1
  100. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
  101. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
  102. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
  103. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
  104. package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.js +2 -0
  105. package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.js.map +7 -0
  106. package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.test.js +2 -0
  107. package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.test.js.map +7 -0
  108. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js +2 -0
  109. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js.map +7 -0
  110. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js +2 -0
  111. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +7 -0
  112. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
  113. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
  114. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
  115. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
  116. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  117. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +2 -2
  118. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  119. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
  120. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.js +1 -1
  121. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.js.map +2 -2
  122. package/lib/cjs/src/api/device-model/model/DeviceModel.js +1 -1
  123. package/lib/cjs/src/api/device-model/model/DeviceModel.js.map +2 -2
  124. package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js +1 -1
  125. package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
  126. package/lib/cjs/src/api/device-session/DeviceSessionState.js +1 -1
  127. package/lib/cjs/src/api/device-session/DeviceSessionState.js.map +2 -2
  128. package/lib/cjs/src/api/index.js +1 -1
  129. package/lib/cjs/src/api/index.js.map +3 -3
  130. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
  131. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  132. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +1 -1
  133. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
  134. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +3 -3
  135. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js +1 -1
  136. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +1 -1
  137. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
  138. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
  139. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
  140. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
  141. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
  142. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +3 -3
  143. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js +1 -1
  144. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +1 -1
  145. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  146. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  147. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
  148. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
  149. package/lib/cjs/src/api/secure-channel/task/types.js +1 -1
  150. package/lib/cjs/src/api/secure-channel/task/types.js.map +2 -2
  151. package/lib/cjs/src/api/secure-channel/utils.js +1 -1
  152. package/lib/cjs/src/api/secure-channel/utils.js.map +3 -3
  153. package/lib/cjs/src/api/secure-channel/utils.test.js +1 -1
  154. package/lib/cjs/src/api/secure-channel/utils.test.js.map +3 -3
  155. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  156. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
  157. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js +2 -0
  158. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
  159. package/lib/cjs/src/api/transport/model/Errors.js +1 -1
  160. package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
  161. package/lib/cjs/src/api/types.js +1 -1
  162. package/lib/cjs/src/api/types.js.map +1 -1
  163. package/lib/cjs/src/api/utils/AppName.js +2 -0
  164. package/lib/cjs/src/api/utils/AppName.js.map +7 -0
  165. package/lib/cjs/src/api/utils/AppName.test.js +2 -0
  166. package/lib/cjs/src/api/utils/AppName.test.js.map +7 -0
  167. package/lib/cjs/src/di.js +1 -1
  168. package/lib/cjs/src/di.js.map +2 -2
  169. package/lib/cjs/src/internal/config/di/configModule.js +1 -1
  170. package/lib/cjs/src/internal/config/di/configModule.js.map +3 -3
  171. package/lib/cjs/src/internal/config/di/configModule.test.js +1 -1
  172. package/lib/cjs/src/internal/config/di/configModule.test.js.map +2 -2
  173. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js +1 -1
  174. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  175. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  176. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  177. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  178. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  179. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  180. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  181. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  182. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +2 -2
  183. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
  184. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
  185. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
  186. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +2 -2
  187. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  188. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  189. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  190. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  191. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  192. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  193. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  194. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  195. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  196. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +2 -2
  197. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
  198. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +3 -3
  199. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  200. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  201. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js +1 -1
  202. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  203. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  204. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  205. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  206. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  207. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  208. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  209. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
  210. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
  211. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js +1 -1
  212. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  213. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  214. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  215. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
  216. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  217. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  218. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  219. package/lib/cjs/src/internal/manager-api/model/Application.js +1 -1
  220. package/lib/cjs/src/internal/manager-api/model/Application.js.map +1 -1
  221. package/lib/cjs/src/internal/manager-api/model/Const.js +1 -1
  222. package/lib/cjs/src/internal/manager-api/model/Const.js.map +3 -3
  223. package/lib/cjs/src/internal/manager-api/model/Firmware.js +1 -1
  224. package/lib/cjs/src/internal/manager-api/model/Firmware.js.map +1 -1
  225. package/lib/cjs/src/internal/manager-api/model/Language.js +2 -0
  226. package/lib/cjs/src/internal/manager-api/model/Language.js.map +7 -0
  227. package/lib/cjs/src/internal/manager-api/model/Params.js +1 -1
  228. package/lib/cjs/src/internal/manager-api/model/Params.js.map +1 -1
  229. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  230. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  231. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  232. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  233. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
  234. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
  235. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js +1 -1
  236. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js.map +3 -3
  237. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js +1 -1
  238. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +3 -3
  239. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  240. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  241. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  242. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  243. package/lib/cjs/src/internal/secure-channel/model/Errors.js +1 -1
  244. package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +3 -3
  245. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
  246. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
  247. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +1 -1
  248. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +3 -3
  249. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js +1 -1
  250. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js.map +1 -1
  251. package/lib/cjs/src/internal/send/di/sendModule.js +1 -1
  252. package/lib/cjs/src/internal/send/di/sendModule.js.map +3 -3
  253. package/lib/cjs/src/internal/send/di/sendModule.test.js +1 -1
  254. package/lib/cjs/src/internal/send/di/sendModule.test.js.map +2 -2
  255. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js +1 -1
  256. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
  257. package/lib/cjs/src/internal/transport/di/transportModule.js +1 -1
  258. package/lib/cjs/src/internal/transport/di/transportModule.js.map +3 -3
  259. package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
  260. package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
  261. package/lib/esm/package.json +22 -23
  262. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  263. package/lib/esm/src/api/DeviceManagementKit.test.js.map +2 -2
  264. package/lib/esm/src/api/DeviceManagementKitBuilder.js +1 -1
  265. package/lib/esm/src/api/DeviceManagementKitBuilder.js.map +3 -3
  266. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
  267. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
  268. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
  269. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
  270. package/lib/esm/src/api/apdu/utils/ByteArrayParser.js +1 -1
  271. package/lib/esm/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
  272. package/lib/esm/src/api/command/di/commandModule.js +1 -1
  273. package/lib/esm/src/api/command/di/commandModule.js.map +3 -3
  274. package/lib/esm/src/api/command/di/commandModule.test.js +1 -1
  275. package/lib/esm/src/api/command/di/commandModule.test.js.map +2 -2
  276. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js +2 -0
  277. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js.map +7 -0
  278. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js +2 -0
  279. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js.map +7 -0
  280. package/lib/esm/src/api/command/os/GetOsVersionCommand.js +1 -1
  281. package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  282. package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js +1 -1
  283. package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
  284. package/lib/esm/src/api/command/os/ListLanguagePackCommand.js +2 -0
  285. package/lib/esm/src/api/command/os/ListLanguagePackCommand.js.map +7 -0
  286. package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js +2 -0
  287. package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js.map +7 -0
  288. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  289. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  290. package/lib/esm/src/api/command/utils/CommandUtils.js +1 -1
  291. package/lib/esm/src/api/command/utils/CommandUtils.js.map +3 -3
  292. package/lib/esm/src/api/command/utils/CommandUtils.test.js +1 -1
  293. package/lib/esm/src/api/command/utils/CommandUtils.test.js.map +2 -2
  294. package/lib/esm/src/api/command/utils/GlobalCommandError.js +1 -1
  295. package/lib/esm/src/api/command/utils/GlobalCommandError.js.map +2 -2
  296. package/lib/esm/src/api/device/DeviceModel.js +1 -1
  297. package/lib/esm/src/api/device/DeviceModel.js.map +2 -2
  298. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  299. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  300. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  301. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  302. package/lib/esm/src/api/device-action/di/deviceActionModule.js +1 -1
  303. package/lib/esm/src/api/device-action/di/deviceActionModule.js.map +3 -3
  304. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js +1 -1
  305. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  306. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
  307. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  308. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  309. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
  310. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  311. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  312. package/lib/esm/src/api/device-action/os/Errors.js +1 -1
  313. package/lib/esm/src/api/device-action/os/Errors.js.map +3 -3
  314. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +2 -0
  315. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +7 -0
  316. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +2 -0
  317. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +7 -0
  318. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js +1 -0
  319. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js.map +7 -0
  320. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  321. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
  322. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  323. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
  324. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
  325. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
  326. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
  327. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
  328. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
  329. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
  330. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -0
  331. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
  332. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
  333. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +2 -2
  334. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  335. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
  336. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  337. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  338. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
  339. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
  340. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
  341. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
  342. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -0
  343. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
  344. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  345. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
  346. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  347. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  348. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
  349. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
  350. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
  351. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
  352. package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.js +2 -0
  353. package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.js.map +7 -0
  354. package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.test.js +2 -0
  355. package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.test.js.map +7 -0
  356. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js +2 -0
  357. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js.map +7 -0
  358. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js +2 -0
  359. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +7 -0
  360. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
  361. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
  362. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
  363. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
  364. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  365. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +2 -2
  366. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  367. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
  368. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.js +1 -1
  369. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.js.map +2 -2
  370. package/lib/esm/src/api/device-model/model/DeviceModel.js +1 -1
  371. package/lib/esm/src/api/device-model/model/DeviceModel.js.map +2 -2
  372. package/lib/esm/src/api/device-model/model/DeviceModel.stub.js +1 -1
  373. package/lib/esm/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
  374. package/lib/esm/src/api/device-session/DeviceSessionState.js +1 -1
  375. package/lib/esm/src/api/device-session/DeviceSessionState.js.map +2 -2
  376. package/lib/esm/src/api/index.js +1 -1
  377. package/lib/esm/src/api/index.js.map +3 -3
  378. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
  379. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  380. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
  381. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +3 -3
  382. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
  383. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
  384. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
  385. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
  386. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
  387. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +3 -3
  388. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  389. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  390. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
  391. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
  392. package/lib/esm/src/api/secure-channel/task/types.js +1 -1
  393. package/lib/esm/src/api/secure-channel/task/types.js.map +2 -2
  394. package/lib/esm/src/api/secure-channel/utils.js +1 -1
  395. package/lib/esm/src/api/secure-channel/utils.js.map +3 -3
  396. package/lib/esm/src/api/secure-channel/utils.test.js +1 -1
  397. package/lib/esm/src/api/secure-channel/utils.test.js.map +3 -3
  398. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  399. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
  400. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js +2 -0
  401. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
  402. package/lib/esm/src/api/transport/model/Errors.js +1 -1
  403. package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
  404. package/lib/esm/src/api/utils/AppName.js +2 -0
  405. package/lib/esm/src/api/utils/AppName.js.map +7 -0
  406. package/lib/esm/src/api/utils/AppName.test.js +2 -0
  407. package/lib/esm/src/api/utils/AppName.test.js.map +7 -0
  408. package/lib/esm/src/di.js +1 -1
  409. package/lib/esm/src/di.js.map +3 -3
  410. package/lib/esm/src/internal/config/di/configModule.js +1 -1
  411. package/lib/esm/src/internal/config/di/configModule.js.map +3 -3
  412. package/lib/esm/src/internal/config/di/configModule.test.js +1 -1
  413. package/lib/esm/src/internal/config/di/configModule.test.js.map +2 -2
  414. package/lib/esm/src/internal/device-model/di/deviceModelModule.js +1 -1
  415. package/lib/esm/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  416. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  417. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  418. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  419. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  420. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  421. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  422. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  423. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +2 -2
  424. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
  425. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
  426. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
  427. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +2 -2
  428. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  429. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  430. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  431. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  432. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  433. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  434. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  435. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  436. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  437. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +2 -2
  438. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
  439. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +3 -3
  440. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  441. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  442. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js +1 -1
  443. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  444. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  445. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  446. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  447. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  448. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  449. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  450. package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js +1 -1
  451. package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  452. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  453. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  454. package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
  455. package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  456. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  457. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  458. package/lib/esm/src/internal/manager-api/model/Application.js +1 -1
  459. package/lib/esm/src/internal/manager-api/model/Application.js.map +1 -1
  460. package/lib/esm/src/internal/manager-api/model/Const.js +1 -1
  461. package/lib/esm/src/internal/manager-api/model/Const.js.map +3 -3
  462. package/lib/esm/src/internal/manager-api/model/Language.js +1 -0
  463. package/lib/esm/src/internal/manager-api/model/Language.js.map +7 -0
  464. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  465. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  466. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  467. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  468. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js +1 -1
  469. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js.map +3 -3
  470. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js +1 -1
  471. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +3 -3
  472. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  473. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  474. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  475. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  476. package/lib/esm/src/internal/secure-channel/model/Errors.js +1 -1
  477. package/lib/esm/src/internal/secure-channel/model/Errors.js.map +3 -3
  478. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
  479. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +1 -1
  480. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +3 -3
  481. package/lib/esm/src/internal/send/di/sendModule.js +1 -1
  482. package/lib/esm/src/internal/send/di/sendModule.js.map +3 -3
  483. package/lib/esm/src/internal/send/di/sendModule.test.js +1 -1
  484. package/lib/esm/src/internal/send/di/sendModule.test.js.map +2 -2
  485. package/lib/esm/src/internal/send/use-case/SendApduUseCase.js +1 -1
  486. package/lib/esm/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
  487. package/lib/esm/src/internal/transport/di/transportModule.js +1 -1
  488. package/lib/esm/src/internal/transport/di/transportModule.js.map +3 -3
  489. package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
  490. package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
  491. package/lib/types/src/api/DeviceManagementKitBuilder.d.ts.map +1 -1
  492. package/lib/types/src/api/DmkConfig.d.ts +1 -0
  493. package/lib/types/src/api/DmkConfig.d.ts.map +1 -1
  494. package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts.map +1 -1
  495. package/lib/types/src/api/apdu/utils/ApduParser.d.ts.map +1 -1
  496. package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts +28 -0
  497. package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts.map +1 -1
  498. package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts +1 -0
  499. package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts.map +1 -1
  500. package/lib/types/src/api/command/di/commandModule.d.ts.map +1 -1
  501. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts +16 -0
  502. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts.map +1 -0
  503. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts +2 -0
  504. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts.map +1 -0
  505. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +30 -2
  506. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
  507. package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts +24 -0
  508. package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts.map +1 -0
  509. package/lib/types/src/api/command/os/ListLanguagePackCommand.test.d.ts +2 -0
  510. package/lib/types/src/api/command/os/ListLanguagePackCommand.test.d.ts.map +1 -0
  511. package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
  512. package/lib/types/src/api/command/utils/CommandErrors.d.ts.map +1 -1
  513. package/lib/types/src/api/command/utils/CommandUtils.d.ts +3 -0
  514. package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
  515. package/lib/types/src/api/command/utils/GlobalCommandError.d.ts +1 -1
  516. package/lib/types/src/api/command/utils/GlobalCommandError.d.ts.map +1 -1
  517. package/lib/types/src/api/device/DeviceModel.d.ts +2 -1
  518. package/lib/types/src/api/device/DeviceModel.d.ts.map +1 -1
  519. package/lib/types/src/api/device-action/DeviceAction.d.ts +2 -0
  520. package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
  521. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  522. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts +5 -0
  523. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
  524. package/lib/types/src/api/device-action/di/deviceActionModule.d.ts.map +1 -1
  525. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +1 -0
  526. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
  527. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -1
  528. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +1 -1
  529. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -1
  530. package/lib/types/src/api/device-action/os/Errors.d.ts +20 -0
  531. package/lib/types/src/api/device-action/os/Errors.d.ts.map +1 -1
  532. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts +58 -0
  533. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map +1 -0
  534. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.d.ts +2 -0
  535. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.d.ts.map +1 -0
  536. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +28 -0
  537. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -0
  538. package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
  539. package/lib/types/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.d.ts.map +1 -1
  540. package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts +3 -4
  541. package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts.map +1 -1
  542. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts +40 -0
  543. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -0
  544. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts +2 -0
  545. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts.map +1 -0
  546. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +65 -0
  547. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -0
  548. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts.map +1 -1
  549. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts +0 -1
  550. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
  551. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts +15 -0
  552. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -0
  553. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts +2 -0
  554. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts.map +1 -0
  555. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +24 -0
  556. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -0
  557. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.d.ts.map +1 -1
  558. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts +1 -1
  559. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
  560. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts +30 -0
  561. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -0
  562. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts +2 -0
  563. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts.map +1 -0
  564. package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.d.ts +31 -0
  565. package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.d.ts.map +1 -0
  566. package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.test.d.ts +2 -0
  567. package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.test.d.ts.map +1 -0
  568. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts +18 -0
  569. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts.map +1 -0
  570. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.test.d.ts +2 -0
  571. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.test.d.ts.map +1 -0
  572. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts +21 -0
  573. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts.map +1 -0
  574. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts +2 -0
  575. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts.map +1 -0
  576. package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts +1 -0
  577. package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts.map +1 -1
  578. package/lib/types/src/api/device-model/data/StaticDeviceModelDataSource.d.ts.map +1 -1
  579. package/lib/types/src/api/device-model/model/DeviceModel.d.ts +2 -0
  580. package/lib/types/src/api/device-model/model/DeviceModel.d.ts.map +1 -1
  581. package/lib/types/src/api/device-model/model/DeviceModel.stub.d.ts.map +1 -1
  582. package/lib/types/src/api/device-session/DeviceSessionState.d.ts +93 -0
  583. package/lib/types/src/api/device-session/DeviceSessionState.d.ts.map +1 -1
  584. package/lib/types/src/api/device-session/service/DefaultApduReceiverService.stub.d.ts.map +1 -1
  585. package/lib/types/src/api/device-session/service/DefaultApduSenderService.stub.d.ts.map +1 -1
  586. package/lib/types/src/api/index.d.ts +5 -1
  587. package/lib/types/src/api/index.d.ts.map +1 -1
  588. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -1
  589. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +2 -1
  590. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -1
  591. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -1
  592. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts +2 -1
  593. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts.map +1 -1
  594. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -1
  595. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts +2 -1
  596. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts.map +1 -1
  597. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts.map +1 -1
  598. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts +2 -1
  599. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -1
  600. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +5 -2
  601. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -1
  602. package/lib/types/src/api/secure-channel/task/types.d.ts +6 -1
  603. package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -1
  604. package/lib/types/src/api/secure-channel/utils.d.ts +0 -11
  605. package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -1
  606. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +8 -7
  607. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -1
  608. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts +2 -0
  609. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts.map +1 -0
  610. package/lib/types/src/api/transport/model/Errors.d.ts +7 -3
  611. package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
  612. package/lib/types/src/api/types.d.ts +4 -1
  613. package/lib/types/src/api/types.d.ts.map +1 -1
  614. package/lib/types/src/api/utils/AppName.d.ts +2 -0
  615. package/lib/types/src/api/utils/AppName.d.ts.map +1 -0
  616. package/lib/types/src/api/utils/AppName.test.d.ts +2 -0
  617. package/lib/types/src/api/utils/AppName.test.d.ts.map +1 -0
  618. package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
  619. package/lib/types/src/di.d.ts.map +1 -1
  620. package/lib/types/src/internal/config/di/configModule.d.ts.map +1 -1
  621. package/lib/types/src/internal/device-model/di/deviceModelModule.d.ts.map +1 -1
  622. package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
  623. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +1 -0
  624. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  625. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
  626. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts.map +1 -1
  627. package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts.map +1 -1
  628. package/lib/types/src/internal/discovery/di/discoveryModule.d.ts.map +1 -1
  629. package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts +3 -1
  630. package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts.map +1 -1
  631. package/lib/types/src/internal/logger-publisher/di/loggerModule.d.ts.map +1 -1
  632. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +20 -4
  633. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +1 -1
  634. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +41 -6
  635. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
  636. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts +104 -18
  637. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts.map +1 -1
  638. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +5 -0
  639. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
  640. package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
  641. package/lib/types/src/internal/manager-api/model/Application.d.ts +12 -12
  642. package/lib/types/src/internal/manager-api/model/Application.d.ts.map +1 -1
  643. package/lib/types/src/internal/manager-api/model/Const.d.ts +1 -0
  644. package/lib/types/src/internal/manager-api/model/Const.d.ts.map +1 -1
  645. package/lib/types/src/internal/manager-api/model/Firmware.d.ts +17 -3
  646. package/lib/types/src/internal/manager-api/model/Firmware.d.ts.map +1 -1
  647. package/lib/types/src/internal/manager-api/model/Language.d.ts +12 -0
  648. package/lib/types/src/internal/manager-api/model/Language.d.ts.map +1 -0
  649. package/lib/types/src/internal/manager-api/model/Params.d.ts +20 -0
  650. package/lib/types/src/internal/manager-api/model/Params.d.ts.map +1 -1
  651. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +7 -1
  652. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
  653. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +39 -1
  654. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
  655. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts +3 -1
  656. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts.map +1 -1
  657. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -1
  658. package/lib/types/src/internal/secure-channel/model/Errors.d.ts +22 -2
  659. package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -1
  660. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +2 -2
  661. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts.map +1 -1
  662. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts +3 -3
  663. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -1
  664. package/lib/types/src/internal/send/di/sendModule.d.ts.map +1 -1
  665. package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts +5 -1
  666. package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts.map +1 -1
  667. package/lib/types/src/internal/transport/di/transportModule.d.ts.map +1 -1
  668. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  669. package/package.json +17 -18
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/device-action/task/GetFirmwareMetadataTask.test.ts"],
4
+ "sourcesContent": ["import { EitherAsync } from \"purify-ts\";\n\nimport { InvalidStatusWordError } from \"@api/command/Errors\";\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport {\n type FinalFirmware,\n type McuFirmware,\n type OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\n\nimport { GetFirmwareMetadataTask } from \"./GetFirmwareMetadataTask\";\n\ndescribe(\"GetFirmwareMetadataTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n const OS_VERSION = {\n mcuSephVersion: \"mcu_version\",\n mcuBootloaderVersion: \"bl_version\",\n seVersion: \"se_version\",\n } as GetOsVersionResponse;\n\n const CUSTOM_IMAGE_SIZE = 97;\n\n const DEVICE_VERSION = {\n id: 7,\n };\n\n const FIRMWARE_VERSION = {\n id: 361,\n version: \"1.6.0\",\n perso: \"perso_11\",\n } as FinalFirmware;\n\n const OSU_VERSION = {\n id: 362,\n perso: \"perso_11\",\n } as OsuFirmware;\n\n const NEXT_FIRMWARE_VERSION = {\n id: 363,\n version: \"1.7.0\",\n perso: \"perso_11\",\n mcuVersions: [1],\n } as FinalFirmware;\n\n const MCUS = [\n {\n id: 3,\n name: \"other_version\",\n },\n {\n id: 1,\n name: \"mcu_version\",\n },\n ] as McuFirmware[];\n\n const MANAGER_MOCK = {\n getDeviceVersion: vi.fn(),\n getFirmwareVersion: vi.fn(),\n getLatestFirmwareVersion: vi.fn(),\n getNextFirmwareVersion: vi.fn(),\n getMcuList: vi.fn(),\n };\n\n beforeEach(() => {\n vi.clearAllMocks();\n\n apiMock.getManagerApiService.mockReturnValue(\n MANAGER_MOCK as unknown as ManagerApiService,\n );\n MANAGER_MOCK.getDeviceVersion.mockReturnValue(\n EitherAsync(async () => DEVICE_VERSION),\n );\n MANAGER_MOCK.getFirmwareVersion.mockReturnValue(\n EitherAsync(async () => FIRMWARE_VERSION),\n );\n MANAGER_MOCK.getLatestFirmwareVersion.mockReturnValue(\n EitherAsync(async () => OSU_VERSION),\n );\n MANAGER_MOCK.getNextFirmwareVersion.mockReturnValue(\n EitherAsync(async () => NEXT_FIRMWARE_VERSION),\n );\n MANAGER_MOCK.getMcuList.mockReturnValue(EitherAsync(async () => MCUS));\n });\n\n it(\"success with no firmware update available\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(CommandResultFactory({ data: CUSTOM_IMAGE_SIZE }));\n MANAGER_MOCK.getLatestFirmwareVersion.mockReturnValueOnce(\n EitherAsync(async ({ throwE }) => {\n throwE(new Error(\"error\"));\n }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: undefined,\n },\n customImage: { size: CUSTOM_IMAGE_SIZE },\n },\n }),\n );\n });\n\n it(\"success with a firmware update available\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: {\n osuFirmware: OSU_VERSION,\n finalFirmware: NEXT_FIRMWARE_VERSION,\n mcuUpdateRequired: false,\n },\n },\n customImage: {},\n },\n }),\n );\n expect(MANAGER_MOCK.getDeviceVersion).toHaveBeenCalledWith(OS_VERSION);\n expect(MANAGER_MOCK.getFirmwareVersion).toHaveBeenCalledWith(\n OS_VERSION,\n DEVICE_VERSION,\n );\n expect(MANAGER_MOCK.getLatestFirmwareVersion).toHaveBeenCalledWith(\n FIRMWARE_VERSION,\n DEVICE_VERSION,\n );\n expect(MANAGER_MOCK.getNextFirmwareVersion).toHaveBeenCalledWith(\n OSU_VERSION,\n );\n });\n\n it(\"success with a firmware update available and MCU update\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n const nextFirmware = {\n ...NEXT_FIRMWARE_VERSION,\n mcuVersions: [3],\n };\n MANAGER_MOCK.getNextFirmwareVersion.mockReturnValue(\n EitherAsync(async () => nextFirmware),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: {\n osuFirmware: OSU_VERSION,\n finalFirmware: nextFirmware,\n mcuUpdateRequired: true,\n },\n },\n customImage: {},\n },\n }),\n );\n });\n\n it(\"should fail when OS version cannot be retrieved\", async () => {\n // GIVEN\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n });\n\n it(\"should fail if device version cannot be fetched\", async () => {\n // GIVEN\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({ data: OS_VERSION }),\n );\n MANAGER_MOCK.getDeviceVersion.mockReturnValueOnce(\n EitherAsync(async ({ throwE }) => {\n throwE(new Error(\"error\"));\n }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: new InvalidStatusWordError(\n \"Cannot fetch current firmware metadata\",\n ),\n }),\n );\n });\n\n it(\"should fail if firmware version cannot be fetched\", async () => {\n // GIVEN\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({ data: OS_VERSION }),\n );\n MANAGER_MOCK.getFirmwareVersion.mockReturnValueOnce(\n EitherAsync(async ({ throwE }) => {\n throwE(new Error(\"error\"));\n }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: new InvalidStatusWordError(\n \"Cannot fetch current firmware metadata\",\n ),\n }),\n );\n });\n});\n"],
5
+ "mappings":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AClBH,EAAqB,CAAE,KAAMI,CAAW,CAAC,CAC3C,EACAO,EAAa,mBAAmB,oBAC9Bb,EAAY,MAAO,CAAE,OAAAc,CAAO,IAAM,CAChCA,EAAO,IAAI,MAAM,OAAO,CAAC,CAC3B,CAAC,CACH,EAGA,MAAMC,EAAS,MAAM,IAAIX,EAAwBC,CAAO,EAAE,IAAI,EAG9D,OAAOU,CAAM,EAAE,cACbb,EAAqB,CACnB,MAAO,IAAID,EACT,wCACF,CACF,CAAC,CACH,CACF,CAAC,CACH,CAAC",
6
+ "names": ["EitherAsync", "InvalidStatusWordError", "CommandResultFactory", "makeDeviceActionInternalApiMock", "GetFirmwareMetadataTask", "apiMock", "OS_VERSION", "CUSTOM_IMAGE_SIZE", "DEVICE_VERSION", "FIRMWARE_VERSION", "OSU_VERSION", "NEXT_FIRMWARE_VERSION", "MCUS", "MANAGER_MOCK", "throwE", "result", "nextFirmware"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{UnknownDAError as i}from"../../device-action/os/Errors";import{DeviceSessionStateType as m}from"../../device-session/DeviceSessionState";class k{constructor(e,s){this.api=e;this.args=s;const r=e.getDeviceModel();this.blockSize=r.blockSize,this.memoryBlocks=Math.floor(r.memorySize/this.blockSize)}blockSize;memoryBlocks;run(){const e=this.api.getDeviceSessionState();if(e.sessionStateType===m.Connected)return{error:new i("Invalid device state")};if(e.firmwareUpdateContext===void 0||e.customImage===void 0||e.installedLanguages===void 0)return{error:new i("Device metadata not fetched")};const s=this.bytesToBlocks(e.firmwareUpdateContext.currentFirmware.bytes||0),r=this.bytesToBlocks(e.customImage.size||0),n=e.installedApps.reduce((t,o)=>t+this.bytesToBlocks(o.bytes||0),0),a=e.installedLanguages.reduce((t,o)=>t+this.bytesToBlocks(o.size),0),c=s+r+n+a,l=this.memoryBlocks-c;return{outOfMemory:this.args.installPlan.reduce((t,o)=>t+this.bytesToBlocks(o.bytes||0),0)>l}}bytesToBlocks(e){return Math.ceil(e/this.blockSize)}}export{k as PredictOutOfMemoryTask};
2
+ //# sourceMappingURL=PredictOutOfMemoryTask.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/device-action/task/PredictOutOfMemoryTask.ts"],
4
+ "sourcesContent": ["import type { InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport type { Application } from \"@internal/manager-api/model/Application\";\n\nexport type PredictOutOfMemoryTaskArgs = {\n installPlan: Application[];\n};\n\nexport type PredictOutOfMemoryTaskResult =\n | {\n outOfMemory: boolean;\n }\n | {\n error: UnknownDAError;\n };\n\nexport class PredictOutOfMemoryTask {\n private readonly blockSize: number;\n private readonly memoryBlocks: number;\n\n constructor(\n private readonly api: InternalApi,\n private readonly args: PredictOutOfMemoryTaskArgs,\n ) {\n const deviceModel = api.getDeviceModel();\n this.blockSize = deviceModel.blockSize;\n this.memoryBlocks = Math.floor(deviceModel.memorySize / this.blockSize);\n }\n\n run(): PredictOutOfMemoryTaskResult {\n // Get device session state.\n const deviceState = this.api.getDeviceSessionState();\n if (deviceState.sessionStateType === DeviceSessionStateType.Connected) {\n return { error: new UnknownDAError(\"Invalid device state\") };\n }\n\n // Ensure the device metadata were correctly fetched.\n if (\n deviceState.firmwareUpdateContext === undefined ||\n deviceState.customImage === undefined ||\n deviceState.installedLanguages === undefined\n ) {\n return { error: new UnknownDAError(\"Device metadata not fetched\") };\n }\n\n // Compute device memory layout\n const firmwareBlocks = this.bytesToBlocks(\n deviceState.firmwareUpdateContext.currentFirmware.bytes || 0,\n );\n const customImageBlocks = this.bytesToBlocks(\n deviceState.customImage.size || 0,\n );\n const applicationsBlocks = deviceState.installedApps.reduce(\n (size, app) => size + this.bytesToBlocks(app.bytes || 0),\n 0,\n );\n const languagesBlocks = deviceState.installedLanguages.reduce(\n (size, lang) => size + this.bytesToBlocks(lang.size),\n 0,\n );\n const usedBlocks =\n firmwareBlocks + customImageBlocks + applicationsBlocks + languagesBlocks;\n const availableBlocks = this.memoryBlocks - usedBlocks;\n\n // Compute install plan memory consumption\n const installPlanBlocks = this.args.installPlan.reduce(\n (size, app) => size + this.bytesToBlocks(app.bytes || 0),\n 0,\n );\n return { outOfMemory: installPlanBlocks > availableBlocks };\n }\n\n private bytesToBlocks(size: number) {\n return Math.ceil(size / this.blockSize);\n }\n}\n"],
5
+ "mappings": "AACA,OAAS,kBAAAA,MAAsB,+BAC/B,OAAS,0BAAAC,MAA8B,yCAehC,MAAMC,CAAuB,CAIlC,YACmBC,EACAC,EACjB,CAFiB,SAAAD,EACA,UAAAC,EAEjB,MAAMC,EAAcF,EAAI,eAAe,EACvC,KAAK,UAAYE,EAAY,UAC7B,KAAK,aAAe,KAAK,MAAMA,EAAY,WAAa,KAAK,SAAS,CACxE,CAViB,UACA,aAWjB,KAAoC,CAElC,MAAMC,EAAc,KAAK,IAAI,sBAAsB,EACnD,GAAIA,EAAY,mBAAqBL,EAAuB,UAC1D,MAAO,CAAE,MAAO,IAAID,EAAe,sBAAsB,CAAE,EAI7D,GACEM,EAAY,wBAA0B,QACtCA,EAAY,cAAgB,QAC5BA,EAAY,qBAAuB,OAEnC,MAAO,CAAE,MAAO,IAAIN,EAAe,6BAA6B,CAAE,EAIpE,MAAMO,EAAiB,KAAK,cAC1BD,EAAY,sBAAsB,gBAAgB,OAAS,CAC7D,EACME,EAAoB,KAAK,cAC7BF,EAAY,YAAY,MAAQ,CAClC,EACMG,EAAqBH,EAAY,cAAc,OACnD,CAACI,EAAMC,IAAQD,EAAO,KAAK,cAAcC,EAAI,OAAS,CAAC,EACvD,CACF,EACMC,EAAkBN,EAAY,mBAAmB,OACrD,CAACI,EAAMG,IAASH,EAAO,KAAK,cAAcG,EAAK,IAAI,EACnD,CACF,EACMC,EACJP,EAAiBC,EAAoBC,EAAqBG,EACtDG,EAAkB,KAAK,aAAeD,EAO5C,MAAO,CAAE,YAJiB,KAAK,KAAK,YAAY,OAC9C,CAACJ,EAAMC,IAAQD,EAAO,KAAK,cAAcC,EAAI,OAAS,CAAC,EACvD,CACF,EAC0CI,CAAgB,CAC5D,CAEQ,cAAcL,EAAc,CAClC,OAAO,KAAK,KAAKA,EAAO,KAAK,SAAS,CACxC,CACF",
6
+ "names": ["UnknownDAError", "DeviceSessionStateType", "PredictOutOfMemoryTask", "api", "args", "deviceModel", "deviceState", "firmwareBlocks", "customImageBlocks", "applicationsBlocks", "size", "app", "languagesBlocks", "lang", "usedBlocks", "availableBlocks"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{DeviceStatus as n}from"../../device/DeviceStatus";import{makeDeviceActionInternalApiMock as o}from"../../device-action/__test-utils__/makeInternalApi";import{UnknownDAError as i}from"../../device-action/os/Errors";import{DeviceSessionStateType as s}from"../../device-session/DeviceSessionState";import{PredictOutOfMemoryTask as a}from"./PredictOutOfMemoryTask";describe("PredictOutOfMemoryTask",()=>{const e=o();beforeEach(()=>{vi.clearAllMocks(),e.getDeviceModel.mockReturnValue({memorySize:1569792,blockSize:32})}),it("Success enough memory",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:n.CONNECTED,firmwareUpdateContext:{currentFirmware:{bytes:397824}},customImage:{size:51893},installedApps:[{bytes:305442},{bytes:514598},{bytes:271583}],installedLanguages:[{id:1,size:20480}]});const t=new a(e,{installPlan:[{bytes:1324},{bytes:6559}]}).run();expect(t).toStrictEqual({outOfMemory:!1})}),it("Success not enough memory",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:n.CONNECTED,firmwareUpdateContext:{currentFirmware:{bytes:397824}},customImage:{size:51893},installedApps:[{bytes:305442},{bytes:514598},{bytes:271583}],installedLanguages:[{id:1,size:20480}]});const t=new a(e,{installPlan:[{bytes:1324},{bytes:6559},{bytes:1}]}).run();expect(t).toStrictEqual({outOfMemory:!0})}),it("Success undefined sizes",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:n.CONNECTED,firmwareUpdateContext:{currentFirmware:{bytes:397824}},customImage:{},installedApps:[{bytes:305442},{bytes:null},{bytes:271583}],installedLanguages:[]});const t=new a(e,{installPlan:[{bytes:1324},{bytes:6559}]}).run();expect(t).toStrictEqual({outOfMemory:!1})}),it("Error when device is in incorrect state",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:s.Connected,deviceStatus:n.CONNECTED});const t=new a(e,{installPlan:[{bytes:1324}]}).run();expect(t).toStrictEqual({error:new i("Invalid device state")})}),it("Error when device session was not populated",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:s.ReadyWithoutSecureChannel,deviceStatus:n.CONNECTED,installedApps:[]});const t=new a(e,{installPlan:[{bytes:1324}]}).run();expect(t).toStrictEqual({error:new i("Device metadata not fetched")})})});
2
+ //# sourceMappingURL=PredictOutOfMemoryTask.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/device-action/task/PredictOutOfMemoryTask.test.ts"],
4
+ "sourcesContent": ["import { 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\";\nimport type { FinalFirmware } from \"@internal/manager-api/model/Firmware\";\n\nimport { PredictOutOfMemoryTask } from \"./PredictOutOfMemoryTask\";\n\ndescribe(\"PredictOutOfMemoryTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n vi.clearAllMocks();\n apiMock.getDeviceModel.mockReturnValue({\n memorySize: 1569792,\n blockSize: 32,\n } as unknown as TransportDeviceModel);\n });\n\n it(\"Success enough memory\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n firmwareUpdateContext: {\n currentFirmware: { bytes: 397824 } as FinalFirmware,\n },\n customImage: { size: 51893 },\n installedApps: [\n { bytes: 305442 },\n { bytes: 514598 },\n { bytes: 271583 },\n ] as unknown as Application[],\n installedLanguages: [{ id: 1, size: 20480 }],\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new PredictOutOfMemoryTask(apiMock, {\n installPlan: [\n { bytes: 1324 },\n { bytes: 6559 },\n ] as unknown as Application[],\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n outOfMemory: false,\n });\n });\n\n it(\"Success not enough memory\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n firmwareUpdateContext: {\n currentFirmware: { bytes: 397824 } as FinalFirmware,\n },\n customImage: { size: 51893 },\n installedApps: [\n { bytes: 305442 },\n { bytes: 514598 },\n { bytes: 271583 },\n ] as unknown as Application[],\n installedLanguages: [{ id: 1, size: 20480 }],\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new PredictOutOfMemoryTask(apiMock, {\n installPlan: [\n { bytes: 1324 },\n { bytes: 6559 },\n { bytes: 1 },\n ] as unknown as Application[],\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n outOfMemory: true,\n });\n });\n\n it(\"Success undefined sizes\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n firmwareUpdateContext: {\n currentFirmware: { bytes: 397824 } as FinalFirmware,\n },\n customImage: {},\n installedApps: [\n { bytes: 305442 },\n { bytes: null },\n { bytes: 271583 },\n ] as unknown as Application[],\n installedLanguages: [],\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new PredictOutOfMemoryTask(apiMock, {\n installPlan: [\n { bytes: 1324 },\n { bytes: 6559 },\n ] as unknown as Application[],\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n outOfMemory: false,\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 PredictOutOfMemoryTask(apiMock, {\n installPlan: [{ bytes: 1324 }] as unknown as Application[],\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 PredictOutOfMemoryTask(apiMock, {\n installPlan: [{ bytes: 1324 }] as unknown as Application[],\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Device metadata not fetched\"),\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,gBAAAA,MAAoB,2BAC7B,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,kBAAAC,MAAsB,+BAG/B,OAAS,0BAAAC,MAA8B,yCAIvC,OAAS,0BAAAC,MAA8B,2BAEvC,SAAS,yBAA0B,IAAM,CACvC,MAAMC,EAAUJ,EAAgC,EAEhD,WAAW,IAAM,CACf,GAAG,cAAc,EACjBI,EAAQ,eAAe,gBAAgB,CACrC,WAAY,QACZ,UAAW,EACb,CAAoC,CACtC,CAAC,EAED,GAAG,wBAAyB,IAAM,CAEhCA,EAA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,EACd,cAAe,CACb,CAAE,MAAO,MAAO,EAChB,CAAE,MAAO,IAAK,EACd,CAAE,MAAO,MAAO,CAClB,EACA,mBAAoB,CAAC,CACvB,CAAkC,EAGlC,MAAMM,EAAS,IAAIF,EAAuBC,EAAS,CACjD,YAAa,CACX,CAAE,MAAO,IAAK,EACd,CAAE,MAAO,IAAK,CAChB,CACF,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,YAAa,EACf,CAAC,CACH,CAAC,EAED,GAAG,0CAA2C,IAAM,CAElDD,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkBF,EAAuB,UACzC,aAAcH,EAAa,SAC7B,CAAuB,EAGvB,MAAMM,EAAS,IAAIF,EAAuBC,EAAS,CACjD,YAAa,CAAC,CAAE,MAAO,IAAK,CAAC,CAC/B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,MAAO,IAAIJ,EAAe,sBAAsB,CAClD,CAAC,CACH,CAAC,EAED,GAAG,8CAA+C,IAAM,CAEtDG,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkBF,EAAuB,0BACzC,aAAcH,EAAa,UAC3B,cAAe,CAAC,CAClB,CAAkC,EAGlC,MAAMM,EAAS,IAAIF,EAAuBC,EAAS,CACjD,YAAa,CAAC,CAAE,MAAO,IAAK,CAAC,CAC/B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,MAAO,IAAIJ,EAAe,6BAA6B,CACzD,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["DeviceStatus", "makeDeviceActionInternalApiMock", "UnknownDAError", "DeviceSessionStateType", "PredictOutOfMemoryTask", "apiMock", "result"]
7
+ }
@@ -1,2 +1,2 @@
1
- import{Observable as d,ReplaySubject as S,share as I}from"rxjs";import{createActor as y}from"xstate";import{DeviceActionStatus as a}from"../../device-action/model/DeviceActionState";class D{input;inspect=!1;constructor(t){this.input=t.input,this.inspect=!!t.inspect}_execute(t){const s=this.makeStateMachine(t),n=y(s,{input:this.input}),e=new S,c=r=>{const{context:i,status:p,output:m,error:h}=r;switch(p){case"active":e.next({status:a.Pending,intermediateValue:i.intermediateValue});break;case"done":m.caseOf({Left:o=>{e.next({status:a.Error,error:o})},Right:o=>{e.next({status:a.Completed,output:o})}}),e.complete();break;case"error":e.error(h),e.complete();break;case"stopped":e.next({status:a.Stopped}),e.complete();break;default:this._exhaustiveMatchingGuard(p)}},l=new d(r=>{const i=e.subscribe(r);return()=>{u.unsubscribe(),i.unsubscribe(),n.stop()}}),u=n.subscribe(c);return n.start(),{observable:l.pipe(I()),cancel:()=>{n.stop(),u.unsubscribe(),c(n.getSnapshot())}}}_exhaustiveMatchingGuard(t){throw console.log("_exhaustiveMatchingGuard status",t),new Error(`Unhandled status: ${t}`)}}export{D as XStateDeviceAction};
1
+ import{Observable as h,ReplaySubject as d,share as S}from"rxjs";import{createActor as I}from"xstate";import{DeviceActionStatus as a}from"../../device-action/model/DeviceActionState";class E{input;inspect=!1;constructor(e){this.input=e.input,this.inspect=!!e.inspect}_execute(e){const n=this.makeStateMachine(e);return this._subscribeToStateMachine(n)}_subscribeToStateMachine(e){const n=I(e,{input:this.input}),t=new d,o=r=>{const{context:i,status:p,output:l,error:m}=r;switch(p){case"active":t.next({status:a.Pending,intermediateValue:i.intermediateValue});break;case"done":l.caseOf({Left:c=>{t.next({status:a.Error,error:c})},Right:c=>{t.next({status:a.Completed,output:c})}}),t.complete();break;case"error":t.error(m),t.complete();break;case"stopped":t.next({status:a.Stopped}),t.complete();break;default:this._exhaustiveMatchingGuard(p)}},s=new h(r=>{const i=t.subscribe(r);return()=>{u.unsubscribe(),i.unsubscribe(),n.stop()}}),u=n.subscribe(o);return n.start(),{observable:s.pipe(S()),cancel:()=>{n.stop(),u.unsubscribe(),o(n.getSnapshot())}}}_exhaustiveMatchingGuard(e){throw console.log("_exhaustiveMatchingGuard status",e),new Error(`Unhandled status: ${e}`)}}export{E as XStateDeviceAction};
2
2
  //# sourceMappingURL=XStateDeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/xstate-utils/XStateDeviceAction.ts"],
4
- "sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { Observable, ReplaySubject, share } from \"rxjs\";\nimport {\n createActor,\n type SnapshotFrom,\n type StateMachine,\n type StateSchema,\n} from \"xstate\";\n\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\nimport { type StateMachineTypes } from \"./StateMachineTypes\";\n\nexport type DeviceActionStateMachine<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> = StateMachine<\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"context\"], // context\n /**\n * The following usages `any` are OK because this is just a wrapper around the\n * state machine and we are not directly going to use these types.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any, // event\n any, // children\n any, // actor\n any, // action\n any, // guard\n any, // delay\n any, // state value\n any, // tag\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"input\"],\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"output\"],\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any,\n any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateSchema\n>;\n\n/**\n * A DeviceAction that uses an XState state machine to execute.\n * It maps the state machine snapshots to the DeviceActionState.\n * This class is abstract and should be extended to implement the state machine.\n */\nexport abstract class XStateDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> implements DeviceAction<Output, Input, Error, IntermediateValue>\n{\n readonly input: Input;\n readonly inspect: boolean = false;\n\n /**\n *\n * @param input The input for the DeviceAction\n * @param inspect If true, the state machine will be inspected in the browser\n */\n constructor(args: { input: Input; inspect?: boolean }) {\n this.input = args.input;\n this.inspect = Boolean(args.inspect);\n }\n\n protected abstract makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >;\n\n _execute(\n internalApi: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const stateMachine = this.makeStateMachine(internalApi);\n\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n // inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n private _exhaustiveMatchingGuard(status: never): never {\n console.log(\"_exhaustiveMatchingGuard status\", status);\n throw new Error(`Unhandled status: ${status}`);\n }\n}\n"],
5
- "mappings": "AACA,OAAS,cAAAA,EAAY,iBAAAC,EAAe,SAAAC,MAAa,OACjD,OACE,eAAAC,MAIK,SAQP,OAEE,sBAAAC,MACK,6CA2DA,MAAeC,CAOtB,CACW,MACA,QAAmB,GAO5B,YAAYC,EAA2C,CACrD,KAAK,MAAQA,EAAK,MAClB,KAAK,QAAU,EAAQA,EAAK,OAC9B,CAYA,SACEC,EACiE,CACjE,MAAMC,EAAe,KAAK,iBAAiBD,CAAW,EAEhDE,EAAQN,EAAYK,EAAc,CACtC,MAAO,KAAK,KAGd,CAAC,EAQKE,EAAU,IAAIT,EAIdU,EACJC,GACG,CACH,KAAM,CAAE,QAAAC,EAAS,OAAAC,EAAQ,OAAAC,EAAQ,MAAAC,CAAM,EAAIJ,EAC3C,OAAQE,EAAQ,CACd,IAAK,SACHJ,EAAQ,KAAK,CACX,OAAQN,EAAmB,QAC3B,kBAAmBS,EAAQ,iBAC7B,CAAC,EACD,MACF,IAAK,OACHE,EAAO,OAAO,CACZ,KAAOE,GAAQ,CACbP,EAAQ,KAAK,CACX,OAAQN,EAAmB,MAC3B,MAAOa,CACT,CAAC,CACH,EACA,MAAQC,GAAW,CACjBR,EAAQ,KAAK,CACX,OAAQN,EAAmB,UAC3B,OAAQc,CACV,CAAC,CACH,CACF,CAAC,EACDR,EAAQ,SAAS,EACjB,MACF,IAAK,QAEHA,EAAQ,MAAMM,CAAK,EACnBN,EAAQ,SAAS,EACjB,MACF,IAAK,UACHA,EAAQ,KAAK,CACX,OAAQN,EAAmB,OAC7B,CAAC,EACDM,EAAQ,SAAS,EACjB,MACF,QACE,KAAK,yBAAyBI,CAAM,CACxC,CACF,EAEMK,EAAa,IAAInB,EAEpBoB,GAAe,CAChB,MAAMC,EAAsBX,EAAQ,UAAUU,CAAU,EACxD,MAAO,IAAM,CACXE,EAAkB,YAAY,EAC9BD,EAAoB,YAAY,EAChCZ,EAAM,KAAK,CACb,CACF,CAAC,EAEKa,EAAoBb,EAAM,UAAUE,CAAmB,EAC7D,OAAAF,EAAM,MAAM,EAEL,CACL,WAAYU,EAAW,KAAKjB,EAAM,CAAC,EACnC,OAAQ,IAAM,CACZO,EAAM,KAAK,EACXa,EAAkB,YAAY,EAC9BX,EAAoBF,EAAM,YAAY,CAAC,CACzC,CACF,CACF,CAEQ,yBAAyBK,EAAsB,CACrD,cAAQ,IAAI,kCAAmCA,CAAM,EAC/C,IAAI,MAAM,qBAAqBA,CAAM,EAAE,CAC/C,CACF",
4
+ "sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { Observable, ReplaySubject, share } from \"rxjs\";\nimport {\n createActor,\n type SnapshotFrom,\n type StateMachine,\n type StateSchema,\n} from \"xstate\";\n\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\nimport { type StateMachineTypes } from \"./StateMachineTypes\";\n\nexport type DeviceActionStateMachine<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> = StateMachine<\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"context\"], // context\n /**\n * The following usages `any` are OK because this is just a wrapper around the\n * state machine and we are not directly going to use these types.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any, // event\n any, // children\n any, // actor\n any, // action\n any, // guard\n any, // delay\n any, // state value\n any, // tag\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"input\"],\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"output\"],\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any,\n any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateSchema\n>;\n\n/**\n * A DeviceAction that uses an XState state machine to execute.\n * It maps the state machine snapshots to the DeviceActionState.\n * This class is abstract and should be extended to implement the state machine.\n */\nexport abstract class XStateDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> implements DeviceAction<Output, Input, Error, IntermediateValue>\n{\n readonly input: Input;\n readonly inspect: boolean = false;\n\n /**\n *\n * @param input The input for the DeviceAction\n * @param inspect If true, the state machine will be inspected in the browser\n */\n constructor(args: { input: Input; inspect?: boolean }) {\n this.input = args.input;\n this.inspect = Boolean(args.inspect);\n }\n\n protected abstract makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >;\n\n _execute(\n internalApi: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const stateMachine = this.makeStateMachine(internalApi);\n return this._subscribeToStateMachine(stateMachine);\n }\n\n protected _subscribeToStateMachine(\n stateMachine: DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n // inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n private _exhaustiveMatchingGuard(status: never): never {\n console.log(\"_exhaustiveMatchingGuard status\", status);\n throw new Error(`Unhandled status: ${status}`);\n }\n}\n"],
5
+ "mappings": "AACA,OAAS,cAAAA,EAAY,iBAAAC,EAAe,SAAAC,MAAa,OACjD,OACE,eAAAC,MAIK,SAQP,OAEE,sBAAAC,MACK,6CA2DA,MAAeC,CAOtB,CACW,MACA,QAAmB,GAO5B,YAAYC,EAA2C,CACrD,KAAK,MAAQA,EAAK,MAClB,K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AAoBF,EAAM,YAAY,CAAC,CACzC,CACF,CACF,CAEQ,yBAAyBK,EAAsB,CACrD,cAAQ,IAAI,kCAAmCA,CAAM,EAC/C,IAAI,MAAM,qBAAqBA,CAAM,EAAE,CAC/C,CACF",
6
6
  "names": ["Observable", "ReplaySubject", "share", "createActor", "DeviceActionStatus", "XStateDeviceAction", "args", "internalApi", "stateMachine", "actor", "subject", "handleActorSnapshot", "snapshot", "context", "status", "output", "error", "err", "result", "observable", "subscriber", "subjectSubscription", "actorSubscription"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var n=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var f=(u,e,d)=>e in u?n(u,e,{enumerable:!0,configurable:!0,writable:!0,value:d}):u[e]=d;var m=(u,e,d,s)=>{for(var r=s>1?void 0:s?b(e,d):e,t=u.length-1,l;t>=0;t--)(l=u[t])&&(r=(s?l(e,d,r):l(r))||r);return s&&r&&n(e,d,r),r};var v=(u,e,d)=>f(u,typeof e!="symbol"?e+"":e,d);import{injectable as p}from"inversify";import{DeviceModelId as o}from"../../device/DeviceModel";import{BleDeviceInfos as I}from"../../device-model/model/BleDeviceInfos";import{TransportDeviceModel as c}from"../../device-model/model/DeviceModel";let i=class{getAllDeviceModels(){return Object.values(i.deviceModelByIds)}getDeviceModel(e){return i.deviceModelByIds[e.id]}filterDeviceModels(e){return this.getAllDeviceModels().filter(d=>Object.entries(e).every(([s,r])=>d[s]===r))}getBluetoothServicesInfos(){return Object.values(i.deviceModelByIds).reduce((e,d)=>{const{bluetoothSpec:s}=d;return s?{...e,...s.reduce((r,t)=>({...r,[t.serviceUuid]:new I(d,t.serviceUuid,t.writeUuid,t.writeCmdUuid,t.notifyUuid)}),{})}:e},{})}getBluetoothServices(){return Object.values(i.deviceModelByIds).map(e=>(e.bluetoothSpec||[]).map(d=>d.serviceUuid)).flat().filter(e=>!!e)}};v(i,"deviceModelByIds",{[o.NANO_S]:new c({id:o.NANO_S,productName:"Ledger Nano S",usbProductId:16,bootloaderUsbProductId:1,usbOnly:!0,memorySize:320*1024,masks:[823132160]}),[o.NANO_SP]:new c({id:o.NANO_SP,productName:"Ledger Nano S Plus",usbProductId:80,bootloaderUsbProductId:5,usbOnly:!0,memorySize:1533*1024,masks:[856686592]}),[o.NANO_X]:new c({id:o.NANO_X,productName:"Ledger Nano X",usbProductId:64,bootloaderUsbProductId:4,usbOnly:!1,memorySize:2*1024*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"}]}),[o.STAX]:new c({id:o.STAX,productName:"Ledger Stax",usbProductId:96,bootloaderUsbProductId:6,usbOnly:!1,memorySize:1533*1024,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"}]}),[o.FLEX]:new c({id:o.FLEX,productName:"Ledger Flex",usbProductId:112,bootloaderUsbProductId:7,usbOnly:!1,memorySize:1533*1024,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"}]})}),i=m([p()],i);export{i as StaticDeviceModelDataSource};
1
+ var n=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var U=(c,e,d)=>e in c?n(c,e,{enumerable:!0,configurable:!0,writable:!0,value:d}):c[e]=d;var m=(c,e,d,t)=>{for(var o=t>1?void 0:t?v(e,d):e,s=c.length-1,l;s>=0;s--)(l=c[s])&&(o=(t?l(e,d,o):l(o))||o);return t&&o&&n(e,d,o),o};var b=(c,e,d)=>U(c,typeof e!="symbol"?e+"":e,d);import{injectable as p}from"inversify";import{DeviceModelId as r}from"../../device/DeviceModel";import{BleDeviceInfos as f}from"../../device-model/model/BleDeviceInfos";import{TransportDeviceModel as u}from"../../device-model/model/DeviceModel";let i=class{getAllDeviceModels(){return Object.values(i.deviceModelByIds)}getDeviceModel(e){return i.deviceModelByIds[e.id]}filterDeviceModels(e){return this.getAllDeviceModels().filter(d=>Object.entries(e).every(([t,o])=>d[t]===o))}getBluetoothServicesInfos(){return Object.values(i.deviceModelByIds).reduce((e,d)=>{const{bluetoothSpec:t}=d;return t?{...e,...t.reduce((o,s)=>({...o,[s.serviceUuid]:new f(d,s.serviceUuid,s.writeUuid,s.writeCmdUuid,s.notifyUuid)}),{})}:e},{})}getBluetoothServices(){return Object.values(i.deviceModelByIds).map(e=>(e.bluetoothSpec||[]).map(d=>d.serviceUuid)).flat().filter(e=>!!e)}};b(i,"deviceModelByIds",{[r.NANO_S]:new u({id:r.NANO_S,productName:"Ledger Nano S",usbProductId:16,bootloaderUsbProductId:1,usbOnly:!0,memorySize:320*1024,blockSize:4*1024,masks:[823132160]}),[r.NANO_SP]:new u({id:r.NANO_SP,productName:"Ledger Nano S Plus",usbProductId:80,bootloaderUsbProductId:5,usbOnly:!0,memorySize:1533*1024,blockSize:32,masks:[856686592]}),[r.NANO_X]:new u({id:r.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"}]}),[r.STAX]:new u({id:r.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"}]}),[r.FLEX]:new u({id:r.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"}]}),[r.APEX]:new u({id:r.APEX,productName:"Ledger Apex",usbProductId:128,bootloaderUsbProductId:8,usbOnly:!1,memorySize:1533*1024,blockSize:32,masks:[859832320],bluetoothSpec:[{serviceUuid:"13d63400-2c97-8004-0000-4c6564676572",notifyUuid:"13d63400-2c97-8004-0001-4c6564676572",writeUuid:"13d63400-2c97-8004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-8004-0003-4c6564676572"}]})}),i=m([p()],i);export{i as 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 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 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 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 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 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": "gVAAA,OAAS,cAAAA,MAAkB,YAE3B,OAAS,iBAAAC,MAAqB,0BAE9B,OAAS,kBAAAC,MAAsB,yCAC/B,OAAS,wBAAAC,MAA4B,sCAM9B,IAAMC,EAAN,KAAmE,CA2ExE,o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A,EAAc,MAAM,EAAG,IAAIC,EAAqB,CAC/C,GAAID,EAAc,OAClB,YAAa,gBACb,aAAc,GACd,uBAAwB,EACxB,QAAS,GACT,WAAY,EAAI,KAAO,KACvB,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,CACF,CAAC,EACD,CAACA,EAAc,IAAI,EAAG,IAAIC,EAAqB,CAC7C,GAAID,EAAc,KAClB,YAAa,cACb,aAAc,GACd,uBAAwB,EACxB,QAAS,GACT,WAAY,KAAO,KACnB,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,CACF,CAAC,EACD,CAACA,EAAc,IAAI,EAAG,IAAIC,EAAqB,CAC7C,GAAID,EAAc,KAClB,YAAa,cACb,aAAc,IACd,uBAAwB,EACxB,QAAS,GACT,WAAY,KAAO,KACnB,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,CACF,CAAC,CACH,GAzEWb,EAANe,EAAA,CADNC,EAAW,GACChB",
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 [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-8004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-8004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-8004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-8004-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": "gVAAA,OAAS,cAAAA,MAAkB,YAE3B,OAAS,iBAAAC,MAAqB,0BAE9B,OAAS,kBAAAC,MAAsB,yCAC/B,OAAS,wBAAAC,MAA4B,sCAM9B,IAAMC,EAAN,KAAmE,CAkGxE,oBAA6C,CAC3C,OAAO,OAAO,OAAOA,EAA4B,gBAAgB,CACnE,CAEA,eAAeC,EAAqD,CAClE,OAAOD,EAA4B,iBAAiBC,EAAO,EAAE,CAC/D,CAKA,mBACEA,EACwB,CACxB,OAAO,KAAK,mBAAmB,EAAE,OAAQC,GAChC,OAAO,QAAQD,CAAM,EAAE,MAAM,CAAC,CAACE,EAAKC,CAAK,IACvCF,EAAYC,CAAiC,IAAMC,CAC3D,CACF,CACH,CAEA,2BAA4D,CAC1D,OAAO,OAAO,OAAOJ,EAA4B,gBAAgB,EAAE,OAEjE,CAACK,EAAKH,IAAgB,CACtB,KAAM,CAAE,cAAAI,CAAc,EAAIJ,EAC1B,OAAII,EACK,CACL,GAAGD,EACH,GAAGC,EAAc,OACf,CAACC,EAAgBC,KAAa,CAC5B,GAAGD,EACH,CAACC,EAAQ,WAAW,EAAG,IAAIC,EACzBP,EACAM,EAAQ,YACRA,EAAQ,UACRA,EAAQ,aACRA,EAAQ,UACV,CACF,GACA,CAAC,CACH,CACF,EAEKH,CACT,EAAG,CAAC,CAAC,CACP,CAEA,sBAAiC,CAC/B,OAAO,OAAO,OAAOL,EAA4B,gBAAgB,EAC9D,IAAKE,IACHA,EAAY,eAAiB,CAAC,GAAG,IAAKQ,GAASA,EAAK,WAAW,CAClE,EACC,KAAK,EACL,OAAQC,GAAS,CAAC,CAACA,CAAI,CAC5B,CACF,EAzJEC,EADWZ,EACI,m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AAS,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,GAhGWb,EAANe,EAAA,CADNC,EAAW,GACChB",
6
6
  "names": ["injectable", "DeviceModelId", "BleDeviceInfos", "TransportDeviceModel", "StaticDeviceModelDataSource", "params", "deviceModel", "key", "value", "acc", "bluetoothSpec", "serviceToModel", "bleSpec", "BleDeviceInfos", "spec", "uuid", "__publicField", "DeviceModelId", "TransportDeviceModel", "__decorateClass", "injectable"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{DeviceModelId as e}from"../../device/DeviceModel";import{BleDeviceInfos as s}from"../../device-model/model/BleDeviceInfos";import{StaticDeviceModelDataSource as d}from"./StaticDeviceModelDataSource";describe("StaticDeviceModelDataSource",()=>{describe("getAllDeviceModels",()=>{it("should return all device models",()=>{const c=new d().getAllDeviceModels();expect(c.length).toEqual(5),expect(c).toContainEqual(expect.objectContaining({id:e.NANO_S})),expect(c).toContainEqual(expect.objectContaining({id:e.NANO_SP})),expect(c).toContainEqual(expect.objectContaining({id:e.NANO_X})),expect(c).toContainEqual(expect.objectContaining({id:e.STAX})),expect(c).toContainEqual(expect.objectContaining({id:e.FLEX}))})}),describe("getDeviceModel",()=>{it("should return the associated device model",()=>{const t=new d,c=t.getDeviceModel({id:e.NANO_S});expect(c).toEqual(expect.objectContaining({id:e.NANO_S}));const o=t.getDeviceModel({id:e.NANO_SP});expect(o).toEqual(expect.objectContaining({id:e.NANO_SP}));const i=t.getDeviceModel({id:e.NANO_X});expect(i).toEqual(expect.objectContaining({id:e.NANO_X}));const n=t.getDeviceModel({id:e.STAX});expect(n).toEqual(expect.objectContaining({id:e.STAX}));const l=t.getDeviceModel({id:e.FLEX});expect(l).toEqual(expect.objectContaining({id:e.FLEX}))})}),describe("filterDeviceModels",()=>{it("should return the device models that match the given single parameter",()=>{const t=new d,c=t.filterDeviceModels({usbOnly:!0});expect(c.length).toEqual(2),expect(c).toContainEqual(expect.objectContaining({id:e.NANO_SP})),expect(c).toContainEqual(expect.objectContaining({id:e.NANO_S}));const o=t.filterDeviceModels({usbProductId:16});expect(o.length).toEqual(1),expect(o[0]).toEqual(expect.objectContaining({id:e.NANO_S}));const i=t.filterDeviceModels({usbProductId:64});expect(i.length).toEqual(1),expect(i[0]).toEqual(expect.objectContaining({id:e.NANO_X}));const n=t.filterDeviceModels({usbProductId:80});expect(n.length).toEqual(1),expect(n[0]).toEqual(expect.objectContaining({id:e.NANO_SP}));const l=t.filterDeviceModels({usbProductId:96});expect(l.length).toEqual(1),expect(l[0]).toEqual(expect.objectContaining({id:e.STAX}));const a=t.filterDeviceModels({usbProductId:0});expect(a.length).toEqual(0)}),it("should return the device models that match the given multiple parameters",()=>{const t=new d,c=t.filterDeviceModels({usbOnly:!1,usbProductId:64});expect(c.length).toEqual(1),expect(c[0]).toEqual(expect.objectContaining({id:e.NANO_X}));const o=t.filterDeviceModels({usbOnly:!0,usbProductId:80});expect(o.length).toEqual(1),expect(o[0]).toEqual(expect.objectContaining({id:e.NANO_SP}));const i=t.filterDeviceModels({usbOnly:!1,usbProductId:16});expect(i.length).toEqual(0)})}),describe("getBluetoothServicesInfos",()=>{it("should return the ble service infos record",()=>{const t=new d,c=t.getBluetoothServicesInfos();expect(c).toStrictEqual({"13d63400-2c97-0004-0000-4c6564676572":new s(t.getDeviceModel({id:e.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 s(t.getDeviceModel({id:e.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 s(t.getDeviceModel({id:e.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 d().getBluetoothServices();expect(c).toStrictEqual(["13d63400-2c97-0004-0000-4c6564676572","13d63400-2c97-6004-0000-4c6564676572","13d63400-2c97-3004-0000-4c6564676572"])})})});
1
+ import{DeviceModelId as e}from"../../device/DeviceModel";import{BleDeviceInfos as a}from"../../device-model/model/BleDeviceInfos";import{StaticDeviceModelDataSource as d}from"./StaticDeviceModelDataSource";describe("StaticDeviceModelDataSource",()=>{describe("getAllDeviceModels",()=>{it("should return all device models",()=>{const c=new d().getAllDeviceModels();expect(c.length).toEqual(6),expect(c).toContainEqual(expect.objectContaining({id:e.APEX})),expect(c).toContainEqual(expect.objectContaining({id:e.NANO_S})),expect(c).toContainEqual(expect.objectContaining({id:e.NANO_SP})),expect(c).toContainEqual(expect.objectContaining({id:e.NANO_X})),expect(c).toContainEqual(expect.objectContaining({id:e.STAX})),expect(c).toContainEqual(expect.objectContaining({id:e.FLEX}))})}),describe("getDeviceModel",()=>{it("should return the associated device model",()=>{const t=new d,c=t.getDeviceModel({id:e.NANO_S});expect(c).toEqual(expect.objectContaining({id:e.NANO_S}));const o=t.getDeviceModel({id:e.NANO_SP});expect(o).toEqual(expect.objectContaining({id:e.NANO_SP}));const i=t.getDeviceModel({id:e.NANO_X});expect(i).toEqual(expect.objectContaining({id:e.NANO_X}));const n=t.getDeviceModel({id:e.STAX});expect(n).toEqual(expect.objectContaining({id:e.STAX}));const l=t.getDeviceModel({id:e.FLEX});expect(l).toEqual(expect.objectContaining({id:e.FLEX}))})}),describe("filterDeviceModels",()=>{it("should return the device models that match the given single parameter",()=>{const t=new d,c=t.filterDeviceModels({usbOnly:!0});expect(c.length).toEqual(2),expect(c).toContainEqual(expect.objectContaining({id:e.NANO_SP})),expect(c).toContainEqual(expect.objectContaining({id:e.NANO_S}));const o=t.filterDeviceModels({usbProductId:16});expect(o.length).toEqual(1),expect(o[0]).toEqual(expect.objectContaining({id:e.NANO_S}));const i=t.filterDeviceModels({usbProductId:64});expect(i.length).toEqual(1),expect(i[0]).toEqual(expect.objectContaining({id:e.NANO_X}));const n=t.filterDeviceModels({usbProductId:80});expect(n.length).toEqual(1),expect(n[0]).toEqual(expect.objectContaining({id:e.NANO_SP}));const l=t.filterDeviceModels({usbProductId:96});expect(l.length).toEqual(1),expect(l[0]).toEqual(expect.objectContaining({id:e.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 d,c=t.filterDeviceModels({usbOnly:!1,usbProductId:64});expect(c.length).toEqual(1),expect(c[0]).toEqual(expect.objectContaining({id:e.NANO_X}));const o=t.filterDeviceModels({usbOnly:!0,usbProductId:80});expect(o.length).toEqual(1),expect(o[0]).toEqual(expect.objectContaining({id:e.NANO_SP}));const i=t.filterDeviceModels({usbOnly:!1,usbProductId:16});expect(i.length).toEqual(0)})}),describe("getBluetoothServicesInfos",()=>{it("should return the ble service infos record",()=>{const t=new d,c=t.getBluetoothServicesInfos();expect(c).toStrictEqual({"13d63400-2c97-0004-0000-4c6564676572":new a(t.getDeviceModel({id:e.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(t.getDeviceModel({id:e.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(t.getDeviceModel({id:e.FLEX}),"13d63400-2c97-3004-0000-4c6564676572","13d63400-2c97-3004-0002-4c6564676572","13d63400-2c97-3004-0003-4c6564676572","13d63400-2c97-3004-0001-4c6564676572"),"13d63400-2c97-8004-0000-4c6564676572":new a(t.getDeviceModel({id:e.APEX}),"13d63400-2c97-8004-0000-4c6564676572","13d63400-2c97-8004-0002-4c6564676572","13d63400-2c97-8004-0003-4c6564676572","13d63400-2c97-8004-0001-4c6564676572")})})}),describe("getBluetoothServices",()=>{it("should return the bluetooth services",()=>{const c=new d().getBluetoothServices();expect(c).toStrictEqual(["13d63400-2c97-0004-0000-4c6564676572","13d63400-2c97-6004-0000-4c6564676572","13d63400-2c97-3004-0000-4c6564676572","13d63400-2c97-8004-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 // Currently supporting 4 device models\n expect(deviceModels.length).toEqual(5);\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-0004-0000-4c6564676572\",\n \"13d63400-2c97-6004-0000-4c6564676572\",\n \"13d63400-2c97-3004-0000-4c6564676572\",\n ]);\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,iBAAAA,MAAqB,0BAC9B,OAAS,kBAAAC,MAAsB,yCAE/B,OAAS,+BAAAC,MAAmC,gCAE5C,SAAS,8BAA+B,IAAM,CAC5C,SAAS,qBAAsB,IAAM,CACnC,GAAG,kCAAmC,IAAM,CAE1C,MAAMC,EADa,IAAID,EAA4B,EACnB,mBAAmB,EAGnD,OAAOC,EAAa,MAAM,EAAE,QAAQ,CAAC,EACrC,OAAOA,CAAY,EAAE,eACnB,OAAO,iBAAiB,CAAE,GAAIH,EAAc,MAAO,CAAC,CACtD,EACA,OAAOG,CAAY,EAAE,eACnB,OAAO,iBAAiB,CAAE,GAAIH,EAAc,OAAQ,CAAC,CACvD,EACA,OAAOG,CAAY,EAAE,eACnB,OAAO,iBAAiB,CAAE,GAAIH,EAAc,MAAO,CAAC,CACtD,EACA,OAAOG,CAAY,EAAE,eACnB,OAAO,iBAAiB,CAAE,GAAIH,EAAc,IAAK,CAAC,CACpD,EACA,OAAOG,CAAY,EAAE,eACnB,OAAO,iBAAiB,C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T,aAAc,EAChB,CAAC,EACD,OAAOO,EAAc,MAAM,EAAE,QAAQ,CAAC,EACtC,OAAOA,EAAc,CAAC,CAAC,EAAE,QACvB,OAAO,iBAAiB,CAAE,GAAIX,EAAc,OAAQ,CAAC,CACvD,EAGA,MAAMY,EAAgBR,EAAW,mBAAmB,CAClD,QAAS,GACT,aAAc,EAChB,CAAC,EACD,OAAOQ,EAAc,MAAM,EAAE,QAAQ,CAAC,CACxC,CAAC,CACH,CAAC,EACD,SAAS,4BAA6B,IAAM,CAC1C,GAAG,6CAA8C,IAAM,CAErD,MAAMR,EAAa,IAAIF,EAEjBc,EAAkBZ,EAAW,0BAA0B,EAE7D,OAAOY,CAAe,EAAE,cAAc,CACpC,uCAAwC,IAAIf,EAC1CG,EAAW,eAAe,CAAE,GAAIJ,EAAc,MAAO,CAAC,EACtD,uCACA,uCACA,uCACA,sCACF,EACA,uCAAwC,IAAIC,EAC1CG,EAAW,eAAe,CAAE,GAAIJ,EAAc,IAAK,CAAC,EACpD,uCACA,uCACA,uCACA,sCACF,EACA,uCAAwC,IAAIC,EAC1CG,EAAW,eAAe,CAAE,GAAIJ,EAAc,IAAK,CAAC,EACpD,uCACA,uCACA,uCACA,sCACF,CACF,CAAC,CACH,CAAC,CACH,CAAC,EACD,SAAS,uBAAwB,IAAM,CACrC,GAAG,uCAAwC,IAAM,CAI/C,MAAMiB,EAFa,IAAIf,EAA4B,EAEpB,qBAAqB,EAEpD,OAAOe,CAAW,EAAE,cAAc,CAChC,uCACA,uCACA,sCACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
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 \"13d63400-2c97-8004-0000-4c6564676572\": new BleDeviceInfos(\n dataSource.getDeviceModel({ id: DeviceModelId.APEX }),\n \"13d63400-2c97-8004-0000-4c6564676572\",\n \"13d63400-2c97-8004-0002-4c6564676572\",\n \"13d63400-2c97-8004-0003-4c6564676572\",\n \"13d63400-2c97-8004-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-0004-0000-4c6564676572\",\n \"13d63400-2c97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,EAAW,0BAA0B,EAE7D,OAAOY,CAAe,EAAE,cAAc,CACpC,uCAAwC,IAAIf,EAC1CG,EAAW,eAAe,CAAE,GAAIJ,EAAc,MAAO,CAAC,EACtD,uCACA,uCACA,uCACA,sCACF,EACA,uCAAwC,IAAIC,EAC1CG,EAAW,eAAe,CAAE,GAAIJ,EAAc,IAAK,CAAC,EACpD,uCACA,uCACA,uCACA,sCACF,EACA,uCAAwC,IAAIC,EAC1CG,EAAW,eAAe,CAAE,GAAIJ,EAAc,IAAK,CAAC,EACpD,uCACA,uCACA,uCACA,sCACF,EACA,uCAAwC,IAAIC,EAC1CG,EAAW,eAAe,CAAE,GAAIJ,EAAc,IAAK,CAAC,EACpD,uCACA,uCACA,uCACA,sCACF,CACF,CAAC,CACH,CAAC,CACH,CAAC,EACD,SAAS,uBAAwB,IAAM,CACrC,GAAG,uCAAwC,IAAM,CAI/C,MAAMiB,EAFa,IAAIf,EAA4B,EAEpB,qBAAqB,EAEpD,OAAOe,CAAW,EAAE,cAAc,CAChC,uCACA,uCACA,uCACA,sCACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["DeviceModelId", "BleDeviceInfos", "StaticDeviceModelDataSource", "deviceModels", "dataSource", "deviceModel1", "deviceModel2", "deviceModel3", "deviceModel4", "deviceModel5", "deviceModels1", "deviceModels2", "deviceModels3", "deviceModels4", "deviceModels5", "deviceModels6", "bleServiceInfos", "bleServices"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import r from"semver";import{DeviceModelId as t}from"../../device/DeviceModel";class s{id;productName;usbProductId;bootloaderUsbProductId;usbOnly;memorySize;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.masks=e.masks,this.bluetoothSpec=e.bluetoothSpec}getBlockSize(e){switch(this.id){case t.NANO_S:return r.lt(r.coerce(e)??"","2.0.0")?4*1024:2*1024;case t.NANO_X:return 4*1024;case t.NANO_SP:case t.STAX:case t.FLEX:return 32}}}export{s as TransportDeviceModel};
1
+ import i from"semver";import{DeviceModelId as t}from"../../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 t.NANO_S:return i.lt(i.coerce(e)??"","2.0.0")?4*1024:2*1024;case t.NANO_X:return 4*1024;case t.NANO_SP:case t.STAX:case t.FLEX:case t.APEX:return 32}}}export{u as 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 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 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.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": "AAAA,OAAOA,MAAY,SAEnB,OAAS,iBAAAC,MAAqB,0BAKvB,MAAMC,CAAqB,CAChC,GACA,YACA,aACA,uBACA,QACA,WACA,MACA,cAOA,YAAYC,EAeT,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,MAAQA,EAAM,MACnB,KAAK,cAAgBA,EAAM,aAC7B,CAEA,aAAaC,EAAiC,CAC5C,OAAQ,KAAK,GAAI,CACf,KAAKH,EAAc,OACjB,OAAOD,EAAO,GAAGA,EAAO,OAAOI,CAAe,GAAK,GAAI,OAAO,EAC1D,EAAI,KACJ,EAAI,KACV,KAAKH,EAAc,OACjB,MAAO,GAAI,KACb,KAAKA,EAAc,QACnB,KAAKA,EAAc,KACnB,KAAKA,EAAc,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": "AAAA,OAAOA,MAAY,SAEnB,OAAS,iBAAAC,MAAqB,0BAKvB,MAAMC,CAAqB,CAChC,GACA,YACA,aACA,uBACA,QACA,WACA,UACA,MACA,cAOA,YAAYC,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,KAAKH,EAAc,OACjB,OAAOD,EAAO,GAAGA,EAAO,OAAOI,CAAe,GAAK,GAAI,OAAO,EAC1D,EAAI,KACJ,EAAI,KACV,KAAKH,EAAc,OACjB,MAAO,GAAI,KACb,KAAKA,EAAc,QACnB,KAAKA,EAAc,KACnB,KAAKA,EAAc,KACnB,KAAKA,EAAc,KACjB,MAAO,GACX,CACF,CACF",
6
6
  "names": ["semver", "DeviceModelId", "TransportDeviceModel", "props", "firmwareVersion"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{DeviceModelId as o}from"../../device/DeviceModel";function r(e={}){return{id:o.NANO_X,productName:"Ledger Nano X",usbProductId:64,bootloaderUsbProductId:4,usbOnly:!1,memorySize:2*1024*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"}],getBlockSize:()=>4*1024,...e}}export{r as deviceModelStubBuilder};
1
+ import{DeviceModelId as o}from"../../device/DeviceModel";function r(e={}){return{id:o.NANO_X,productName:"Ledger Nano X",usbProductId:64,bootloaderUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,blockSize:32,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"}],getBlockSize:()=>4*1024,...e}}export{r as deviceModelStubBuilder};
2
2
  //# sourceMappingURL=DeviceModel.stub.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-model/model/DeviceModel.stub.ts"],
4
- "sourcesContent": ["import { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\n\nexport function deviceModelStubBuilder(\n props: Partial<TransportDeviceModel> = {},\n): TransportDeviceModel {\n return {\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 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 getBlockSize: () => 4 * 1024,\n ...props,\n };\n}\n"],
5
- "mappings": "AAAA,OAAS,iBAAAA,MAAqB,0BAGvB,SAASC,EACdC,EAAuC,CAAC,EAClB,CACtB,MAAO,CACL,GAAIF,EAAc,OAClB,YAAa,gBACb,aAAc,GACd,uBAAwB,EACxB,QAAS,GACT,WAAY,EAAI,KAAO,KACvB,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,EACA,aAAc,IAAM,EAAI,KACxB,GAAGE,CACL,CACF",
4
+ "sourcesContent": ["import { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\n\nexport function deviceModelStubBuilder(\n props: Partial<TransportDeviceModel> = {},\n): TransportDeviceModel {\n return {\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: 32,\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 getBlockSize: () => 4 * 1024,\n ...props,\n };\n}\n"],
5
+ "mappings": "AAAA,OAAS,iBAAAA,MAAqB,0BAGvB,SAASC,EACdC,EAAuC,CAAC,EAClB,CACtB,MAAO,CACL,GAAIF,EAAc,OAClB,YAAa,gBACb,aAAc,GACd,uBAAwB,EACxB,QAAS,GACT,WAAY,EAAI,KAAO,KACvB,UAAW,GACX,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,EACA,aAAc,IAAM,EAAI,KACxB,GAAGE,CACL,CACF",
6
6
  "names": ["DeviceModelId", "deviceModelStubBuilder", "props"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var t=(e=>(e[e.Connected=0]="Connected",e[e.ReadyWithoutSecureChannel=1]="ReadyWithoutSecureChannel",e[e.ReadyWithSecureChannel=2]="ReadyWithSecureChannel",e))(t||{});export{t as DeviceSessionStateType};
1
+ var a=(e=>(e[e.Connected=0]="Connected",e[e.ReadyWithoutSecureChannel=1]="ReadyWithoutSecureChannel",e[e.ReadyWithSecureChannel=2]="ReadyWithSecureChannel",e))(a||{});export{a as DeviceSessionStateType};
2
2
  //# sourceMappingURL=DeviceSessionState.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/api/device-session/DeviceSessionState.ts"],
4
- "sourcesContent": ["import { type GetAppAndVersionResponse } from \"@api/command/os/GetAppAndVersionCommand\";\nimport { type BatteryStatusFlags } from \"@api/command/os/GetBatteryStatusCommand\";\nimport { type DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\n\n/**\n * The battery status of a device.\n */\nexport type BatteryStatus = {\n readonly level: number;\n readonly voltage: number;\n readonly temperature: number;\n readonly current: number;\n readonly status: BatteryStatusFlags;\n};\n\n/**\n * The firmware version of a device.\n */\nexport type FirmwareVersion = {\n /**\n * Microcontroller Unit version\n */\n readonly mcu: string;\n\n /**\n * Bootloader version\n */\n readonly bootloader: string;\n\n /**\n * Operating System version\n */\n readonly os: string;\n};\n\n/**\n * The current application running on a device. Alias of GetAppAndVersionResponse.\n */\nexport type RunningApp = GetAppAndVersionResponse;\n\n/**\n * The state types of a device session.\n */\nexport enum DeviceSessionStateType {\n Connected,\n ReadyWithoutSecureChannel,\n ReadyWithSecureChannel,\n}\n\ntype DeviceSessionBaseState = {\n readonly sessionStateType: DeviceSessionStateType;\n\n /**\n * The status of the device.\n */\n readonly deviceStatus: DeviceStatus;\n\n /**\n * The model of the device.\n */\n readonly deviceModelId: DeviceModelId;\n\n /**\n * The name of the device.\n */\n readonly deviceName?: string;\n};\n\ntype DeviceSessionReadyState = {\n /**\n * The battery status of the device.\n * TODO: This should not be optional, but it is not in the current implementation.\n */\n readonly batteryStatus?: BatteryStatus;\n\n /**\n * The firmware version of the device.\n * TODO: This should not be optional, but it is not in the current implementation.\n */\n readonly firmwareVersion?: FirmwareVersion;\n\n /**\n * The current application running on the device.\n */\n readonly currentApp: RunningApp;\n\n /**\n * The current applications installed on the device.\n */\n readonly installedApps: Application[];\n\n /**\n * The device is allowed to establish a secure connection.\n */\n readonly isSecureConnectionAllowed: boolean;\n};\n\n/**\n * The state of a connected device session.\n */\nexport type ConnectedState = DeviceSessionBaseState & {\n /**\n * The type of the device session state.\n */\n readonly sessionStateType: DeviceSessionStateType.Connected;\n};\n\n/**\n * The state of a device session when it is ready without a secure channel.\n */\nexport type ReadyWithoutSecureChannelState = DeviceSessionBaseState &\n DeviceSessionReadyState & {\n /**\n * The type of the device session state.\n */\n readonly sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel;\n };\n\n/**\n * The state of a device session when it is ready with a secure channel.\n */\nexport type ReadyWithSecureChannelState = DeviceSessionBaseState &\n DeviceSessionReadyState & {\n /**\n * The type of the device session state.\n */\n readonly sessionStateType: DeviceSessionStateType.ReadyWithSecureChannel;\n };\n\n/**\n * The state of a device session.\n */\nexport type DeviceSessionState =\n | ConnectedState\n | ReadyWithoutSecureChannelState\n | ReadyWithSecureChannelState;\n"],
5
- "mappings": "AA6CO,IAAKA,OACVA,IAAA,yBACAA,IAAA,yDACAA,IAAA,mDAHUA,OAAA",
4
+ "sourcesContent": ["import { type GetAppAndVersionResponse } from \"@api/command/os/GetAppAndVersionCommand\";\nimport { type BatteryStatusFlags } from \"@api/command/os/GetBatteryStatusCommand\";\nimport { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { type DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\nimport {\n type FinalFirmware,\n type OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\nimport { type LanguagePackage } from \"@internal/manager-api/model/Language\";\n\n/**\n * The battery status of a device.\n */\nexport type BatteryStatus = {\n readonly level: number;\n readonly voltage: number;\n readonly temperature: number;\n readonly current: number;\n readonly status: BatteryStatusFlags;\n};\n\n/**\n * The firmware version of a device.\n */\nexport type FirmwareVersion = {\n /**\n * Microcontroller Unit version\n */\n readonly mcu: string;\n\n /**\n * Bootloader version\n */\n readonly bootloader: string;\n\n /**\n * Operating System version\n */\n readonly os: string;\n\n /**\n * Metadata for advanced users, to get detailed informations on\n * the firmware running on the device.\n */\n readonly metadata?: GetOsVersionResponse;\n};\n\n/**\n * Context for firmware updates\n */\nexport type FirmwareUpdateContext = {\n /**\n * Current installed firmware\n */\n readonly currentFirmware: FinalFirmware;\n\n /**\n * Available firmware update\n */\n readonly availableUpdate?: FirmwareUpdate;\n};\n\n/**\n * Available firmware update\n */\nexport type FirmwareUpdate = {\n /**\n * Version of the OS updater firmware\n */\n readonly osuFirmware: OsuFirmware;\n\n /**\n * Version of the final firmware\n */\n readonly finalFirmware: FinalFirmware;\n\n /**\n * Indicates if the MCU needs to be updated\n */\n readonly mcuUpdateRequired: boolean;\n};\n\n/**\n * The app store catalog for that device.\n */\nexport type Catalog = {\n /**\n * Available applications for the device\n */\n readonly applications: Application[];\n\n /**\n * Available languages packages for the device\n */\n readonly languagePackages: LanguagePackage[];\n};\n\n/**\n * Language package installed on the device\n */\nexport type InstalledLanguagePackage = {\n /**\n * The identifier of the language package\n */\n readonly id: number;\n\n /**\n * The size of the language package\n */\n readonly size: number;\n};\n\n/**\n * Custom image metadata, if one was loaded on the device\n */\nexport type CustomImage = {\n /**\n * The size of loaded custom image, if one was loaded\n */\n readonly size?: number;\n};\n\n/**\n * The current application running on a device. Alias of GetAppAndVersionResponse.\n */\nexport type RunningApp = GetAppAndVersionResponse;\n\n/**\n * The state types of a device session.\n */\nexport enum DeviceSessionStateType {\n Connected,\n ReadyWithoutSecureChannel,\n ReadyWithSecureChannel,\n}\n\ntype DeviceSessionBaseState = {\n readonly sessionStateType: DeviceSessionStateType;\n\n /**\n * The status of the device.\n */\n readonly deviceStatus: DeviceStatus;\n\n /**\n * The model of the device.\n */\n readonly deviceModelId: DeviceModelId;\n\n /**\n * The name of the device.\n */\n readonly deviceName?: string;\n};\n\ntype DeviceSessionReadyState = {\n /**\n * The battery status of the device.\n * TODO: This should not be optional, but it is not in the current implementation.\n */\n readonly batteryStatus?: BatteryStatus;\n\n /**\n * The firmware version of the device.\n * TODO: This should not be optional, but it is not in the current implementation.\n */\n readonly firmwareVersion?: FirmwareVersion;\n\n /**\n * Context of available firmware update\n */\n readonly firmwareUpdateContext?: FirmwareUpdateContext;\n\n /**\n * The current application running on the device.\n */\n readonly currentApp: RunningApp;\n\n /**\n * The current applications installed on the device.\n */\n readonly installedApps: Application[];\n\n /**\n * Available updates from the app store for installed applications.\n */\n readonly appsUpdates?: Application[];\n\n /**\n * The current language packages installed on the device.\n */\n readonly installedLanguages?: InstalledLanguagePackage[];\n\n /**\n * Catalog of available applications and languages for the device.\n */\n readonly catalog?: Catalog;\n\n /**\n * Custom image metadata.\n */\n readonly customImage?: CustomImage;\n\n /**\n * The device is allowed to establish a secure connection.\n */\n readonly isSecureConnectionAllowed: boolean;\n};\n\n/**\n * The state of a connected device session.\n */\nexport type ConnectedState = DeviceSessionBaseState & {\n /**\n * The type of the device session state.\n */\n readonly sessionStateType: DeviceSessionStateType.Connected;\n};\n\n/**\n * The state of a device session when it is ready without a secure channel.\n */\nexport type ReadyWithoutSecureChannelState = DeviceSessionBaseState &\n DeviceSessionReadyState & {\n /**\n * The type of the device session state.\n */\n readonly sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel;\n };\n\n/**\n * The state of a device session when it is ready with a secure channel.\n */\nexport type ReadyWithSecureChannelState = DeviceSessionBaseState &\n DeviceSessionReadyState & {\n /**\n * The type of the device session state.\n */\n readonly sessionStateType: DeviceSessionStateType.ReadyWithSecureChannel;\n };\n\n/**\n * The state of a device session.\n */\nexport type DeviceSessionState =\n | ConnectedState\n | ReadyWithoutSecureChannelState\n | ReadyWithSecureChannelState;\n"],
5
+ "mappings": "AAoIO,IAAKA,OACVA,IAAA,yBACAA,IAAA,yDACAA,IAAA,mDAHUA,OAAA",
6
6
  "names": ["DeviceSessionStateType"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Apdu as r}from"./apdu/model/Apdu";import{APDU_MAX_PAYLOAD as p,ApduBuilder as i}from"./apdu/utils/ApduBuilder";import{ApduParser as n}from"./apdu/utils/ApduParser";export*from"./apdu/utils/AppBuilderError";import{ByteArrayBuilder as f}from"./apdu/utils/ByteArrayBuilder";import{ByteArrayParser as x}from"./apdu/utils/ByteArrayParser";import{InvalidStatusWordError as A}from"./command/Errors";import{CommandResultFactory as u,CommandResultStatus as l,isSuccessCommandResult as v}from"./command/model/CommandResult";import{CloseAppCommand as C}from"./command/os/CloseAppCommand";import{GetAppAndVersionCommand as g}from"./command/os/GetAppAndVersionCommand";import{BatteryStatusType as B,GetBatteryStatusCommand as G}from"./command/os/GetBatteryStatusCommand";import{GetOsVersionCommand as E}from"./command/os/GetOsVersionCommand";import{ListAppsCommand as I}from"./command/os/ListAppsCommand";import{LoadCertificateCommand as T}from"./command/os/LoadCertificateCommand";import{OpenAppCommand as O}from"./command/os/OpenAppCommand";import{isCommandErrorCode as P}from"./command/utils/CommandErrors";import{CommandUtils as _}from"./command/utils/CommandUtils";import{GlobalCommandError as H,GlobalCommandErrorHandler as W}from"./command/utils/GlobalCommandError";import{DeviceModel as K,DeviceModelId as X,LEDGER_VENDOR_ID as q}from"./device/DeviceModel";import{DeviceStatus as N}from"./device/DeviceStatus";import{DeviceActionStatus as j}from"./device-action/model/DeviceActionState";import{UserInteractionRequired as J}from"./device-action/model/UserInteractionRequired";import{CallTaskInAppDeviceAction as Z}from"./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction";import{UnknownDAError as ee}from"./device-action/os/Errors";import{GetDeviceStatusDeviceAction as re}from"./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction";import{GoToDashboardDeviceAction as pe}from"./device-action/os/GoToDashboard/GoToDashboardDeviceAction";import{ListAppsDeviceAction as me}from"./device-action/os/ListApps/ListAppsDeviceAction";import{ListAppsWithMetadataDeviceAction as ae}from"./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction";import{OpenAppDeviceAction as fe}from"./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction";import{SendCommandInAppDeviceAction as xe}from"./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction";import{XStateDeviceAction as Ae}from"./device-action/xstate-utils/XStateDeviceAction";import{StaticDeviceModelDataSource as ue}from"./device-model/data/StaticDeviceModelDataSource";import{BleDeviceInfos as ve}from"./device-model/model/BleDeviceInfos";import{TransportDeviceModel as Ce}from"./device-model/model/DeviceModel";import{ApduResponse as ge}from"./device-session/ApduResponse";export*from"./device-session/data/FramerConst";import{DeviceSessionStateType as Ge}from"./device-session/DeviceSessionState";import{GenuineCheckDeviceAction as Ee}from"./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction";import{InstallAppDeviceAction as Ie}from"./secure-channel/device-action/InstallApp/InstallAppDeviceAction";import{ListInstalledAppsDeviceAction as Te}from"./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction";import{UninstallAppDeviceAction as Oe}from"./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction";import{defaultApduReceiverServiceStubBuilder as Pe}from"./device-session/service/DefaultApduReceiverService.stub";import{defaultApduSenderServiceStubBuilder as _e}from"./device-session/service/DefaultApduSenderService.stub";import{FramerUtils as He}from"./device-session/utils/FramerUtils";import{DeviceManagementKit as Fe}from"./DeviceManagementKit";import{DeviceManagementKitBuilder as Xe}from"./DeviceManagementKitBuilder";export*from"./Error";import{LogLevel as Ne}from"./logger-subscriber/model/LogLevel";import{ConsoleLogger as je}from"./logger-subscriber/service/ConsoleLogger";import{WebLogsExporterLogger as Je}from"./logger-subscriber/service/WebLogsExporterLogger";import{ConnectedDevice as Ze}from"./transport/model/ConnectedDevice";import{DeviceConnectionStateMachine as eo}from"./transport/model/DeviceConnectionStateMachine";export*from"./transport/model/Errors";import{TransportConnectedDevice as to}from"./transport/model/TransportConnectedDevice";import{connectedDeviceStubBuilder as io}from"./transport/model/TransportConnectedDevice.stub";export*from"./types";import{base64StringToBuffer as ao,isBase64String as so}from"./utils/Base64String";import{bufferToHexaString as co,hexaStringToBuffer as xo,isHexaString as Ao}from"./utils/HexaString";export{p as APDU_MAX_PAYLOAD,r as Apdu,i as ApduBuilder,n as ApduParser,ge as ApduResponse,B as BatteryStatusType,ve as BleDeviceInfos,f as ByteArrayBuilder,x as ByteArrayParser,Z as CallTaskInAppDeviceAction,C as CloseAppCommand,u as CommandResultFactory,l as CommandResultStatus,_ as CommandUtils,Ze as ConnectedDevice,je as ConsoleLogger,j as DeviceActionStatus,eo as DeviceConnectionStateMachine,Fe as DeviceManagementKit,Xe as DeviceManagementKitBuilder,K as DeviceModel,X as DeviceModelId,Ge as DeviceSessionStateType,N as DeviceStatus,He as FramerUtils,Ee as GenuineCheckDeviceAction,g as GetAppAndVersionCommand,G as GetBatteryStatusCommand,re as GetDeviceStatusDeviceAction,E as GetOsVersionCommand,H as GlobalCommandError,W as GlobalCommandErrorHandler,pe as GoToDashboardDeviceAction,Ie as InstallAppDeviceAction,A as InvalidStatusWordError,q as LEDGER_VENDOR_ID,I as ListAppsCommand,me as ListAppsDeviceAction,ae as ListAppsWithMetadataDeviceAction,Te as ListInstalledAppsDeviceAction,T as LoadCertificateCommand,Ne as LogLevel,O as OpenAppCommand,fe as OpenAppDeviceAction,xe as SendCommandInAppDeviceAction,ue as StaticDeviceModelDataSource,to as TransportConnectedDevice,Ce as TransportDeviceModel,Oe as UninstallAppDeviceAction,ee as UnknownDAError,J as UserInteractionRequired,Je as WebLogsExporterLogger,Ae as XStateDeviceAction,ao as base64StringToBuffer,co as bufferToHexaString,io as connectedDeviceStubBuilder,Pe as defaultApduReceiverServiceStubBuilder,_e as defaultApduSenderServiceStubBuilder,xo as hexaStringToBuffer,so as isBase64String,P as isCommandErrorCode,Ao as isHexaString,v as isSuccessCommandResult};
1
+ import{Apdu as o}from"./apdu/model/Apdu";import{APDU_MAX_PAYLOAD as p,ApduBuilder as i}from"./apdu/utils/ApduBuilder";import{ApduParser as m}from"./apdu/utils/ApduParser";export*from"./apdu/utils/AppBuilderError";import{ByteArrayBuilder as c}from"./apdu/utils/ByteArrayBuilder";import{ByteArrayParser as x}from"./apdu/utils/ByteArrayParser";import{InvalidStatusWordError as d}from"./command/Errors";import{CommandResultFactory as l,CommandResultStatus as u,isSuccessCommandResult as v}from"./command/model/CommandResult";import{CloseAppCommand as C}from"./command/os/CloseAppCommand";import{GetAppAndVersionCommand as L}from"./command/os/GetAppAndVersionCommand";import{BatteryStatusType as B,GetBatteryStatusCommand as E}from"./command/os/GetBatteryStatusCommand";import{GetOsVersionCommand as M}from"./command/os/GetOsVersionCommand";import{ListAppsCommand as I}from"./command/os/ListAppsCommand";import{LoadCertificateCommand as b}from"./command/os/LoadCertificateCommand";import{OpenAppCommand as T}from"./command/os/OpenAppCommand";import{isCommandErrorCode as P}from"./command/utils/CommandErrors";import{CommandUtils as k}from"./command/utils/CommandUtils";import{GlobalCommandError as _,GlobalCommandErrorHandler as F}from"./command/utils/GlobalCommandError";import{DeviceModel as w,DeviceModelId as K,LEDGER_VENDOR_ID as X}from"./device/DeviceModel";import{DeviceStatus as N}from"./device/DeviceStatus";import{DeviceActionStatus as j}from"./device-action/model/DeviceActionState";import{UserInteractionRequired as J}from"./device-action/model/UserInteractionRequired";import{CallTaskInAppDeviceAction as Z}from"./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction";import{AppAlreadyInstalledDAError as ee,DeviceLockedError as re,OutOfMemoryDAError as oe,RefusedByUserDAError as te,UnknownDAError as pe,UnsupportedFirmwareDAError as ie}from"./device-action/os/Errors";import{GetDeviceMetadataDeviceAction as me}from"./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction";import{GetDeviceStatusDeviceAction as se}from"./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction";import{GoToDashboardDeviceAction as fe}from"./device-action/os/GoToDashboard/GoToDashboardDeviceAction";import{InstallOrUpdateAppsDeviceAction as Ae}from"./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction";import{ListAppsDeviceAction as De}from"./device-action/os/ListApps/ListAppsDeviceAction";import{ListAppsWithMetadataDeviceAction as ue}from"./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction";import{OpenAppDeviceAction as Se}from"./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction";import{OpenAppWithDependenciesDeviceAction as ye}from"./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction";import{SendCommandInAppDeviceAction as ge}from"./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction";import{XStateDeviceAction as Ee}from"./device-action/xstate-utils/XStateDeviceAction";import{StaticDeviceModelDataSource as Me}from"./device-model/data/StaticDeviceModelDataSource";import{BleDeviceInfos as Ie}from"./device-model/model/BleDeviceInfos";import{TransportDeviceModel as be}from"./device-model/model/DeviceModel";import{ApduResponse as Te}from"./device-session/ApduResponse";export*from"./device-session/data/FramerConst";import{DeviceSessionStateType as Ve}from"./device-session/DeviceSessionState";import{GenuineCheckDeviceAction as We}from"./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction";import{InstallAppDeviceAction as Fe}from"./secure-channel/device-action/InstallApp/InstallAppDeviceAction";import{ListInstalledAppsDeviceAction as we}from"./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction";import{UninstallAppDeviceAction as Xe}from"./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction";import{SecureChannelError as Ne}from"../internal/secure-channel/model/Errors";import{defaultApduReceiverServiceStubBuilder as je}from"./device-session/service/DefaultApduReceiverService.stub";import{defaultApduSenderServiceStubBuilder as Je}from"./device-session/service/DefaultApduSenderService.stub";import{FramerUtils as Ze}from"./device-session/utils/FramerUtils";import{DeviceManagementKit as er}from"./DeviceManagementKit";import{DeviceManagementKitBuilder as or}from"./DeviceManagementKitBuilder";export*from"./Error";import{LogLevel as ir}from"./logger-subscriber/model/LogLevel";import{ConsoleLogger as mr}from"./logger-subscriber/service/ConsoleLogger";import{WebLogsExporterLogger as sr}from"./logger-subscriber/service/WebLogsExporterLogger";import{ConnectedDevice as fr}from"./transport/model/ConnectedDevice";import{DeviceConnectionStateMachine as Ar}from"./transport/model/DeviceConnectionStateMachine";export*from"./transport/model/Errors";import{TransportConnectedDevice as lr}from"./transport/model/TransportConnectedDevice";import{connectedDeviceStubBuilder as vr}from"./transport/model/TransportConnectedDevice.stub";export*from"./types";import{base64StringToBuffer as yr,isBase64String as Lr}from"./utils/Base64String";import{bufferToHexaString as Br,hexaStringToBuffer as Er,isHexaString as Gr}from"./utils/HexaString";export{p as APDU_MAX_PAYLOAD,o as Apdu,i as ApduBuilder,m as ApduParser,Te as ApduResponse,ee as AppAlreadyInstalledDAError,B as BatteryStatusType,Ie as BleDeviceInfos,c as ByteArrayBuilder,x as ByteArrayParser,Z as CallTaskInAppDeviceAction,C as CloseAppCommand,l as CommandResultFactory,u as CommandResultStatus,k as CommandUtils,fr as ConnectedDevice,mr as ConsoleLogger,j as DeviceActionStatus,Ar as DeviceConnectionStateMachine,re as DeviceLockedError,er as DeviceManagementKit,or as DeviceManagementKitBuilder,w as DeviceModel,K as DeviceModelId,Ve as DeviceSessionStateType,N as DeviceStatus,Ze as FramerUtils,We as GenuineCheckDeviceAction,L as GetAppAndVersionCommand,E as GetBatteryStatusCommand,me as GetDeviceMetadataDeviceAction,se as GetDeviceStatusDeviceAction,M as GetOsVersionCommand,_ as GlobalCommandError,F as GlobalCommandErrorHandler,fe as GoToDashboardDeviceAction,Fe as InstallAppDeviceAction,Ae as InstallOrUpdateAppsDeviceAction,d as InvalidStatusWordError,X as LEDGER_VENDOR_ID,I as ListAppsCommand,De as ListAppsDeviceAction,ue as ListAppsWithMetadataDeviceAction,we as ListInstalledAppsDeviceAction,b as LoadCertificateCommand,ir as LogLevel,T as OpenAppCommand,Se as OpenAppDeviceAction,ye as OpenAppWithDependenciesDeviceAction,oe as OutOfMemoryDAError,te as RefusedByUserDAError,Ne as SecureChannelError,ge as SendCommandInAppDeviceAction,Me as StaticDeviceModelDataSource,lr as TransportConnectedDevice,be as TransportDeviceModel,Xe as UninstallAppDeviceAction,pe as UnknownDAError,ie as UnsupportedFirmwareDAError,J as UserInteractionRequired,sr as WebLogsExporterLogger,Ee as XStateDeviceAction,yr as base64StringToBuffer,Br as bufferToHexaString,vr as connectedDeviceStubBuilder,je as defaultApduReceiverServiceStubBuilder,Je as defaultApduSenderServiceStubBuilder,Er as hexaStringToBuffer,Lr as isBase64String,P as isCommandErrorCode,Gr as isHexaString,v as isSuccessCommandResult};
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 { UnknownDAError } from \"@api/device-action/os/Errors\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\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 { 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\";\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": "AAEA,OAAS,QAAAA,MAAY,uBACrB,OAAS,oBAAAC,EAAkB,eAAAC,MAAmB,8BAC9C,OAAS,cAAAC,MAAkB,6BAC3B,WAAc,kCACd,OAAS,oBAAAC,MAAwB,mCACjC,OAAS,mBAAAC,MAAuB,kCAChC,OAAS,0BAAAC,MAA8B,sBACvC,OACE,wBAAAC,EACA,uBAAAC,EACA,0BAAAC,MACK,mCACP,OAAS,mBAAAC,MAAuB,kCAChC,OACE,2BAAAC,MAEK,0CACP,OACE,qBAAAC,EAEA,2BAAAC,MAEK,0CACP,OACE,uBAAAC,MAEK,sCACP,OAEE,mBAAAC,MAGK,kCACP,OAEE,0BAAAC,MAEK,yCACP,OAEE,kBAAAC,MACK,iCACP,OAAS,sBAAAC,MAA0B,mCACnC,OAAS,gBAAAC,MAAoB,kCAC7B,OACE,sBAAAC,EACA,6BAAAC,MACK,wCACP,OACE,eAAAC,EACA,iBAAAC,EACA,oBAAAC,MACK,0BACP,OAAS,gBAAAC,MAAoB,2BAE7B,OAEE,sBAAAC,MACK,6CACP,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,6BAAAC,MAAiC,4EAC1C,OAAS,kBAAAC,OAAsB,+BAC/B,OAAS,+BAAAC,OAAmC,oEAC5C,OAAS,6BAAAC,OAAiC,gEAC1C,OAAS,wBAAAC,OAA4B,sDACrC,OAAS,oCAAAC,OAAwC,8EACjD,OAAS,uBAAAC,OAA2B,gEACpC,OAAS,gCAAAC,OAAoC,kFAC7C,OAEE,sBAAAC,OACK,qDACP,OAAS,+BAAAC,OAAmC,qDAC5C,OAAS,kBAAAC,OAAsB,yCAC/B,OAAS,wBAAAC,OAA4B,sCACrC,OAAS,gBAAAC,OAAoB,mCAC7B,WAAc,uCACd,OAEE,0BAAAC,OACK,yCACP,OAAS,4BAAAC,OAAgC,0EACzC,OAAS,0BAAAC,OAA8B,sEACvC,OAAS,iCAAAC,OAAqC,oFAC9C,OAAS,4BAAAC,OAAgC,0EAEzC,OAAS,yCAAAC,OAA6C,8DACtD,OAAS,uCAAAC,OAA2C,4DACpD,OAAS,eAAAC,OAAmB,wCAC5B,OAAS,uBAAAC,OAA2B,2BACpC,OAAS,8BAAAC,OAAkC,kCAC3C,WAAc,aACd,OAAS,YAAAC,OAAgB,wCACzB,OAAS,iBAAAC,OAAqB,+CAC9B,OAAS,yBAAAC,OAA6B,uDACtC,OAAS,mBAAAC,OAAuB,uCAChC,OACE,gCAAAC,OAEK,oDACP,WAAc,8BACd,OAAS,4BAAAC,OAAgC,gDACzC,OAAS,8BAAAC,OAAkC,qDAC3C,WAAc,aACd,OAAS,wBAAAC,GAAsB,kBAAAC,OAAsB,0BACrD,OACE,sBAAAC,GACA,sBAAAC,GACA,gBAAAC,OACK",
6
- "names": ["Apdu", "APDU_MAX_PAYLOAD", "ApduBuilder", "ApduParser", "ByteArrayBuilder", "ByteArrayParser", "InvalidStatusWordError", "CommandResultFactory", "CommandResultStatus", "isSuccessCommandResult", "CloseAppCommand", "GetAppAndVersionCommand", "BatteryStatusType", "GetBatteryStatusCommand", "GetOsVersionCommand", "ListAppsCommand", "LoadCertificateCommand", "OpenAppCommand", "isCommandErrorCode", "CommandUtils", "GlobalCommandError", "GlobalCommandErrorHandler", "DeviceModel", "DeviceModelId", "LEDGER_VENDOR_ID", "DeviceStatus", "DeviceActionStatus", "UserInteractionRequired", "CallTaskInAppDeviceAction", "UnknownDAError", "GetDeviceStatusDeviceAction", "GoToDashboardDeviceAction", "ListAppsDeviceAction", "ListAppsWithMetadataDeviceAction", "OpenAppDeviceAction", "SendCommandInAppDeviceAction", "XStateDeviceAction", "StaticDeviceModelDataSource", "BleDeviceInfos", "TransportDeviceModel", "ApduResponse", "DeviceSessionStateType", "GenuineCheckDeviceAction", "InstallAppDeviceAction", "ListInstalledAppsDeviceAction", "UninstallAppDeviceAction", "defaultApduReceiverServiceStubBuilder", "defaultApduSenderServiceStubBuilder", "FramerUtils", "DeviceManagementKit", "DeviceManagementKitBuilder", "LogLevel", "ConsoleLogger", "WebLogsExporterLogger", "ConnectedDevice", "DeviceConnectionStateMachine", "TransportConnectedDevice", "connectedDeviceStubBuilder", "base64StringToBuffer", "isBase64String", "bufferToHexaString", "hexaStringToBuffer", "isHexaString"]
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": "AAEA,OAAS,QAAAA,MAAY,uBACrB,OAAS,oBAAAC,EAAkB,eAAAC,MAAmB,8BAC9C,OAAS,cAAAC,MAAkB,6BAC3B,WAAc,kCACd,OAAS,oBAAAC,MAAwB,mCACjC,OAAS,mBAAAC,MAAuB,kCAChC,OAAS,0BAAAC,MAA8B,sBACvC,OACE,wBAAAC,EACA,uBAAAC,EACA,0BAAAC,MACK,mCACP,OAAS,mBAAAC,MAAuB,kCAChC,OACE,2BAAAC,MAEK,0CACP,OACE,qBAAAC,EAEA,2BAAAC,MAEK,0CACP,OACE,uBAAAC,MAEK,sCACP,OAEE,mBAAAC,MAGK,kCACP,OAEE,0BAAAC,MAEK,yCACP,OAEE,kBAAAC,MACK,iCACP,OAAS,sBAAAC,MAA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d,OAAS,4BAAAC,OAAgC,gDACzC,OAAS,8BAAAC,OAAkC,qDAC3C,WAAc,aACd,OAAS,wBAAAC,GAAsB,kBAAAC,OAAsB,0BACrD,OACE,sBAAAC,GACA,sBAAAC,GACA,gBAAAC,OACK",
6
+ "names": ["Apdu", "APDU_MAX_PAYLOAD", "ApduBuilder", "ApduParser", "ByteArrayBuilder", "ByteArrayParser", "InvalidStatusWordError", "CommandResultFactory", "CommandResultStatus", "isSuccessCommandResult", "CloseAppCommand", "GetAppAndVersionCommand", "BatteryStatusType", "GetBatteryStatusCommand", "GetOsVersionCommand", "ListAppsCommand", "LoadCertificateCommand", "OpenAppCommand", "isCommandErrorCode", "CommandUtils", "GlobalCommandError", "GlobalCommandErrorHandler", "DeviceModel", "DeviceModelId", "LEDGER_VENDOR_ID", "DeviceStatus", "DeviceActionStatus", "UserInteractionRequired", "CallTaskInAppDeviceAction", "AppAlreadyInstalledDAError", "DeviceLockedError", "OutOfMemoryDAError", "RefusedByUserDAError", "UnknownDAError", "UnsupportedFirmwareDAError", "GetDeviceMetadataDeviceAction", "GetDeviceStatusDeviceAction", "GoToDashboardDeviceAction", "InstallOrUpdateAppsDeviceAction", "ListAppsDeviceAction", "ListAppsWithMetadataDeviceAction", "OpenAppDeviceAction", "OpenAppWithDependenciesDeviceAction", "SendCommandInAppDeviceAction", "XStateDeviceAction", "StaticDeviceModelDataSource", "BleDeviceInfos", "TransportDeviceModel", "ApduResponse", "DeviceSessionStateType", "GenuineCheckDeviceAction", "InstallAppDeviceAction", "ListInstalledAppsDeviceAction", "UninstallAppDeviceAction", "SecureChannelError", "defaultApduReceiverServiceStubBuilder", "defaultApduSenderServiceStubBuilder", "FramerUtils", "DeviceManagementKit", "DeviceManagementKitBuilder", "LogLevel", "ConsoleLogger", "WebLogsExporterLogger", "ConnectedDevice", "DeviceConnectionStateMachine", "TransportConnectedDevice", "connectedDeviceStubBuilder", "base64StringToBuffer", "isBase64String", "bufferToHexaString", "hexaStringToBuffer", "isHexaString"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Left as d,Right as v}from"purify-ts";import{assign as o,fromObservable as D,fromPromise as c,setup as V}from"xstate";import{isSuccessCommandResult as k}from"../../../command/model/CommandResult";import{GetOsVersionCommand as C}from"../../../command/os/GetOsVersionCommand";import{UserInteractionRequired as u}from"../../../device-action/model/UserInteractionRequired";import{DEFAULT_UNLOCK_TIMEOUT_MS as G}from"../../../device-action/os/Const";import{GoToDashboardDeviceAction as f}from"../../../device-action/os/GoToDashboard/GoToDashboardDeviceAction";import{XStateDeviceAction as y}from"../../../device-action/xstate-utils/XStateDeviceAction";import{DeviceSessionStateType as E}from"../../../device-session/DeviceSessionState";import{ConnectToSecureChannelTask as I}from"../../../secure-channel/task/ConnectToSecureChannelTask";import{SecureChannelEventType as p}from"../../../secure-channel/task/types";import{isDeviceGenuine as x}from"../../../secure-channel/utils";class P extends y{makeStateMachine(n){const{getOsVersion:h,getDeviceVersion:l,getFirmwareVersion:m,genuineCheck:S,getDeviceSessionState:r,setDeviceSessionState:i}=this.extractDependencies(n),a=this.input.unlockTimeout??G,s=new f({input:{unlockTimeout:a}}).makeStateMachine(n);return V({types:{input:{},context:{},output:{}},actors:{goToDashboard:s,getOsVersion:c(h),getDeviceVersion:c(l),getFirmwareVersion:c(m),genuineCheck:D(S)},guards:{hasError:e=>e.context._internalState.error!==null},actions:{assignErrorFromEvent:o({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"GenuineCheckDeviceAction",initial:"DeviceReady",context:e=>({input:{unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:u.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:o({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:e.event.snapshot.context.intermediateValue.requiredUserInteraction})})},onDone:{target:"GoToDashboardCheck",actions:o({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:t=>({...e.context._internalState,error:t})})})},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:o({_internalState:e=>{if(k(e.event.output)){const t=r(),g=e.event.output.data.secureElementFlags.isSecureConnectionAllowed;return t.sessionStateType!==E.Connected&&i({...t,isSecureConnectionAllowed:g}),{...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:o({_internalState:e=>e.event.output.caseOf({Right:t=>({...e.context._internalState,deviceVersion:t}),Left:t=>({...e.context._internalState,error:t})})})},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:o({_internalState:e=>e.event.output.caseOf({Right:t=>({...e.context._internalState,firmwareVersion:t}),Left:t=>({...e.context._internalState,error:t})})})},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:o({intermediateValue:e=>{switch(e.event.snapshot.context?.type){case p.PermissionRequested:return{requiredUserInteraction:u.AllowSecureConnection};case p.PermissionGranted:return{requiredUserInteraction:u.None};default:return{...e.context.intermediateValue}}},_internalState:e=>e.event.snapshot.context?.type===p.Result?{...e.context._internalState,result:{isGenuine:x(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?d(e.context._internalState.error):v(e.context._internalState.result)})}extractDependencies(n){return{getOsVersion:()=>n.sendCommand(new C),getDeviceVersion:({input:r})=>{const{deviceInfo:i}=r;return n.getManagerApiService().getDeviceVersion(i)},getFirmwareVersion:({input:r})=>{const{deviceInfo:i,deviceVersion:a}=r;return n.getManagerApiService().getFirmwareVersion(i,a)},genuineCheck:({input:r})=>{const{deviceInfo:i,finalFirmware:a}=r,s=n.getSecureChannelService().genuineCheck(i,a);return new I(n,{connection:s}).run()},getDeviceSessionState:()=>n.getDeviceSessionState(),setDeviceSessionState:r=>n.setDeviceSessionState(r)}}}export{P as GenuineCheckDeviceAction};
1
+ import{Left as v,Right as d}from"purify-ts";import{assign as o,fromObservable as D,fromPromise as u,setup as V}from"xstate";import{isSuccessCommandResult as k}from"../../../command/model/CommandResult";import{GetOsVersionCommand as C}from"../../../command/os/GetOsVersionCommand";import{UserInteractionRequired as p}from"../../../device-action/model/UserInteractionRequired";import{DEFAULT_UNLOCK_TIMEOUT_MS as G}from"../../../device-action/os/Const";import{GoToDashboardDeviceAction as f}from"../../../device-action/os/GoToDashboard/GoToDashboardDeviceAction";import{XStateDeviceAction as E}from"../../../device-action/xstate-utils/XStateDeviceAction";import{DeviceSessionStateType as y}from"../../../device-session/DeviceSessionState";import{ConnectToSecureChannelTask as I}from"../../../secure-channel/task/ConnectToSecureChannelTask";import{SecureChannelEventType as s}from"../../../secure-channel/task/types";import{isDeviceGenuine as x}from"../../../secure-channel/utils";class P extends E{makeStateMachine(n){const{getOsVersion:h,getDeviceVersion:l,getFirmwareVersion:m,genuineCheck:S,getDeviceSessionState:r,setDeviceSessionState:i}=this.extractDependencies(n),a=this.input.unlockTimeout??G,c=new f({input:{unlockTimeout:a}}).makeStateMachine(n);return V({types:{input:{},context:{},output:{}},actors:{goToDashboard:c,getOsVersion:u(h),getDeviceVersion:u(l),getFirmwareVersion:u(m),genuineCheck:D(S)},guards:{hasError:e=>e.context._internalState.error!==null},actions:{assignErrorFromEvent:o({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"GenuineCheckDeviceAction",initial:"DeviceReady",context:e=>({input:{unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:p.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:o({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:e.event.snapshot.context.intermediateValue.requiredUserInteraction})})},onDone:{target:"GoToDashboardCheck",actions:o({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:t=>({...e.context._internalState,error:t})})})},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:o({_internalState:e=>{if(k(e.event.output)){const t=r(),g=e.event.output.data.secureElementFlags.isSecureConnectionAllowed;return t.sessionStateType!==y.Connected&&i({...t,isSecureConnectionAllowed:g}),{...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:o({_internalState:e=>e.event.output.caseOf({Right:t=>({...e.context._internalState,deviceVersion:t}),Left:t=>({...e.context._internalState,error:t})})})},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:o({_internalState:e=>e.event.output.caseOf({Right:t=>({...e.context._internalState,firmwareVersion:t}),Left:t=>({...e.context._internalState,error:t})})})},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:o({intermediateValue:e=>{switch(e.event.snapshot.context?.type){case s.PermissionRequested:return{requiredUserInteraction:p.AllowSecureConnection};case s.PermissionGranted:return{requiredUserInteraction:p.None};default:return{...e.context.intermediateValue}}},_internalState:e=>e.event.snapshot.context?.type===s.Error?{...e.context._internalState,error:e.event.snapshot.context.error.mapDAErrors()}:e.event.snapshot.context?.type===s.Result?{...e.context._internalState,result:{isGenuine:x(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?v(e.context._internalState.error):d(e.context._internalState.result)})}extractDependencies(n){return{getOsVersion:()=>n.sendCommand(new C),getDeviceVersion:({input:r})=>{const{deviceInfo:i}=r;return n.getManagerApiService().getDeviceVersion(i)},getFirmwareVersion:({input:r})=>{const{deviceInfo:i,deviceVersion:a}=r;return n.getManagerApiService().getFirmwareVersion(i,a)},genuineCheck:({input:r})=>{const{deviceInfo:i,finalFirmware:a}=r,c=n.getSecureChannelService().genuineCheck(i,a);return new I(n,{connection:c}).run()},getDeviceSessionState:()=>n.getDeviceSessionState(),setDeviceSessionState:r=>n.setDeviceSessionState(r)}}}export{P as GenuineCheckDeviceAction};
2
2
  //# sourceMappingURL=GenuineCheckDeviceAction.js.map