@ledgerhq/device-management-kit 0.0.0-signer-eth-20250122093657 → 0.0.0-try-to-fix-20250429171448

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 (900) hide show
  1. package/README.md +85 -36
  2. package/lib/cjs/index.js.map +1 -1
  3. package/lib/cjs/package.json +12 -11
  4. package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
  5. package/lib/cjs/src/api/DeviceManagementKit.js.map +3 -3
  6. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  7. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +3 -3
  8. package/lib/cjs/src/api/DeviceManagementKitBuilder.js +1 -1
  9. package/lib/cjs/src/api/DeviceManagementKitBuilder.js.map +2 -2
  10. package/lib/cjs/src/api/DeviceManagementKitBuilder.test.js +1 -1
  11. package/lib/cjs/src/api/DeviceManagementKitBuilder.test.js.map +2 -2
  12. package/lib/cjs/src/api/DmkConfig.js +1 -1
  13. package/lib/cjs/src/api/DmkConfig.js.map +1 -1
  14. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.test.js +1 -1
  15. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.test.js.map +2 -2
  16. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js +1 -1
  17. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  18. package/lib/cjs/src/api/command/os/LoadCertificateCommand.js +2 -0
  19. package/lib/cjs/src/api/command/os/LoadCertificateCommand.js.map +7 -0
  20. package/lib/cjs/src/api/command/os/LoadCertificateCommand.test.js +2 -0
  21. package/lib/cjs/src/api/command/os/LoadCertificateCommand.test.js.map +7 -0
  22. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js +2 -0
  23. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.js.map +7 -0
  24. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js +2 -0
  25. package/lib/cjs/src/api/command/os/SecureElementFlagsParser.test.js.map +7 -0
  26. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  27. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  28. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js +1 -1
  29. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js.map +3 -3
  30. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
  31. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js.map +3 -3
  32. package/lib/cjs/src/api/command/utils/CommandUtils.js +1 -1
  33. package/lib/cjs/src/api/command/utils/CommandUtils.js.map +3 -3
  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 +3 -3
  36. package/lib/cjs/src/api/device/SecureElementFlags.js +2 -0
  37. package/lib/cjs/src/api/device/SecureElementFlags.js.map +7 -0
  38. package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
  39. package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
  40. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  41. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  42. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  43. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  44. package/lib/cjs/src/api/device-action/__test-utils__/testDeviceActionStates.js +1 -1
  45. package/lib/cjs/src/api/device-action/__test-utils__/testDeviceActionStates.js.map +3 -3
  46. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
  47. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  48. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +2 -0
  49. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +7 -0
  50. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +2 -0
  51. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +7 -0
  52. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +2 -0
  53. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +7 -0
  54. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  55. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
  56. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  57. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
  58. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
  59. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +3 -3
  60. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js +1 -1
  61. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js.map +3 -3
  62. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  63. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  64. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
  65. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
  66. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  67. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  68. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  69. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +3 -3
  70. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  71. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
  72. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js.map +1 -1
  73. package/lib/cjs/src/api/device-session/DeviceSessionState.js +1 -1
  74. package/lib/cjs/src/api/device-session/DeviceSessionState.js.map +1 -1
  75. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.js +2 -0
  76. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.js.map +7 -0
  77. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +2 -0
  78. package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js.map +7 -0
  79. package/lib/cjs/src/api/index.js +1 -1
  80. package/lib/cjs/src/api/index.js.map +3 -3
  81. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js +1 -1
  82. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +2 -2
  83. package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
  84. package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +3 -3
  85. package/lib/cjs/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js +1 -1
  86. package/lib/cjs/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js.map +2 -2
  87. package/lib/cjs/src/api/secure-channel/constants.js +2 -0
  88. package/lib/cjs/src/api/secure-channel/constants.js.map +7 -0
  89. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +2 -0
  90. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +7 -0
  91. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js +2 -0
  92. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js.map +7 -0
  93. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js +2 -0
  94. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +7 -0
  95. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +2 -0
  96. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +7 -0
  97. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js +2 -0
  98. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js.map +7 -0
  99. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js +2 -0
  100. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +7 -0
  101. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +2 -0
  102. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +7 -0
  103. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js +2 -0
  104. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js.map +7 -0
  105. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js +2 -0
  106. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +7 -0
  107. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +2 -0
  108. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +7 -0
  109. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js +2 -0
  110. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js.map +7 -0
  111. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js +2 -0
  112. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +7 -0
  113. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +2 -0
  114. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +7 -0
  115. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +2 -0
  116. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +7 -0
  117. package/lib/cjs/src/api/secure-channel/task/types.js +2 -0
  118. package/lib/cjs/src/api/secure-channel/task/types.js.map +7 -0
  119. package/lib/cjs/src/api/secure-channel/types.js +2 -0
  120. package/lib/cjs/src/api/secure-channel/types.js.map +7 -0
  121. package/lib/cjs/src/api/secure-channel/utils.js +2 -0
  122. package/lib/cjs/src/api/secure-channel/utils.js.map +7 -0
  123. package/lib/cjs/src/api/secure-channel/utils.test.js +2 -0
  124. package/lib/cjs/src/api/secure-channel/utils.test.js.map +7 -0
  125. package/lib/cjs/src/api/transport/model/DeviceApduSender.js +2 -0
  126. package/lib/cjs/src/api/transport/model/DeviceApduSender.js.map +7 -0
  127. package/lib/cjs/src/api/transport/model/DeviceConnection.js +1 -1
  128. package/lib/cjs/src/api/transport/model/DeviceConnection.js.map +1 -1
  129. package/lib/cjs/src/api/transport/model/DeviceConnectionFactory.stub.js +1 -1
  130. package/lib/cjs/src/api/transport/model/DeviceConnectionFactory.stub.js.map +2 -2
  131. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +2 -0
  132. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +7 -0
  133. package/lib/cjs/src/api/transport/model/DiscoveredDevice.js +1 -1
  134. package/lib/cjs/src/api/transport/model/DiscoveredDevice.js.map +1 -1
  135. package/lib/cjs/src/api/transport/model/Errors.js +1 -1
  136. package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
  137. package/lib/cjs/src/api/transport/model/Transport.js.map +1 -1
  138. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.stub.js +1 -1
  139. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.stub.js.map +2 -2
  140. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.test.js +1 -1
  141. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.test.js.map +3 -3
  142. package/lib/cjs/src/api/transport/model/TransportDiscoveredDevice.js +1 -1
  143. package/lib/cjs/src/api/transport/model/TransportDiscoveredDevice.js.map +1 -1
  144. package/lib/cjs/src/api/transport/model/__mocks__/TransportMock.js +1 -1
  145. package/lib/cjs/src/api/transport/model/__mocks__/TransportMock.js.map +2 -2
  146. package/lib/cjs/src/api/types.js +1 -1
  147. package/lib/cjs/src/api/types.js.map +1 -1
  148. package/lib/cjs/src/api/utils/Base64String.test.js +1 -1
  149. package/lib/cjs/src/api/utils/Base64String.test.js.map +2 -2
  150. package/lib/cjs/src/api/utils/HexaString.js +1 -1
  151. package/lib/cjs/src/api/utils/HexaString.js.map +2 -2
  152. package/lib/cjs/src/api/utils/HexaString.test.js +1 -1
  153. package/lib/cjs/src/api/utils/HexaString.test.js.map +2 -2
  154. package/lib/cjs/src/di.js +1 -1
  155. package/lib/cjs/src/di.js.map +3 -3
  156. package/lib/cjs/src/di.stub.js +1 -1
  157. package/lib/cjs/src/di.stub.js.map +2 -2
  158. package/lib/cjs/src/internal/config/data/LocalConfigDataSource.test.js +1 -1
  159. package/lib/cjs/src/internal/config/data/LocalConfigDataSource.test.js.map +3 -3
  160. package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.test.js +1 -1
  161. package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.test.js.map +2 -2
  162. package/lib/cjs/src/internal/config/data/__mocks__/LocalConfigDataSource.js +1 -1
  163. package/lib/cjs/src/internal/config/data/__mocks__/LocalConfigDataSource.js.map +2 -2
  164. package/lib/cjs/src/internal/config/data/__mocks__/RemoteConfigDataSource.js +1 -1
  165. package/lib/cjs/src/internal/config/data/__mocks__/RemoteConfigDataSource.js.map +2 -2
  166. package/lib/cjs/src/internal/config/service/DefaultConfigService.test.js +1 -1
  167. package/lib/cjs/src/internal/config/service/DefaultConfigService.test.js.map +2 -2
  168. package/lib/cjs/src/internal/config/use-case/GetDmkVersionUseCase.test.js +1 -1
  169. package/lib/cjs/src/internal/config/use-case/GetDmkVersionUseCase.test.js.map +2 -2
  170. package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js +1 -1
  171. package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js.map +3 -3
  172. package/lib/cjs/src/internal/device-session/data/DeviceSessionRefresherConst.js +1 -1
  173. package/lib/cjs/src/internal/device-session/data/DeviceSessionRefresherConst.js.map +3 -3
  174. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  175. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  176. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  177. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  178. package/lib/cjs/src/internal/device-session/model/DevicePinger.js +2 -0
  179. package/lib/cjs/src/internal/device-session/model/DevicePinger.js.map +7 -0
  180. package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js +2 -0
  181. package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js.map +7 -0
  182. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  183. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
  184. package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js +1 -1
  185. package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js.map +3 -3
  186. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js +2 -0
  187. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +7 -0
  188. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js +2 -0
  189. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js.map +7 -0
  190. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  191. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
  192. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  193. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +3 -3
  194. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js +2 -0
  195. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js.map +7 -0
  196. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js +2 -0
  197. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +7 -0
  198. package/lib/cjs/src/internal/device-session/model/Frame.js +1 -1
  199. package/lib/cjs/src/internal/device-session/model/Frame.js.map +3 -3
  200. package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.test.js +1 -1
  201. package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.test.js.map +2 -2
  202. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  203. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  204. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  205. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  206. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
  207. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
  208. package/lib/cjs/src/internal/device-session/service/MutexService.js +2 -0
  209. package/lib/cjs/src/internal/device-session/service/MutexService.js.map +7 -0
  210. package/lib/cjs/src/internal/device-session/service/MutexService.test.js +2 -0
  211. package/lib/cjs/src/internal/device-session/service/MutexService.test.js.map +7 -0
  212. package/lib/cjs/src/internal/device-session/service/RefresherService.js +2 -0
  213. package/lib/cjs/src/internal/device-session/service/RefresherService.js.map +7 -0
  214. package/lib/cjs/src/internal/device-session/service/RefresherService.test.js +2 -0
  215. package/lib/cjs/src/internal/device-session/service/RefresherService.test.js.map +7 -0
  216. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.js +1 -1
  217. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.js.map +3 -3
  218. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
  219. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
  220. package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +1 -1
  221. package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +3 -3
  222. package/lib/cjs/src/internal/device-session/utils/deviceSessionUtils.js +2 -0
  223. package/lib/cjs/src/internal/device-session/utils/deviceSessionUtils.js.map +7 -0
  224. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  225. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  226. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  227. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
  228. package/lib/cjs/src/internal/discovery/di/discoveryTypes.js +1 -1
  229. package/lib/cjs/src/internal/discovery/di/discoveryTypes.js.map +2 -2
  230. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  231. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  232. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  233. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  234. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  235. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +3 -3
  236. package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +1 -1
  237. package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +3 -3
  238. package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +1 -1
  239. package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +3 -3
  240. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +2 -0
  241. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +7 -0
  242. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js +2 -0
  243. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js.map +7 -0
  244. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js +1 -1
  245. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js.map +3 -3
  246. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +1 -1
  247. package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +3 -3
  248. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js +1 -1
  249. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +2 -2
  250. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
  251. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +3 -3
  252. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
  253. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +2 -2
  254. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  255. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  256. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js +1 -1
  257. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js.map +2 -2
  258. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +1 -1
  259. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js.map +2 -2
  260. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  261. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  262. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  263. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  264. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
  265. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
  266. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js +1 -1
  267. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  268. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  269. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  270. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
  271. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  272. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  273. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  274. package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js +1 -1
  275. package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js.map +2 -2
  276. package/lib/cjs/src/internal/manager-api/model/Application.js +1 -1
  277. package/lib/cjs/src/internal/manager-api/model/Application.js.map +1 -1
  278. package/lib/cjs/src/internal/manager-api/model/Const.js +1 -1
  279. package/lib/cjs/src/internal/manager-api/model/Const.js.map +3 -3
  280. package/lib/cjs/src/internal/manager-api/model/Errors.js +1 -1
  281. package/lib/cjs/src/internal/manager-api/model/Errors.js.map +3 -3
  282. package/lib/cjs/src/internal/manager-api/model/Firmware.js +1 -1
  283. package/lib/cjs/src/internal/manager-api/model/Firmware.js.map +1 -1
  284. package/lib/cjs/src/internal/manager-api/model/Params.js +1 -1
  285. package/lib/cjs/src/internal/manager-api/model/Params.js.map +1 -1
  286. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  287. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  288. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  289. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  290. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
  291. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
  292. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js +2 -0
  293. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js.map +7 -0
  294. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js +2 -0
  295. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +7 -0
  296. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js +2 -0
  297. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +7 -0
  298. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +2 -0
  299. package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +7 -0
  300. package/lib/cjs/src/internal/secure-channel/data/SecureChannelDataSource.js +2 -0
  301. package/lib/cjs/src/internal/secure-channel/data/SecureChannelDataSource.js.map +7 -0
  302. package/lib/cjs/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js +2 -0
  303. package/lib/cjs/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js.map +7 -0
  304. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +2 -0
  305. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +7 -0
  306. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +2 -0
  307. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +7 -0
  308. package/lib/cjs/src/internal/secure-channel/di/secureChannelTypes.js +2 -0
  309. package/lib/cjs/src/internal/secure-channel/di/secureChannelTypes.js.map +7 -0
  310. package/lib/cjs/src/internal/secure-channel/model/Const.js +2 -0
  311. package/lib/cjs/src/internal/secure-channel/model/Const.js.map +7 -0
  312. package/lib/cjs/src/internal/secure-channel/model/Errors.js +2 -0
  313. package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +7 -0
  314. package/lib/cjs/src/internal/secure-channel/model/Params.js +2 -0
  315. package/lib/cjs/src/internal/secure-channel/model/Params.js.map +7 -0
  316. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js +2 -0
  317. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +7 -0
  318. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +2 -0
  319. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +7 -0
  320. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js +2 -0
  321. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js.map +7 -0
  322. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js +1 -1
  323. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
  324. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
  325. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
  326. package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
  327. package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
  328. package/lib/cjs/src/internal/transport/service/DefaultTransportService.js +1 -1
  329. package/lib/cjs/src/internal/transport/service/DefaultTransportService.js.map +3 -3
  330. package/lib/cjs/src/internal/transport/service/DefaultTransportService.test.js +1 -1
  331. package/lib/cjs/src/internal/transport/service/DefaultTransportService.test.js.map +2 -2
  332. package/lib/cjs/src/internal/transport/service/TransportService.js +1 -1
  333. package/lib/cjs/src/internal/transport/service/TransportService.js.map +1 -1
  334. package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
  335. package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
  336. package/lib/esm/package.json +12 -11
  337. package/lib/esm/src/api/DeviceManagementKit.js +1 -1
  338. package/lib/esm/src/api/DeviceManagementKit.js.map +3 -3
  339. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  340. package/lib/esm/src/api/DeviceManagementKit.test.js.map +3 -3
  341. package/lib/esm/src/api/DeviceManagementKitBuilder.js +1 -1
  342. package/lib/esm/src/api/DeviceManagementKitBuilder.js.map +3 -3
  343. package/lib/esm/src/api/DeviceManagementKitBuilder.test.js +1 -1
  344. package/lib/esm/src/api/DeviceManagementKitBuilder.test.js.map +2 -2
  345. package/lib/esm/src/api/apdu/utils/ByteArrayParser.test.js +1 -1
  346. package/lib/esm/src/api/apdu/utils/ByteArrayParser.test.js.map +2 -2
  347. package/lib/esm/src/api/command/os/GetOsVersionCommand.js +1 -1
  348. package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  349. package/lib/esm/src/api/command/os/LoadCertificateCommand.js +2 -0
  350. package/lib/esm/src/api/command/os/LoadCertificateCommand.js.map +7 -0
  351. package/lib/esm/src/api/command/os/LoadCertificateCommand.test.js +2 -0
  352. package/lib/esm/src/api/command/os/LoadCertificateCommand.test.js.map +7 -0
  353. package/lib/esm/src/api/command/os/SecureElementFlagsParser.js +2 -0
  354. package/lib/esm/src/api/command/os/SecureElementFlagsParser.js.map +7 -0
  355. package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js +2 -0
  356. package/lib/esm/src/api/command/os/SecureElementFlagsParser.test.js.map +7 -0
  357. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  358. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  359. package/lib/esm/src/api/command/use-case/SendCommandUseCase.js +1 -1
  360. package/lib/esm/src/api/command/use-case/SendCommandUseCase.js.map +3 -3
  361. package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
  362. package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js.map +3 -3
  363. package/lib/esm/src/api/command/utils/CommandUtils.js +1 -1
  364. package/lib/esm/src/api/command/utils/CommandUtils.js.map +3 -3
  365. package/lib/esm/src/api/command/utils/CommandUtils.test.js +1 -1
  366. package/lib/esm/src/api/command/utils/CommandUtils.test.js.map +3 -3
  367. package/lib/esm/src/api/device/SecureElementFlags.js +1 -0
  368. package/lib/esm/src/api/device/SecureElementFlags.js.map +7 -0
  369. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  370. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  371. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  372. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  373. package/lib/esm/src/api/device-action/__test-utils__/testDeviceActionStates.js +1 -1
  374. package/lib/esm/src/api/device-action/__test-utils__/testDeviceActionStates.js.map +3 -3
  375. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
  376. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  377. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +2 -0
  378. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +7 -0
  379. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +2 -0
  380. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +7 -0
  381. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -0
  382. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +7 -0
  383. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  384. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
  385. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  386. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
  387. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
  388. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +3 -3
  389. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js +1 -1
  390. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js.map +3 -3
  391. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  392. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  393. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
  394. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
  395. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  396. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  397. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  398. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +3 -3
  399. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  400. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
  401. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js.map +1 -1
  402. package/lib/esm/src/api/device-session/DeviceSessionState.js.map +1 -1
  403. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.js +2 -0
  404. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.js.map +7 -0
  405. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +2 -0
  406. package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js.map +7 -0
  407. package/lib/esm/src/api/index.js +1 -1
  408. package/lib/esm/src/api/index.js.map +3 -3
  409. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js +1 -1
  410. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +2 -2
  411. package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
  412. package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +3 -3
  413. package/lib/esm/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js +1 -1
  414. package/lib/esm/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js.map +2 -2
  415. package/lib/esm/src/api/secure-channel/constants.js +2 -0
  416. package/lib/esm/src/api/secure-channel/constants.js.map +7 -0
  417. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +2 -0
  418. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +7 -0
  419. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js +2 -0
  420. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.js.map +7 -0
  421. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/types.js +1 -0
  422. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/types.js.map +7 -0
  423. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +2 -0
  424. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +7 -0
  425. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js +2 -0
  426. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.js.map +7 -0
  427. package/lib/esm/src/api/secure-channel/device-action/InstallApp/types.js +1 -0
  428. package/lib/esm/src/api/secure-channel/device-action/InstallApp/types.js.map +7 -0
  429. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +2 -0
  430. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +7 -0
  431. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js +2 -0
  432. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.js.map +7 -0
  433. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js +2 -0
  434. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +7 -0
  435. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +2 -0
  436. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +7 -0
  437. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js +2 -0
  438. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.js.map +7 -0
  439. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/types.js +1 -0
  440. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/types.js.map +7 -0
  441. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +2 -0
  442. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +7 -0
  443. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +2 -0
  444. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +7 -0
  445. package/lib/esm/src/api/secure-channel/task/types.js +2 -0
  446. package/lib/esm/src/api/secure-channel/task/types.js.map +7 -0
  447. package/lib/esm/src/api/secure-channel/types.js +1 -0
  448. package/lib/esm/src/api/secure-channel/types.js.map +7 -0
  449. package/lib/esm/src/api/secure-channel/utils.js +2 -0
  450. package/lib/esm/src/api/secure-channel/utils.js.map +7 -0
  451. package/lib/esm/src/api/secure-channel/utils.test.js +2 -0
  452. package/lib/esm/src/api/secure-channel/utils.test.js.map +7 -0
  453. package/lib/esm/src/api/transport/model/DeviceApduSender.js +1 -0
  454. package/lib/esm/src/api/transport/model/DeviceApduSender.js.map +7 -0
  455. package/lib/esm/src/api/transport/model/DeviceConnectionFactory.stub.js +1 -1
  456. package/lib/esm/src/api/transport/model/DeviceConnectionFactory.stub.js.map +2 -2
  457. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +2 -0
  458. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +7 -0
  459. package/lib/esm/src/api/transport/model/Errors.js +1 -1
  460. package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
  461. package/lib/esm/src/api/transport/model/TransportConnectedDevice.stub.js +1 -1
  462. package/lib/esm/src/api/transport/model/TransportConnectedDevice.stub.js.map +2 -2
  463. package/lib/esm/src/api/transport/model/TransportConnectedDevice.test.js +1 -1
  464. package/lib/esm/src/api/transport/model/TransportConnectedDevice.test.js.map +3 -3
  465. package/lib/esm/src/api/transport/model/__mocks__/TransportMock.js +1 -1
  466. package/lib/esm/src/api/transport/model/__mocks__/TransportMock.js.map +2 -2
  467. package/lib/esm/src/api/utils/Base64String.test.js +1 -1
  468. package/lib/esm/src/api/utils/Base64String.test.js.map +2 -2
  469. package/lib/esm/src/api/utils/HexaString.js +1 -1
  470. package/lib/esm/src/api/utils/HexaString.js.map +2 -2
  471. package/lib/esm/src/api/utils/HexaString.test.js +1 -1
  472. package/lib/esm/src/api/utils/HexaString.test.js.map +2 -2
  473. package/lib/esm/src/di.js +1 -1
  474. package/lib/esm/src/di.js.map +3 -3
  475. package/lib/esm/src/di.stub.js +1 -1
  476. package/lib/esm/src/di.stub.js.map +2 -2
  477. package/lib/esm/src/internal/config/data/LocalConfigDataSource.test.js +1 -1
  478. package/lib/esm/src/internal/config/data/LocalConfigDataSource.test.js.map +3 -3
  479. package/lib/esm/src/internal/config/data/RemoteConfigDataSource.test.js +1 -1
  480. package/lib/esm/src/internal/config/data/RemoteConfigDataSource.test.js.map +2 -2
  481. package/lib/esm/src/internal/config/data/__mocks__/LocalConfigDataSource.js +1 -1
  482. package/lib/esm/src/internal/config/data/__mocks__/LocalConfigDataSource.js.map +2 -2
  483. package/lib/esm/src/internal/config/data/__mocks__/RemoteConfigDataSource.js +1 -1
  484. package/lib/esm/src/internal/config/data/__mocks__/RemoteConfigDataSource.js.map +2 -2
  485. package/lib/esm/src/internal/config/service/DefaultConfigService.test.js +1 -1
  486. package/lib/esm/src/internal/config/service/DefaultConfigService.test.js.map +2 -2
  487. package/lib/esm/src/internal/config/use-case/GetDmkVersionUseCase.test.js +1 -1
  488. package/lib/esm/src/internal/config/use-case/GetDmkVersionUseCase.test.js.map +2 -2
  489. package/lib/esm/src/internal/device-session/data/ApduResponseConst.js +1 -1
  490. package/lib/esm/src/internal/device-session/data/ApduResponseConst.js.map +3 -3
  491. package/lib/esm/src/internal/device-session/data/DeviceSessionRefresherConst.js +1 -1
  492. package/lib/esm/src/internal/device-session/data/DeviceSessionRefresherConst.js.map +3 -3
  493. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  494. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  495. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  496. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  497. package/lib/esm/src/internal/device-session/model/DevicePinger.js +2 -0
  498. package/lib/esm/src/internal/device-session/model/DevicePinger.js.map +7 -0
  499. package/lib/esm/src/internal/device-session/model/DevicePinger.test.js +2 -0
  500. package/lib/esm/src/internal/device-session/model/DevicePinger.test.js.map +7 -0
  501. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  502. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
  503. package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js +1 -1
  504. package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js.map +3 -3
  505. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js +2 -0
  506. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +7 -0
  507. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js +2 -0
  508. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.test.js.map +7 -0
  509. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  510. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
  511. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  512. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +3 -3
  513. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js +2 -0
  514. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js.map +7 -0
  515. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js +2 -0
  516. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +7 -0
  517. package/lib/esm/src/internal/device-session/model/Frame.js +1 -1
  518. package/lib/esm/src/internal/device-session/model/Frame.js.map +3 -3
  519. package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.test.js +1 -1
  520. package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.test.js.map +2 -2
  521. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  522. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  523. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  524. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  525. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
  526. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
  527. package/lib/esm/src/internal/device-session/service/MutexService.js +2 -0
  528. package/lib/esm/src/internal/device-session/service/MutexService.js.map +7 -0
  529. package/lib/esm/src/internal/device-session/service/MutexService.test.js +2 -0
  530. package/lib/esm/src/internal/device-session/service/MutexService.test.js.map +7 -0
  531. package/lib/esm/src/internal/device-session/service/RefresherService.js +2 -0
  532. package/lib/esm/src/internal/device-session/service/RefresherService.js.map +7 -0
  533. package/lib/esm/src/internal/device-session/service/RefresherService.test.js +2 -0
  534. package/lib/esm/src/internal/device-session/service/RefresherService.test.js.map +7 -0
  535. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.js +1 -1
  536. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.js.map +3 -3
  537. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
  538. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
  539. package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +1 -1
  540. package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +3 -3
  541. package/lib/esm/src/internal/device-session/utils/deviceSessionUtils.js +2 -0
  542. package/lib/esm/src/internal/device-session/utils/deviceSessionUtils.js.map +7 -0
  543. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  544. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  545. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  546. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
  547. package/lib/esm/src/internal/discovery/di/discoveryTypes.js +1 -1
  548. package/lib/esm/src/internal/discovery/di/discoveryTypes.js.map +2 -2
  549. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  550. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  551. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  552. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  553. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  554. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +3 -3
  555. package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +1 -1
  556. package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +3 -3
  557. package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +1 -1
  558. package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +3 -3
  559. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +2 -0
  560. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +7 -0
  561. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js +2 -0
  562. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.js.map +7 -0
  563. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js +1 -1
  564. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.js.map +3 -3
  565. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +1 -1
  566. package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +3 -3
  567. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js +1 -1
  568. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +2 -2
  569. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
  570. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +3 -3
  571. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
  572. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +2 -2
  573. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  574. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  575. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js +1 -1
  576. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js.map +2 -2
  577. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +1 -1
  578. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js.map +2 -2
  579. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  580. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  581. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  582. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  583. package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  584. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  585. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  586. package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
  587. package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  588. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  589. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  590. package/lib/esm/src/internal/manager-api/di/managerApiTypes.js +1 -1
  591. package/lib/esm/src/internal/manager-api/di/managerApiTypes.js.map +2 -2
  592. package/lib/esm/src/internal/manager-api/model/Application.js.map +1 -1
  593. package/lib/esm/src/internal/manager-api/model/Const.js +1 -1
  594. package/lib/esm/src/internal/manager-api/model/Const.js.map +3 -3
  595. package/lib/esm/src/internal/manager-api/model/Errors.js +1 -1
  596. package/lib/esm/src/internal/manager-api/model/Errors.js.map +3 -3
  597. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  598. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  599. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  600. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  601. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js +2 -0
  602. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js.map +7 -0
  603. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js +2 -0
  604. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +7 -0
  605. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js +2 -0
  606. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +7 -0
  607. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +2 -0
  608. package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +7 -0
  609. package/lib/esm/src/internal/secure-channel/data/SecureChannelDataSource.js +1 -0
  610. package/lib/esm/src/internal/secure-channel/data/SecureChannelDataSource.js.map +7 -0
  611. package/lib/esm/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js +2 -0
  612. package/lib/esm/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js.map +7 -0
  613. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +2 -0
  614. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +7 -0
  615. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +2 -0
  616. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +7 -0
  617. package/lib/esm/src/internal/secure-channel/di/secureChannelTypes.js +2 -0
  618. package/lib/esm/src/internal/secure-channel/di/secureChannelTypes.js.map +7 -0
  619. package/lib/esm/src/internal/secure-channel/model/Const.js +2 -0
  620. package/lib/esm/src/internal/secure-channel/model/Const.js.map +7 -0
  621. package/lib/esm/src/internal/secure-channel/model/Errors.js +2 -0
  622. package/lib/esm/src/internal/secure-channel/model/Errors.js.map +7 -0
  623. package/lib/esm/src/internal/secure-channel/model/Params.js +1 -0
  624. package/lib/esm/src/internal/secure-channel/model/Params.js.map +7 -0
  625. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js +2 -0
  626. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +7 -0
  627. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +2 -0
  628. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +7 -0
  629. package/lib/esm/src/internal/secure-channel/service/SecureChannelService.js +1 -0
  630. package/lib/esm/src/internal/secure-channel/service/SecureChannelService.js.map +7 -0
  631. package/lib/esm/src/internal/send/use-case/SendApduUseCase.js +1 -1
  632. package/lib/esm/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
  633. package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
  634. package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
  635. package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
  636. package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
  637. package/lib/esm/src/internal/transport/service/DefaultTransportService.js +1 -1
  638. package/lib/esm/src/internal/transport/service/DefaultTransportService.js.map +3 -3
  639. package/lib/esm/src/internal/transport/service/DefaultTransportService.test.js +1 -1
  640. package/lib/esm/src/internal/transport/service/DefaultTransportService.test.js.map +2 -2
  641. package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
  642. package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
  643. package/lib/types/src/api/DeviceManagementKit.d.ts +26 -10
  644. package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
  645. package/lib/types/src/api/DeviceManagementKitBuilder.d.ts.map +1 -1
  646. package/lib/types/src/api/DmkConfig.d.ts +1 -0
  647. package/lib/types/src/api/DmkConfig.d.ts.map +1 -1
  648. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +8 -2
  649. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
  650. package/lib/types/src/api/command/os/LoadCertificateCommand.d.ts +25 -0
  651. package/lib/types/src/api/command/os/LoadCertificateCommand.d.ts.map +1 -0
  652. package/lib/types/src/api/command/os/LoadCertificateCommand.test.d.ts +2 -0
  653. package/lib/types/src/api/command/os/LoadCertificateCommand.test.d.ts.map +1 -0
  654. package/lib/types/src/api/command/os/SecureElementFlagsParser.d.ts +43 -0
  655. package/lib/types/src/api/command/os/SecureElementFlagsParser.d.ts.map +1 -0
  656. package/lib/types/src/api/command/os/SecureElementFlagsParser.test.d.ts +2 -0
  657. package/lib/types/src/api/command/os/SecureElementFlagsParser.test.d.ts.map +1 -0
  658. package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
  659. package/lib/types/src/api/command/use-case/SendCommandUseCase.d.ts +5 -1
  660. package/lib/types/src/api/command/use-case/SendCommandUseCase.d.ts.map +1 -1
  661. package/lib/types/src/api/command/utils/CommandUtils.d.ts +1 -0
  662. package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
  663. package/lib/types/src/api/device/SecureElementFlags.d.ts +41 -0
  664. package/lib/types/src/api/device/SecureElementFlags.d.ts.map +1 -0
  665. package/lib/types/src/api/device-action/DeviceAction.d.ts +7 -1
  666. package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
  667. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts +2 -1
  668. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  669. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts +4 -0
  670. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
  671. package/lib/types/src/api/device-action/__test-utils__/testDeviceActionStates.d.ts +5 -2
  672. package/lib/types/src/api/device-action/__test-utils__/testDeviceActionStates.d.ts.map +1 -1
  673. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +3 -2
  674. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
  675. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts +40 -0
  676. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -0
  677. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.d.ts +2 -0
  678. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.d.ts.map +1 -0
  679. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +19 -0
  680. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -0
  681. package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
  682. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts +1 -1
  683. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts.map +1 -1
  684. package/lib/types/src/api/device-session/DeviceSessionState.d.ts +4 -0
  685. package/lib/types/src/api/device-session/DeviceSessionState.d.ts.map +1 -1
  686. package/lib/types/src/api/device-session/use-case/{ToggleDeviceSessionRefresher.d.ts → DisableDeviceSessionRefresher.d.ts} +6 -6
  687. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.d.ts.map +1 -0
  688. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.d.ts +2 -0
  689. package/lib/types/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.d.ts.map +1 -0
  690. package/lib/types/src/api/index.d.ts +7 -0
  691. package/lib/types/src/api/index.d.ts.map +1 -1
  692. package/lib/types/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.d.ts +1 -1
  693. package/lib/types/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.d.ts.map +1 -1
  694. package/lib/types/src/api/secure-channel/constants.d.ts +2 -0
  695. package/lib/types/src/api/secure-channel/constants.d.ts.map +1 -0
  696. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts +8 -0
  697. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -0
  698. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.d.ts +2 -0
  699. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.test.d.ts.map +1 -0
  700. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +48 -0
  701. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -0
  702. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts +8 -0
  703. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -0
  704. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.d.ts +2 -0
  705. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.test.d.ts.map +1 -0
  706. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts +44 -0
  707. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts.map +1 -0
  708. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts +8 -0
  709. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -0
  710. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.d.ts +2 -0
  711. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.test.d.ts.map +1 -0
  712. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts +57 -0
  713. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts.map +1 -0
  714. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts +8 -0
  715. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts.map +1 -0
  716. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.d.ts +2 -0
  717. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.test.d.ts.map +1 -0
  718. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts +41 -0
  719. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -0
  720. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +23 -0
  721. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -0
  722. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.test.d.ts +2 -0
  723. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.test.d.ts.map +1 -0
  724. package/lib/types/src/api/secure-channel/task/types.d.ts +105 -0
  725. package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -0
  726. package/lib/types/src/api/secure-channel/types.d.ts +4 -0
  727. package/lib/types/src/api/secure-channel/types.d.ts.map +1 -0
  728. package/lib/types/src/api/secure-channel/utils.d.ts +30 -0
  729. package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -0
  730. package/lib/types/src/api/secure-channel/utils.test.d.ts +2 -0
  731. package/lib/types/src/api/secure-channel/utils.test.d.ts.map +1 -0
  732. package/lib/types/src/api/transport/model/DeviceApduSender.d.ts +17 -0
  733. package/lib/types/src/api/transport/model/DeviceApduSender.d.ts.map +1 -0
  734. package/lib/types/src/api/transport/model/DeviceConnection.d.ts +2 -1
  735. package/lib/types/src/api/transport/model/DeviceConnection.d.ts.map +1 -1
  736. package/lib/types/src/api/transport/model/DeviceConnectionFactory.stub.d.ts +1 -1
  737. package/lib/types/src/api/transport/model/DeviceConnectionFactory.stub.d.ts.map +1 -1
  738. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +62 -0
  739. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -0
  740. package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts +2 -0
  741. package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts.map +1 -1
  742. package/lib/types/src/api/transport/model/Errors.d.ts +20 -0
  743. package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
  744. package/lib/types/src/api/transport/model/Transport.d.ts +2 -2
  745. package/lib/types/src/api/transport/model/Transport.d.ts.map +1 -1
  746. package/lib/types/src/api/transport/model/TransportDiscoveredDevice.d.ts +2 -0
  747. package/lib/types/src/api/transport/model/TransportDiscoveredDevice.d.ts.map +1 -1
  748. package/lib/types/src/api/transport/model/__mocks__/TransportMock.d.ts +7 -7
  749. package/lib/types/src/api/transport/model/__mocks__/TransportMock.d.ts.map +1 -1
  750. package/lib/types/src/api/types.d.ts +6 -1
  751. package/lib/types/src/api/types.d.ts.map +1 -1
  752. package/lib/types/src/api/utils/HexaString.d.ts +1 -1
  753. package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
  754. package/lib/types/src/di.d.ts.map +1 -1
  755. package/lib/types/src/di.stub.d.ts +1 -1
  756. package/lib/types/src/di.stub.d.ts.map +1 -1
  757. package/lib/types/src/internal/config/data/__mocks__/LocalConfigDataSource.d.ts +1 -1
  758. package/lib/types/src/internal/config/data/__mocks__/LocalConfigDataSource.d.ts.map +1 -1
  759. package/lib/types/src/internal/config/data/__mocks__/RemoteConfigDataSource.d.ts +3 -3
  760. package/lib/types/src/internal/config/data/__mocks__/RemoteConfigDataSource.d.ts.map +1 -1
  761. package/lib/types/src/internal/device-session/data/ApduResponseConst.d.ts +1 -0
  762. package/lib/types/src/internal/device-session/data/ApduResponseConst.d.ts.map +1 -1
  763. package/lib/types/src/internal/device-session/data/DeviceSessionRefresherConst.d.ts +6 -1
  764. package/lib/types/src/internal/device-session/data/DeviceSessionRefresherConst.d.ts.map +1 -1
  765. package/lib/types/src/internal/device-session/di/deviceSessionTypes.d.ts +1 -1
  766. package/lib/types/src/internal/device-session/model/DevicePinger.d.ts +18 -0
  767. package/lib/types/src/internal/device-session/model/DevicePinger.d.ts.map +1 -0
  768. package/lib/types/src/internal/device-session/model/DevicePinger.test.d.ts +2 -0
  769. package/lib/types/src/internal/device-session/model/DevicePinger.test.d.ts.map +1 -0
  770. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +29 -12
  771. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  772. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts +3 -2
  773. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
  774. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts +35 -0
  775. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts.map +1 -0
  776. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.test.d.ts +2 -0
  777. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.test.d.ts.map +1 -0
  778. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts +17 -79
  779. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts.map +1 -1
  780. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts +20 -0
  781. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts.map +1 -0
  782. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.test.d.ts +2 -0
  783. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.test.d.ts.map +1 -0
  784. package/lib/types/src/internal/device-session/model/Frame.d.ts.map +1 -1
  785. package/lib/types/src/internal/device-session/service/MutexService.d.ts +6 -0
  786. package/lib/types/src/internal/device-session/service/MutexService.d.ts.map +1 -0
  787. package/lib/types/src/internal/device-session/service/MutexService.test.d.ts +2 -0
  788. package/lib/types/src/internal/device-session/service/MutexService.test.d.ts.map +1 -0
  789. package/lib/types/src/internal/device-session/service/RefresherService.d.ts +15 -0
  790. package/lib/types/src/internal/device-session/service/RefresherService.d.ts.map +1 -0
  791. package/lib/types/src/internal/device-session/service/RefresherService.test.d.ts +2 -0
  792. package/lib/types/src/internal/device-session/service/RefresherService.test.d.ts.map +1 -0
  793. package/lib/types/src/internal/device-session/use-case/CloseSessionsUseCase.d.ts +3 -1
  794. package/lib/types/src/internal/device-session/use-case/CloseSessionsUseCase.d.ts.map +1 -1
  795. package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts +3 -0
  796. package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts.map +1 -0
  797. package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts +1 -1
  798. package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts.map +1 -1
  799. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts +11 -2
  800. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts.map +1 -1
  801. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts +24 -0
  802. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts.map +1 -0
  803. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.d.ts +2 -0
  804. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.test.d.ts.map +1 -0
  805. package/lib/types/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.d.ts +1 -1
  806. package/lib/types/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.d.ts.map +1 -1
  807. package/lib/types/src/internal/discovery/use-case/StartDiscoveringUseCase.d.ts +1 -1
  808. package/lib/types/src/internal/discovery/use-case/StartDiscoveringUseCase.d.ts.map +1 -1
  809. package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts +1 -1
  810. package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts.map +1 -1
  811. package/lib/types/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.d.ts +5 -5
  812. package/lib/types/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.d.ts.map +1 -1
  813. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +12 -17
  814. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +1 -1
  815. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +21 -50
  816. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
  817. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts +4 -1
  818. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts.map +1 -1
  819. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +6 -9
  820. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
  821. package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
  822. package/lib/types/src/internal/manager-api/di/managerApiTypes.d.ts +1 -0
  823. package/lib/types/src/internal/manager-api/di/managerApiTypes.d.ts.map +1 -1
  824. package/lib/types/src/internal/manager-api/model/Application.d.ts +4 -1
  825. package/lib/types/src/internal/manager-api/model/Application.d.ts.map +1 -1
  826. package/lib/types/src/internal/manager-api/model/Const.d.ts +1 -1
  827. package/lib/types/src/internal/manager-api/model/Const.d.ts.map +1 -1
  828. package/lib/types/src/internal/manager-api/model/Errors.d.ts +0 -6
  829. package/lib/types/src/internal/manager-api/model/Errors.d.ts.map +1 -1
  830. package/lib/types/src/internal/manager-api/model/Firmware.d.ts +4 -0
  831. package/lib/types/src/internal/manager-api/model/Firmware.d.ts.map +1 -1
  832. package/lib/types/src/internal/manager-api/model/Params.d.ts +19 -68
  833. package/lib/types/src/internal/manager-api/model/Params.d.ts.map +1 -1
  834. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +7 -7
  835. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
  836. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +32 -4
  837. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
  838. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts +11 -0
  839. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts.map +1 -0
  840. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.test.d.ts +2 -0
  841. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.test.d.ts.map +1 -0
  842. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts +18 -0
  843. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts.map +1 -0
  844. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.d.ts +2 -0
  845. package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.d.ts.map +1 -0
  846. package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts +52 -0
  847. package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts.map +1 -0
  848. package/lib/types/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.d.ts +10 -0
  849. package/lib/types/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.d.ts.map +1 -0
  850. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts +9 -0
  851. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -0
  852. package/lib/types/src/internal/secure-channel/di/secureChannelModule.test.d.ts +2 -0
  853. package/lib/types/src/internal/secure-channel/di/secureChannelModule.test.d.ts.map +1 -0
  854. package/lib/types/src/internal/secure-channel/di/secureChannelTypes.d.ts +6 -0
  855. package/lib/types/src/internal/secure-channel/di/secureChannelTypes.d.ts.map +1 -0
  856. package/lib/types/src/internal/secure-channel/model/Const.d.ts +2 -0
  857. package/lib/types/src/internal/secure-channel/model/Const.d.ts.map +1 -0
  858. package/lib/types/src/internal/secure-channel/model/Errors.d.ts +14 -0
  859. package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -0
  860. package/lib/types/src/internal/secure-channel/model/Params.d.ts +84 -0
  861. package/lib/types/src/internal/secure-channel/model/Params.d.ts.map +1 -0
  862. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +21 -0
  863. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts.map +1 -0
  864. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.test.d.ts +2 -0
  865. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.test.d.ts.map +1 -0
  866. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts +56 -0
  867. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -0
  868. package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts +5 -1
  869. package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts.map +1 -1
  870. package/lib/types/src/internal/transport/service/DefaultTransportService.d.ts +2 -0
  871. package/lib/types/src/internal/transport/service/DefaultTransportService.d.ts.map +1 -1
  872. package/lib/types/src/internal/transport/service/TransportService.d.ts +3 -1
  873. package/lib/types/src/internal/transport/service/TransportService.d.ts.map +1 -1
  874. package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts +7 -6
  875. package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts.map +1 -1
  876. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  877. package/package.json +14 -13
  878. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js +0 -2
  879. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js.map +0 -7
  880. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js +0 -2
  881. package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js.map +0 -7
  882. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js +0 -2
  883. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js.map +0 -7
  884. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js +0 -2
  885. package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js.map +0 -7
  886. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js +0 -2
  887. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.js.map +0 -7
  888. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js +0 -2
  889. package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js.map +0 -7
  890. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js +0 -2
  891. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js.map +0 -7
  892. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js +0 -2
  893. package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js.map +0 -7
  894. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.d.ts.map +0 -1
  895. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.d.ts +0 -2
  896. package/lib/types/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.d.ts.map +0 -1
  897. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.d.ts +0 -13
  898. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.d.ts.map +0 -1
  899. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.d.ts +0 -2
  900. package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.d.ts.map +0 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/api/device/SecureElementFlags.ts"],
4
+ "sourcesContent": ["/**\n * Represents the general state of a device, the information comes from the first byte of the secure element flags.\n */\nexport type DeviceGeneralState = {\n /**\n * Indicates whether the device's PIN has been validated.\n */\n isPinValidated: boolean;\n\n /**\n * Indicates whether the device has a MCU serial number.\n */\n hasMcuSerialNumber: boolean;\n\n /**\n * Indicates whether the device has a personalized valid Ledger certificate.\n */\n hasValidCertificate: boolean;\n\n /**\n * Indicates whether the device is allowed to connect with a custom certificate authority.\n */\n isCustomAuthorityConnectionAllowed: boolean;\n\n /**\n * Indicates whether the device is allowed to commnunicate with secure connection.\n */\n isSecureConnectionAllowed: boolean;\n\n /**\n * Indicates whether the device has been onboarded.\n */\n isOnboarded: boolean;\n\n /**\n * Indicates whether the MCU code on the device is signed.\n */\n isMcuCodeSigned: boolean;\n\n /**\n * Indicates whether the device is in recovery mode.\n */\n isInRecoveryMode: boolean;\n};\n\n// 2nd byte of the secure element flags, placeholder for the endorsement information\nexport type EndorsementInformation = unknown;\n\n// 3rd byte of the secure element flags, placeholder for the words information\nexport type WordsInformation = unknown;\n\n// 4th byte of the secure element flags, placeholder for the onboarding status\nexport type OnboardingStatus = unknown;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SecureElementFlags_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of s(e))!p.call(t,r)&&r!==i&&a(t,r,{get:()=>e[r],enumerable:!(o=n(e,r))||o.enumerable});return t};var c=t=>m(a({},"__esModule",{value:!0}),t);var d={};module.exports=c(d);
1
+ "use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(r,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of s(e))!p.call(r,t)&&t!==i&&n(r,t,{get:()=>e[t],enumerable:!(o=a(e,t))||o.enumerable});return r};var c=r=>m(n({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
2
2
  //# sourceMappingURL=DeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/api/device-action/DeviceAction.ts"],
4
- "sourcesContent": ["import { type Observable } from \"rxjs\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DmkError } from \"@api/Error\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\n\nimport { type DeviceActionState } from \"./model/DeviceActionState\";\n\nexport type InternalApi = {\n readonly sendCommand: <Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n ) => Promise<CommandResult<Response, ErrorStatusCodes>>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly getDeviceSessionStateObservable: () => Observable<DeviceSessionState>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n readonly getManagerApiService: () => ManagerApiService;\n};\n\nexport type DeviceActionIntermediateValue = {\n readonly requiredUserInteraction: string;\n};\n\nexport type ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> = {\n readonly observable: Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >;\n cancel(): void;\n};\n\nexport interface DeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n> {\n readonly input: Input;\n\n _execute(\n params: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue>;\n}\n"],
4
+ "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DmkError } from \"@api/Error\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { type DeviceActionState } from \"./model/DeviceActionState\";\n\nexport type InternalApi = {\n readonly sendApdu: (\n apdu: Uint8Array,\n ) => Promise<Either<DmkError, ApduResponse>>;\n readonly sendCommand: <Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n abortTimeout?: number,\n ) => Promise<CommandResult<Response, ErrorStatusCodes>>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly getDeviceSessionStateObservable: () => Observable<DeviceSessionState>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n readonly disableRefresher: (blockerId: string) => () => void;\n readonly getManagerApiService: () => ManagerApiService;\n readonly getSecureChannelService: () => SecureChannelService;\n};\n\nexport type DeviceActionIntermediateValue = {\n readonly requiredUserInteraction: string;\n};\n\nexport type ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> = {\n readonly observable: Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >;\n cancel(): void;\n};\n\nexport interface DeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n> {\n readonly input: Input;\n\n _execute(\n params: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue>;\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["DeviceAction_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var S=(t,e)=>{for(var s in e)i(t,s,{get:e[s],enumerable:!0})},v=(t,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of a(e))!r.call(t,n)&&n!==s&&i(t,n,{get:()=>e[n],enumerable:!(o=c(e,n))||o.enumerable});return t};var p=t=>v(i({},"__esModule",{value:!0}),t);var j={};S(j,{makeDeviceActionInternalApiMock:()=>g});module.exports=p(j);const M=jest.fn(),k=jest.fn(),f=jest.fn(),m=jest.fn(),D=jest.fn();function g(){return{sendCommand:M,getDeviceSessionState:k,getDeviceSessionStateObservable:f,setDeviceSessionState:m,getManagerApiService:D}}0&&(module.exports={makeDeviceActionInternalApiMock});
1
+ "use strict";var c=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var v=(n,e)=>{for(var i in e)c(n,i,{get:e[i],enumerable:!0})},S=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!r.call(n,t)&&t!==i&&c(n,t,{get:()=>e[t],enumerable:!(o=s(e,t))||o.enumerable});return n};var p=n=>S(c({},"__esModule",{value:!0}),n);var b={};v(b,{makeDeviceActionInternalApiMock:()=>D});module.exports=p(b);const f=vi.fn(),M=vi.fn(),d=vi.fn(),k=vi.fn(),l=vi.fn(),m=vi.fn(),g=vi.fn(),A=vi.fn();function D(){return{sendApdu:f,sendCommand:M,getDeviceSessionState:d,getDeviceSessionStateObservable:k,setDeviceSessionState:l,getManagerApiService:m,getSecureChannelService:g,disableRefresher:A}}0&&(module.exports={makeDeviceActionInternalApiMock});
2
2
  //# sourceMappingURL=makeInternalApi.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/__test-utils__/makeInternalApi.ts"],
4
- "sourcesContent": ["import { type InternalApi } from \"@api/device-action/DeviceAction\";\n\nconst sendCommandMock = jest.fn();\nconst apiGetDeviceSessionStateMock = jest.fn();\nconst apiGetDeviceSessionStateObservableMock = jest.fn();\nconst setDeviceSessionStateMock = jest.fn();\nconst getManagerApiServiceMock = jest.fn();\n\nexport function makeDeviceActionInternalApiMock(): jest.Mocked<InternalApi> {\n return {\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n getDeviceSessionStateObservable: apiGetDeviceSessionStateObservableMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n getManagerApiService: getManagerApiServiceMock,\n };\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,IAAA,eAAAC,EAAAH,GAEA,MAAMI,EAAkB,KAAK,GAAG,EAC1BC,EAA+B,KAAK,GAAG,EACvCC,EAAyC,KAAK,GAAG,EACjDC,EAA4B,KAAK,GAAG,EACpCC,EAA2B,KAAK,GAAG,EAElC,SAASN,GAA4D,CAC1E,MAAO,CACL,YAAaE,EACb,sBAAuBC,EACvB,gCAAiCC,EACjC,sBAAuBC,EACvB,qBAAsBC,CACxB,CACF",
6
- "names": ["makeInternalApi_exports", "__export", "makeDeviceActionInternalApiMock", "__toCommonJS", "sendCommandMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "setDeviceSessionStateMock", "getManagerApiServiceMock"]
4
+ "sourcesContent": ["import { type Mocked } from \"vitest\";\n\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\n\nconst sendApduMock = vi.fn();\nconst sendCommandMock = vi.fn();\nconst apiGetDeviceSessionStateMock = vi.fn();\nconst apiGetDeviceSessionStateObservableMock = vi.fn();\nconst setDeviceSessionStateMock = vi.fn();\nconst getManagerApiServiceMock = vi.fn();\nconst getSecureChannelServiceMock = vi.fn();\nconst disableRefresherMock = vi.fn();\n\nexport function makeDeviceActionInternalApiMock(): Mocked<InternalApi> {\n return {\n sendApdu: sendApduMock,\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n getDeviceSessionStateObservable: apiGetDeviceSessionStateObservableMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n getManagerApiService: getManagerApiServiceMock,\n getSecureChannelService: getSecureChannelServiceMock,\n disableRefresher: disableRefresherMock,\n };\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,IAAA,eAAAC,EAAAH,GAIA,MAAMI,EAAe,GAAG,GAAG,EACrBC,EAAkB,GAAG,GAAG,EACxBC,EAA+B,GAAG,GAAG,EACrCC,EAAyC,GAAG,GAAG,EAC/CC,EAA4B,GAAG,GAAG,EAClCC,EAA2B,GAAG,GAAG,EACjCC,EAA8B,GAAG,GAAG,EACpCC,EAAuB,GAAG,GAAG,EAE5B,SAAST,GAAuD,CACrE,MAAO,CACL,SAAUE,EACV,YAAaC,EACb,sBAAuBC,EACvB,gCAAiCC,EACjC,sBAAuBC,EACvB,qBAAsBC,EACtB,wBAAyBC,EACzB,iBAAkBC,CACpB,CACF",
6
+ "names": ["makeInternalApi_exports", "__export", "makeDeviceActionInternalApiMock", "__toCommonJS", "sendApduMock", "sendCommandMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "setDeviceSessionStateMock", "getManagerApiServiceMock", "getSecureChannelServiceMock", "disableRefresherMock"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var k=(t,e)=>{for(var o in e)p(t,o,{get:e[o],enumerable:!0})},y=(t,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!A.call(t,i)&&i!==o&&p(t,i,{get:()=>e[i],enumerable:!(c=f(e,i))||c.enumerable});return t};var D=t=>y(p({},"__esModule",{value:!0}),t);var v={};k(v,{setupGetDeviceStatusMock:()=>h,setupGoToDashboardMock:()=>I,setupListAppsMock:()=>M});module.exports=D(v);var r=require("purify-ts"),n=require("xstate"),a=require("../../device-action/model/UserInteractionRequired"),s=require("../../device-action/os/Errors"),m=require("../../device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),d=require("../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),u=require("../../device-action/os/ListApps/ListAppsDeviceAction");const M=(t,e=!1)=>{u.ListAppsDeviceAction.mockImplementation(()=>({makeStateMachine:jest.fn().mockImplementation(()=>(0,n.createMachine)({id:"MockListAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,n.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.AllowListApps})})},done:{type:"final"}},output:()=>e?(0,r.Left)(new s.UnknownDAError("ListApps failed")):(0,r.Right)(t)}))}))},I=(t=!1)=>{d.GoToDashboardDeviceAction.mockImplementation(()=>({makeStateMachine:jest.fn().mockImplementation(()=>(0,n.createMachine)({id:"MockGoToDashboardDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,n.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.None})})},done:{type:"final"}},output:()=>t?(0,r.Left)(new s.UnknownDAError("GoToDashboard failed")):(0,r.Right)(void 0)}))}))},h=(t=[{currentApp:"BOLOS",currentAppVersion:"1.0.0"}])=>{const e=jest.fn();for(const o of t)e.mockImplementationOnce(()=>"currentApp"in o?(0,r.Right)(o):(0,r.Left)(o));m.GetDeviceStatusDeviceAction.mockImplementation(()=>({makeStateMachine:jest.fn().mockImplementation(()=>(0,n.createMachine)({id:"MockGetDeviceStatusDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,n.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.None})})},done:{type:"final"}},output:e}))}))};0&&(module.exports={setupGetDeviceStatusMock,setupGoToDashboardMock,setupListAppsMock});
1
+ "use strict";var p=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var o in e)p(t,o,{get:e[o],enumerable:!0})},I=(t,e,o,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of A(e))!k.call(t,r)&&r!==o&&p(t,r,{get:()=>e[r],enumerable:!(m=u(e,r))||m.enumerable});return t};var D=t=>I(p({},"__esModule",{value:!0}),t);var S={};y(S,{setupGetDeviceStatusMock:()=>h,setupGoToDashboardMock:()=>v,setupListAppsMock:()=>M,setupListInstalledAppsMock:()=>L});module.exports=D(S);var n=require("purify-ts"),i=require("xstate"),a=require("../../device-action/model/UserInteractionRequired"),c=require("../../device-action/os/Errors"),s=require("../../device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),d=require("../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),l=require("../../device-action/os/ListApps/ListAppsDeviceAction"),f=require("../../secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction");const M=(t,e=!1)=>{l.ListAppsDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,i.createMachine)({id:"MockListAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,i.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.AllowListApps})})},done:{type:"final"}},output:()=>e?(0,n.Left)(new c.UnknownDAError("ListApps failed")):(0,n.Right)(t)}))}))},v=(t=!1)=>{d.GoToDashboardDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,i.createMachine)({id:"MockGoToDashboardDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,i.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.None})})},done:{type:"final"}},output:()=>t?(0,n.Left)(new c.UnknownDAError("GoToDashboard failed")):(0,n.Right)(void 0)}))}))},h=(t=[{currentApp:"BOLOS",currentAppVersion:"1.0.0"}])=>{const e=vi.fn();for(const o of t)e.mockImplementationOnce(()=>"currentApp"in o?(0,n.Right)(o):(0,n.Left)(o));s.GetDeviceStatusDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,i.createMachine)({id:"MockGetDeviceStatusDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,i.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.None})})},done:{type:"final"}},output:e}))}))},L=(t=[])=>{f.ListInstalledAppsDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,i.createMachine)({id:"MockListInstalledAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,i.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.None})})},done:{type:"final"}},output:t.reduce((e,o)=>e.mockImplementationOnce(()=>"installedApps"in o?(0,n.Right)(o):(0,n.Left)(o)),vi.fn()).mockImplementation(()=>(0,n.Right)([]))}))}))};0&&(module.exports={setupGetDeviceStatusMock,setupGoToDashboardMock,setupListAppsMock,setupListInstalledAppsMock});
2
2
  //# sourceMappingURL=setupTestMachine.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/__test-utils__/setupTestMachine.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nimport { type DmkError } from \"@api/Error\";\n\nimport { type BTC_APP } from \"./data\";\n\ntype App = typeof BTC_APP;\n\nexport const setupListAppsMock = (apps: App[], error = false) => {\n (ListAppsDeviceAction as jest.Mock).mockImplementation(() => ({\n makeStateMachine: jest.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"ListApps failed\"))\n : Right(apps);\n },\n }),\n ),\n }));\n};\n\nexport const setupGoToDashboardMock = (error: boolean = false) => {\n (GoToDashboardDeviceAction as jest.Mock).mockImplementation(() => ({\n makeStateMachine: jest.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGoToDashboardDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"GoToDashboard failed\"))\n : Right(undefined);\n },\n }),\n ),\n }));\n};\n\nexport const setupGetDeviceStatusMock = (\n outputs: ReadonlyArray<\n { currentApp: string; currentAppVersion: string } | DmkError\n > = [\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n ],\n) => {\n const outputFn = jest.fn();\n\n for (const output of outputs) {\n outputFn.mockImplementationOnce(() =>\n \"currentApp\" in output ? Right(output) : Left(output),\n );\n }\n (GetDeviceStatusDeviceAction as jest.Mock).mockImplementation(() => ({\n makeStateMachine: jest.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGetDeviceStatusDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputFn,\n }),\n ),\n }));\n};\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,EAAA,2BAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAA4B,qBAC5BC,EAAsC,kBAEtCC,EAAwC,4DACxCC,EAA+B,wCAC/BC,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAqC,+DAO9B,MAAMR,EAAoB,CAACS,EAAaC,EAAQ,KAAU,CAC9D,uBAAmC,mBAAmB,KAAO,CAC5D,iBAAkB,KAAK,GAAG,EAAE,mBAAmB,OAC7C,iBAAc,CACZ,GAAI,2BACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,aACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IACCA,KACH,QAAK,IAAI,iBAAe,iBAAiB,CAAC,KAC1C,SAAMD,CAAI,CAElB,CAAC,CACH,CACF,EAAE,CACJ,EAEaV,EAAyB,CAACW,EAAiB,KAAU,CAC/D,4BAAwC,mBAAmB,KAAO,CACjE,iBAAkB,KAAK,GAAG,EAAE,mBAAmB,OAC7C,iBAAc,CACZ,GAAI,gCACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IACCA,KACH,QAAK,IAAI,iBAAe,sBAAsB,CAAC,KAC/C,SAAM,MAAS,CAEvB,CAAC,CACH,CACF,EAAE,CACJ,EAEaZ,EAA2B,CACtCa,EAEI,CACF,CACE,WAAY,QACZ,kBAAmB,OACrB,CACF,IACG,CACH,MAAMC,EAAW,KAAK,GAAG,EAEzB,UAAWC,KAAUF,EACnBC,EAAS,uBAAuB,IAC9B,eAAgBC,KAAS,SAAMA,CAAM,KAAI,QAAKA,CAAM,CACtD,EAED,8BAA0C,mBAAmB,KAAO,CACnE,iBAAkB,KAAK,GAAG,EAAE,mBAAmB,OAC7C,iBAAc,CACZ,GAAI,kCACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQD,CACV,CAAC,CACH,CACF,EAAE,CACJ",
6
- "names": ["setupTestMachine_exports", "__export", "setupGetDeviceStatusMock", "setupGoToDashboardMock", "setupListAppsMock", "__toCommonJS", "import_purify_ts", "import_xstate", "import_UserInteractionRequired", "import_Errors", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_ListAppsDeviceAction", "apps", "error", "outputs", "outputFn", "output"]
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { type Mock } from \"vitest\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nimport { type DmkError } from \"@api/Error\";\nimport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nimport { type InstalledApp } from \"@api/secure-channel/device-action/ListInstalledApps/types\";\n\nimport { type BTC_APP } from \"./data\";\n\ntype App = typeof BTC_APP;\n\nexport const setupListAppsMock = (apps: App[], error = false) => {\n (ListAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"ListApps failed\"))\n : Right(apps);\n },\n }),\n ),\n }));\n};\n\nexport const setupGoToDashboardMock = (error: boolean = false) => {\n (GoToDashboardDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGoToDashboardDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"GoToDashboard failed\"))\n : Right(undefined);\n },\n }),\n ),\n }));\n};\n\nexport const setupGetDeviceStatusMock = (\n outputs: ReadonlyArray<\n { currentApp: string; currentAppVersion: string } | DmkError\n > = [\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n ],\n) => {\n const outputFn = vi.fn();\n\n for (const output of outputs) {\n outputFn.mockImplementationOnce(() =>\n \"currentApp\" in output ? Right(output) : Left(output),\n );\n }\n (GetDeviceStatusDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGetDeviceStatusDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputFn,\n }),\n ),\n }));\n};\n\nexport const setupListInstalledAppsMock = (\n outputs: Array<{ installedApps: InstalledApp[] } | DmkError> = [],\n) => {\n (ListInstalledAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListInstalledAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputs\n .reduce(\n (mockFn, output) =>\n mockFn.mockImplementationOnce(() =>\n \"installedApps\" in output ? Right(output) : Left(output),\n ),\n vi.fn(),\n )\n .mockImplementation(() => Right([])),\n }),\n ),\n }));\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,EAAA,2BAAAC,EAAA,sBAAAC,EAAA,+BAAAC,IAAA,eAAAC,EAAAN,GAAA,IAAAO,EAA4B,qBAE5BC,EAAsC,kBAEtCC,EAAwC,4DACxCC,EAA+B,wCAC/BC,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAqC,+DAErCC,EAA8C,6FAOvC,MAAMV,EAAoB,CAACW,EAAaC,EAAQ,KAAU,CAC9D,uBAA8B,mBAAmB,KAAO,CACvD,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,OAC3C,iBAAc,CACZ,GAAI,2BACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,aACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IACCA,KACH,QAAK,IAAI,iBAAe,iBAAiB,CAAC,KAC1C,SAAMD,CAAI,CAElB,CAAC,CACH,CACF,EAAE,CACJ,EAEaZ,EAAyB,CAACa,EAAiB,KAAU,CAC/D,4BAAmC,mBAAmB,KAAO,CAC5D,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,OAC3C,iBAAc,CACZ,GAAI,gCACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IACCA,KACH,QAAK,IAAI,iBAAe,sBAAsB,CAAC,KAC/C,SAAM,MAAS,CAEvB,CAAC,CACH,CACF,EAAE,CACJ,EAEad,EAA2B,CACtCe,EAEI,CACF,CACE,WAAY,QACZ,kBAAmB,OACrB,CACF,IACG,CACH,MAAMC,EAAW,GAAG,GAAG,EAEvB,UAAWC,KAAUF,EACnBC,EAAS,uBAAuB,IAC9B,eAAgBC,KAAS,SAAMA,CAAM,KAAI,QAAKA,CAAM,CACtD,EAED,8BAAqC,mBAAmB,KAAO,CAC9D,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,OAC3C,iBAAc,CACZ,GAAI,kCACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQD,CACV,CAAC,CACH,CACF,EAAE,CACJ,EAEab,EAA6B,CACxCY,EAA+D,CAAC,IAC7D,CACF,gCAAuC,mBAAmB,KAAO,CAChE,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,OAC3C,iBAAc,CACZ,GAAI,oCACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQA,EACL,OACC,CAACG,EAAQD,IACPC,EAAO,uBAAuB,IAC5B,kBAAmBD,KAAS,SAAMA,CAAM,KAAI,QAAKA,CAAM,CACzD,EACF,GAAG,GAAG,CACR,EACC,mBAAmB,OAAM,SAAM,CAAC,CAAC,CAAC,CACvC,CAAC,CACH,CACF,EAAE,CACJ",
6
+ "names": ["setupTestMachine_exports", "__export", "setupGetDeviceStatusMock", "setupGoToDashboardMock", "setupListAppsMock", "setupListInstalledAppsMock", "__toCommonJS", "import_purify_ts", "import_xstate", "import_UserInteractionRequired", "import_Errors", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_ListAppsDeviceAction", "import_ListInstalledAppsDeviceAction", "apps", "error", "outputs", "outputFn", "output", "mockFn"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var s=(t,e)=>{for(var i in e)o(t,i,{get:e[i],enumerable:!0})},A=(t,e,i,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!l.call(t,r)&&r!==i&&o(t,r,{get:()=>e[r],enumerable:!(c=p(e,r))||c.enumerable});return t};var D=t=>A(o({},"__esModule",{value:!0}),t);var I={};s(I,{testDeviceActionStates:()=>v});module.exports=D(I);function v(t,e,i,c){const r=[],{observable:a,cancel:u}=t._execute(i);return a.subscribe({next:n=>{r.push(n)},error:n=>{c(n)},complete:()=>{try{expect(r).toEqual(e),c()}catch(n){c(n)}}}),{observable:a,cancel:u}}0&&(module.exports={testDeviceActionStates});
1
+ "use strict";var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},A=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of s(e))!l.call(t,r)&&r!==o&&c(t,r,{get:()=>e[r],enumerable:!(n=m(e,r))||n.enumerable});return t};var d=t=>A(c({},"__esModule",{value:!0}),t);var I={};v(I,{testDeviceActionStates:()=>D});module.exports=d(I);function D(t,e,o,{onDone:n,onError:r}){const a=[],{observable:u,cancel:p}=t._execute(o);return u.subscribe({next:i=>{a.push(i)},error:i=>{r(i)},complete:()=>{try{expect(a).toEqual(e),n()}catch(i){r(i)}}}),{observable:u,cancel:p}}0&&(module.exports={testDeviceActionStates});
2
2
  //# sourceMappingURL=testDeviceActionStates.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/__test-utils__/testDeviceActionStates.ts"],
4
- "sourcesContent": ["import {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport { type DeviceActionState } from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\n/**\n * Test that the states emitted by a device action match the expected states.\n * @param deviceAction The device action to test.\n * @param expectedStates The expected states.\n * @param internalApi\n * @param done The Jest done callback.\n */\nexport function testDeviceActionStates<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n>(\n deviceAction: DeviceAction<Output, Input, Error, IntermediateValue>,\n expectedStates: Array<DeviceActionState<Output, Error, IntermediateValue>>,\n internalApi: InternalApi,\n done: jest.DoneCallback,\n) {\n const observedStates: Array<\n DeviceActionState<Output, Error, IntermediateValue>\n > = [];\n\n const { observable, cancel } = deviceAction._execute(internalApi);\n observable.subscribe({\n next: (state) => {\n observedStates.push(state);\n },\n error: (error) => {\n done(error);\n },\n complete: () => {\n try {\n expect(observedStates).toEqual(expectedStates);\n done();\n } catch (e) {\n done(e);\n }\n },\n });\n return { observable, cancel };\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAeO,SAASE,EAMdE,EACAC,EACAC,EACAC,EACA,CACA,MAAMC,EAEF,CAAC,EAEC,CAAE,WAAAC,EAAY,OAAAC,CAAO,EAAIN,EAAa,SAASE,CAAW,EAChE,OAAAG,EAAW,UAAU,CACnB,KAAOE,GAAU,CACfH,EAAe,KAAKG,CAAK,CAC3B,EACA,MAAQC,GAAU,CAChBL,EAAKK,CAAK,CACZ,EACA,SAAU,IAAM,CACd,GAAI,CACF,OAAOJ,CAAc,EAAE,QAAQH,CAAc,EAC7CE,EAAK,CACP,OAASM,EAAG,CACVN,EAAKM,CAAC,CACR,CACF,CACF,CAAC,EACM,CAAE,WAAAJ,EAAY,OAAAC,CAAO,CAC9B",
6
- "names": ["testDeviceActionStates_exports", "__export", "testDeviceActionStates", "__toCommonJS", "deviceAction", "expectedStates", "internalApi", "done", "observedStates", "observable", "cancel", "state", "error", "e"]
4
+ "sourcesContent": ["import {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport { type DeviceActionState } from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\n/**\n * Test that the states emitted by a device action match the expected states.\n * @param deviceAction The device action to test.\n * @param expectedStates The expected states.\n * @param internalApi\n * @param callbacks { onDone, onError } The callbacks to call when the test is done or an error occurs.\n */\nexport function testDeviceActionStates<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n>(\n deviceAction: DeviceAction<Output, Input, Error, IntermediateValue>,\n expectedStates: Array<DeviceActionState<Output, Error, IntermediateValue>>,\n internalApi: InternalApi,\n {\n onDone,\n onError,\n }: {\n onDone: () => void;\n onError: (error: Error) => void;\n },\n) {\n const observedStates: Array<\n DeviceActionState<Output, Error, IntermediateValue>\n > = [];\n\n const { observable, cancel } = deviceAction._execute(internalApi);\n\n observable.subscribe({\n next: (state) => {\n observedStates.push(state);\n },\n error: (error) => {\n onError(error);\n },\n complete: () => {\n try {\n expect(observedStates).toEqual(expectedStates);\n onDone();\n } catch (e) {\n onError(e as Error);\n }\n },\n });\n\n return { observable, cancel };\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAeO,SAASE,EAMdE,EACAC,EACAC,EACA,CACE,OAAAC,EACA,QAAAC,CACF,EAIA,CACA,MAAMC,EAEF,CAAC,EAEC,CAAE,WAAAC,EAAY,OAAAC,CAAO,EAAIP,EAAa,SAASE,CAAW,EAEhE,OAAAI,EAAW,UAAU,CACnB,KAAOE,GAAU,CACfH,EAAe,KAAKG,CAAK,CAC3B,EACA,MAAQC,GAAU,CAChBL,EAAQK,CAAK,CACf,EACA,SAAU,IAAM,CACd,GAAI,CACF,OAAOJ,CAAc,EAAE,QAAQJ,CAAc,EAC7CE,EAAO,CACT,OAASO,EAAG,CACVN,EAAQM,CAAU,CACpB,CACF,CACF,CAAC,EAEM,CAAE,WAAAJ,EAAY,OAAAC,CAAO,CAC9B",
6
+ "names": ["testDeviceActionStates_exports", "__export", "testDeviceActionStates", "__toCommonJS", "deviceAction", "expectedStates", "internalApi", "onDone", "onError", "observedStates", "observable", "cancel", "state", "error", "e"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var y=(o,p)=>{for(var n in p)a(o,n,{get:p[n],enumerable:!0})},S=(o,p,n,g)=>{if(p&&typeof p=="object"||typeof p=="function")for(let s of m(p))!w.call(o,s)&&s!==n&&a(o,s,{get:()=>p[s],enumerable:!(g=f(p,s))||g.enumerable});return o};var c=o=>S(a({},"__esModule",{value:!0}),o);var v={};y(v,{UserInteractionRequired:()=>A});module.exports=c(v);var A=(l=>(l.None="none",l.UnlockDevice="unlock-device",l.AllowSecureConnection="allow-secure-connection",l.ConfirmOpenApp="confirm-open-app",l.SignTransaction="sign-transaction",l.SignTypedData="sign-typed-data",l.AllowListApps="allow-list-apps",l.VerifyAddress="verify-address",l.SignPersonalMessage="sign-personal-message",l))(A||{});0&&(module.exports={UserInteractionRequired});
1
+ "use strict";var g=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var k=(s,l)=>{for(var n in l)g(s,n,{get:l[n],enumerable:!0})},m=(s,l,n,a)=>{if(l&&typeof l=="object"||typeof l=="function")for(let o of A(l))!f.call(s,o)&&o!==n&&g(s,o,{get:()=>l[o],enumerable:!(a=w(l,o))||a.enumerable});return s};var y=s=>m(g({},"__esModule",{value:!0}),s);var S={};k(S,{UserInteractionRequired:()=>c});module.exports=y(S);var c=(p=>(p.None="none",p.UnlockDevice="unlock-device",p.AllowSecureConnection="allow-secure-connection",p.ConfirmOpenApp="confirm-open-app",p.SignTransaction="sign-transaction",p.SignTypedData="sign-typed-data",p.AllowListApps="allow-list-apps",p.VerifyAddress="verify-address",p.SignPersonalMessage="sign-personal-message",p.Web3ChecksOptIn="web3-checks-opt-in",p))(c||{});0&&(module.exports={UserInteractionRequired});
2
2
  //# sourceMappingURL=UserInteractionRequired.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/model/UserInteractionRequired.ts"],
4
- "sourcesContent": ["/**\n * The user interaction required on the device to move further in a device action.\n * This is used to inform the user about the action they need to take on the device.\n */\nexport enum UserInteractionRequired {\n None = \"none\",\n UnlockDevice = \"unlock-device\",\n AllowSecureConnection = \"allow-secure-connection\",\n ConfirmOpenApp = \"confirm-open-app\",\n SignTransaction = \"sign-transaction\",\n SignTypedData = \"sign-typed-data\",\n AllowListApps = \"allow-list-apps\",\n VerifyAddress = \"verify-address\",\n SignPersonalMessage = \"sign-personal-message\",\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAIO,IAAKE,OACVA,EAAA,KAAO,OACPA,EAAA,aAAe,gBACfA,EAAA,sBAAwB,0BACxBA,EAAA,eAAiB,mBACjBA,EAAA,gBAAkB,mBAClBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,iBAChBA,EAAA,oBAAsB,wBATZA,OAAA",
4
+ "sourcesContent": ["/**\n * The user interaction required on the device to move further in a device action.\n * This is used to inform the users about the action they need to take on the device.\n */\nexport enum UserInteractionRequired {\n None = \"none\",\n UnlockDevice = \"unlock-device\",\n AllowSecureConnection = \"allow-secure-connection\",\n ConfirmOpenApp = \"confirm-open-app\",\n SignTransaction = \"sign-transaction\",\n SignTypedData = \"sign-typed-data\",\n AllowListApps = \"allow-list-apps\",\n VerifyAddress = \"verify-address\",\n SignPersonalMessage = \"sign-personal-message\",\n Web3ChecksOptIn = \"web3-checks-opt-in\",\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAIO,IAAKE,OACVA,EAAA,KAAO,OACPA,EAAA,aAAe,gBACfA,EAAA,sBAAwB,0BACxBA,EAAA,eAAiB,mBACjBA,EAAA,gBAAkB,mBAClBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,iBAChBA,EAAA,oBAAsB,wBACtBA,EAAA,gBAAkB,qBAVRA,OAAA",
6
6
  "names": ["UserInteractionRequired_exports", "__export", "UserInteractionRequired", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var I=(r,t)=>{for(var s in t)o(r,s,{get:t[s],enumerable:!0})},C=(r,t,s,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!m.call(r,n)&&n!==s&&o(r,n,{get:()=>t[n],enumerable:!(e=A(t,n))||e.enumerable});return r};var d=r=>C(o({},"__esModule",{value:!0}),r);var S={};I(S,{CallTaskInAppDeviceAction:()=>D});module.exports=d(S);var p=require("purify-ts"),a=require("xstate"),l=require("../../../command/model/CommandResult"),i=require("../../../device-action/model/UserInteractionRequired"),c=require("../../../device-action/os/Errors"),u=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),k=require("../../../device-action/xstate-utils/XStateDeviceAction");class D extends k.XStateDeviceAction{makeStateMachine(t){const{callTask:s}=this.extractDependencies(t);return(0,a.setup)({types:{input:{},context:{},output:{}},actors:{callTask:(0,a.fromPromise)(s),openAppStateMachine:new u.OpenAppDeviceAction({input:{appName:this.input.appName,compatibleAppNames:this.input.compatibleAppNames}}).makeStateMachine(t)},guards:{noInternalError:({context:e})=>e._internalState.error===null},actions:{assignErrorFromEvent:(0,a.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"CallTaskInAppDeviceAction",initial:"OpenAppDeviceAction",context:({input:e})=>({input:e,intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None},_internalState:{taskResponse:null,error:null}}),states:{OpenAppDeviceAction:{invoke:{id:"openAppStateMachine",input:{appName:this.input.appName,compatibleAppNames:this.input.compatibleAppNames},src:"openAppStateMachine",onSnapshot:{actions:(0,a.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{actions:(0,a.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:n=>({...e.context._internalState,error:n})})}),target:"CheckOpenAppDeviceActionResult"}}},CheckOpenAppDeviceActionResult:{always:[{target:"CallTask",guard:"noInternalError"},"Error"]},CallTask:{entry:(0,a.assign)({intermediateValue:{requiredUserInteraction:this.input.requiredUserInteraction}}),exit:(0,a.assign)({intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None}}),invoke:{id:"callTask",src:"callTask",input:e=>e.context.input.task,onDone:{target:"CallTaskResultCheck",actions:[(0,a.assign)({_internalState:({event:e,context:n})=>(0,l.isSuccessCommandResult)(e.output)?{...n._internalState,taskResponse:e.output.data}:{...n._internalState,error:e.output.error}})]},onError:{target:"Error",actions:"assignErrorFromEvent"}}},CallTaskResultCheck:{always:[{target:"Success",guard:"noInternalError"},"Error"]},Success:{type:"final"},Error:{type:"final"}},output:({context:e})=>e._internalState.taskResponse?(0,p.Right)(e._internalState.taskResponse):(0,p.Left)(e._internalState.error||new c.UnknownDAError("No error in final state"))})}extractDependencies(t){return{callTask:s=>s.input(t)}}}0&&(module.exports={CallTaskInAppDeviceAction});
2
+ //# sourceMappingURL=CallTaskInAppDeviceAction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.ts"],
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport {\n type CommandResult,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\n\nimport {\n type CallTaskInAppDAError,\n type CallTaskInAppDAInput,\n type CallTaskInAppDAIntermediateValue,\n type CallTaskInAppDAInternalState,\n type CallTaskInAppDAOutput,\n} from \"./CallTaskInAppDeviceActionTypes\";\n\n/**\n * Tries to open an app on the device, and if it is successful, calls a task\n * in the app.\n * The output will be the result of the task.\n *\n * ```ts\n * input: {\n * appName: string;\n * task: (internalApi: InternalApi) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n * requiredUserInteraction: UserInteraction;\n * }\n * ```\n *\n * Example of usage:\n *\n * ```ts\n * const deviceAction = new CallTaskInAppDeviceAction({\n * input: {\n * appName: \"MyApp\",\n * task: async (internalApi: InternalApi) => internalApi.sendCommand(new MyAppSpecificCommand()),\n * requiredUserInteraction: UserInteractionRequired.None,\n * },\n * });\n * dmk.executeDeviceAction({ sessionId: \"mySessionId\", deviceAction });\n * ```\n */\nexport class CallTaskInAppDeviceAction<\n TaskResponse,\n TaskErrorCodes,\n UserInteraction extends UserInteractionRequired,\n> extends XStateDeviceAction<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n> {\n makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n > {\n type types = StateMachineTypes<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n >;\n\n const { callTask } = this.extractDependencies(internalAPI);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n callTask: fromPromise(callTask),\n openAppStateMachine: new OpenAppDeviceAction({\n input: {\n appName: this.input.appName,\n compatibleAppNames: this.input.compatibleAppNames,\n },\n }).makeStateMachine(internalAPI),\n },\n guards: {\n noInternalError: ({ context }) => context._internalState.error === null,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n },\n }).createMachine({\n id: \"CallTaskInAppDeviceAction\",\n initial: \"OpenAppDeviceAction\",\n context: ({ input }) => {\n return {\n input: input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n taskResponse: null,\n error: null,\n },\n };\n },\n states: {\n OpenAppDeviceAction: {\n invoke: {\n id: \"openAppStateMachine\",\n input: {\n appName: this.input.appName,\n compatibleAppNames: this.input.compatibleAppNames,\n },\n src: \"openAppStateMachine\",\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n >({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n target: \"CheckOpenAppDeviceActionResult\",\n },\n },\n },\n CheckOpenAppDeviceActionResult: {\n always: [\n {\n target: \"CallTask\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n CallTask: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: this.input.requiredUserInteraction,\n },\n }),\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n }),\n invoke: {\n id: \"callTask\",\n src: \"callTask\",\n input: (_: { context: types[\"context\"] }) => _.context.input.task,\n onDone: {\n target: \"CallTaskResultCheck\",\n actions: [\n assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n taskResponse: event.output.data,\n };\n }\n return {\n ...context._internalState,\n error: event.output.error,\n };\n },\n }),\n ],\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n CallTaskResultCheck: {\n always: [\n {\n target: \"Success\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: ({ context }) =>\n context._internalState.taskResponse\n ? Right(context._internalState.taskResponse)\n : Left(\n context._internalState.error ||\n new UnknownDAError(\"No error in final state\"),\n ),\n });\n }\n\n extractDependencies(internalApi: InternalApi) {\n return {\n callTask: (_: {\n input: (\n internalApi: InternalApi,\n ) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n }): Promise<CommandResult<TaskResponse, TaskErrorCodes>> =>\n _.input(internalApi),\n };\n }\n}\n"],
5
+ "mappings": "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",
6
+ "names": ["CallTaskInAppDeviceAction_exports", "__export", "CallTaskInAppDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandResult", "import_UserInteractionRequired", "import_Errors", "import_OpenAppDeviceAction", "import_XStateDeviceAction", "internalAPI", "callTask", "context", "_", "input", "error", "event", "internalApi"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var k=require("purify-ts"),y=require("xstate"),w=require("../../../apdu/utils/ApduBuilder"),u=require("../../../command/model/CommandResult"),s=require("../../../device-action/__test-utils__/makeInternalApi"),A=require("../../../device-action/__test-utils__/testDeviceActionStates"),n=require("../../../device-action/model/DeviceActionState"),e=require("../../../device-action/model/UserInteractionRequired"),C=require("../../../device-action/os/Errors"),M=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),v=require("../../../../../src"),d=require("./CallTaskInAppDeviceAction");vi.mock("@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction",async t=>{const o=await t();return{...o,OpenAppDeviceAction:vi.fn(()=>({...o.OpenAppDeviceAction,makeStateMachine:vi.fn()}))}});const l=t=>{M.OpenAppDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,y.createMachine)({initial:"pending",states:{pending:{entry:(0,y.assign)({intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}}),after:{0:"done"}},done:{type:"final"}},output:()=>t?(0,k.Left)(t):(0,k.Right)(void 0)}))}))};describe("CallTaskInAppDeviceAction",()=>{const t=vi.fn(),o=()=>({callTask:t}),{sendCommand:D}=(0,s.makeDeviceActionInternalApiMock)(),p={paramString:"aParameter",paramNumber:1234},I={aNumber:5678,aString:"mockedResponseString"};beforeEach(()=>{vi.resetAllMocks()}),describe("without mocking extractDependencies",()=>{it("should call sendCommand on internalApi with the correct parameters",async()=>{l(),D.mockResolvedValue((0,u.CommandResultFactory)({data:void 0}));const i=new d.CallTaskInAppDeviceAction({input:{task:async r=>await r.sendCommand(new c(p)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}});await new Promise((r,a)=>{i._execute((0,s.makeDeviceActionInternalApiMock)()).observable.subscribe({error:()=>a(),complete:()=>r(),next:()=>{}})}),expect(D).toHaveBeenCalledWith(new c(p))})}),describe("error cases",()=>{it("should error and output the error if the open app fails",()=>new Promise((i,r)=>{l(new C.UnknownDAError("Mocked error"));const a=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:n.DeviceActionStatus.Error,error:new C.UnknownDAError("Mocked error")}];(0,A.testDeviceActionStates)(new d.CallTaskInAppDeviceAction({input:{task:async m=>await m.sendCommand(new c(p)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}}),a,(0,s.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})})),it("should error and output an error if the call task fails",()=>new Promise((i,r)=>{l(),t.mockResolvedValue((0,u.CommandResultFactory)({error:new v.UnknownDeviceExchangeError("Mocked error")}));const a=new d.CallTaskInAppDeviceAction({input:{task:async f=>await f.sendCommand(new c(p)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}});vi.spyOn(a,"extractDependencies").mockImplementation(o);const m=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}},{status:n.DeviceActionStatus.Error,error:new v.UnknownDeviceExchangeError("Mocked error")}];(0,A.testDeviceActionStates)(a,m,(0,s.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})}))}),describe("success cases",()=>{it("should succeed and output the command result if the send command succeeds",()=>new Promise((i,r)=>{l(),t.mockResolvedValue((0,u.CommandResultFactory)({data:I}));const a=new d.CallTaskInAppDeviceAction({input:{task:async f=>await f.sendCommand(new c(p)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}});vi.spyOn(a,"extractDependencies").mockImplementation(o);const m=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}},{status:n.DeviceActionStatus.Completed,output:I}];(0,A.testDeviceActionStates)(a,m,(0,s.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})}))})});class c{params;constructor(o){this.params=o}getApdu(){return new w.ApduBuilder({cla:0,ins:1,p1:2,p2:3}).add32BitUIntToData(this.params.paramNumber).addAsciiStringToData(this.params.paramString).build()}parseResponse(){return(0,u.CommandResultFactory)({data:{aNumber:1,aString:"aString"}})}}
2
+ //# sourceMappingURL=CallTaskInAppDeviceAction.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.ts"],
4
+ "sourcesContent": ["/* eslint @typescript-eslint/consistent-type-imports:0 */\nimport { Left, Right } from \"purify-ts\";\nimport { type Mock } from \"vitest\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { type Apdu } from \"@api/apdu/model/Apdu\";\nimport { ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { type Command } from \"@api/types\";\nimport { UnknownDeviceExchangeError } from \"@root/src\";\n\nimport { CallTaskInAppDeviceAction } from \"./CallTaskInAppDeviceAction\";\nimport {\n type CallTaskInAppDAError,\n type CallTaskInAppDAIntermediateValue,\n type CallTaskInAppDAOutput,\n} from \"./CallTaskInAppDeviceActionTypes\";\n\nvi.mock(\n \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\",\n async (importOriginal) => {\n const original =\n await importOriginal<\n typeof import(\"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\")\n >();\n return {\n ...original,\n OpenAppDeviceAction: vi.fn(() => ({\n ...original.OpenAppDeviceAction,\n makeStateMachine: vi.fn(),\n })),\n };\n },\n);\n\nconst setupOpenAppDAMock = (error?: unknown) => {\n (OpenAppDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n initial: \"pending\",\n states: {\n pending: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n }),\n after: {\n 0: \"done\",\n },\n },\n done: {\n type: \"final\",\n },\n },\n output: () => (error ? Left(error) : Right(undefined)),\n }),\n ),\n }));\n};\n\ndescribe(\"CallTaskInAppDeviceAction\", () => {\n const callMyTask = vi.fn();\n\n const extractDependenciesMock = () => ({\n callTask: callMyTask,\n });\n\n const { sendCommand: apiSendCommandMock } = makeDeviceActionInternalApiMock();\n\n const commandParams = {\n paramString: \"aParameter\",\n paramNumber: 1234,\n };\n const mockedCommandResponse = {\n aNumber: 5678,\n aString: \"mockedResponseString\",\n };\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"without mocking extractDependencies\", () => {\n it(\"should call sendCommand on internalApi with the correct parameters\", async () => {\n setupOpenAppDAMock();\n apiSendCommandMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n\n const deviceAction = new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n await internalApi.sendCommand(new TestCommand(commandParams)),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n });\n await new Promise<void>((resolve, reject) => {\n deviceAction\n ._execute(makeDeviceActionInternalApiMock())\n .observable.subscribe({\n error: () => reject(),\n complete: () => resolve(),\n next: () => {},\n });\n });\n\n expect(apiSendCommandMock).toHaveBeenCalledWith(\n new TestCommand(commandParams),\n );\n });\n });\n\n describe(\"error cases\", () => {\n it(\"should error and output the error if the open app fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock(new UnknownDAError(\"Mocked error\"));\n\n const expectedStates: MyCommandCallTaskDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n await internalApi.sendCommand(new TestCommand(commandParams)),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n }),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should error and output an error if the call task fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n callMyTask.mockResolvedValue(\n CommandResultFactory({\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n }),\n );\n\n const deviceAction = new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n await internalApi.sendCommand(new TestCommand(commandParams)),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandCallTaskDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n\n describe(\"success cases\", () => {\n it(\"should succeed and output the command result if the send command succeeds\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n callMyTask.mockResolvedValue(\n CommandResultFactory({ data: mockedCommandResponse }),\n );\n\n const deviceAction = new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n await internalApi.sendCommand(new TestCommand(commandParams)),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandCallTaskDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: mockedCommandResponse,\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n});\n\ntype MyCommandResponse = {\n aNumber: number;\n aString: string;\n};\n\ntype MyCommandParams = {\n paramString: string;\n paramNumber: number;\n};\n\nclass TestCommand implements Command<MyCommandResponse, MyCommandParams> {\n params: MyCommandParams;\n constructor(params: MyCommandParams) {\n this.params = params;\n }\n getApdu(): Apdu {\n return new ApduBuilder({ cla: 0x00, ins: 0x01, p1: 0x02, p2: 0x03 })\n .add32BitUIntToData(this.params.paramNumber)\n .addAsciiStringToData(this.params.paramString)\n .build();\n }\n parseResponse() {\n return CommandResultFactory({ data: { aNumber: 1, aString: \"aString\" } });\n }\n}\n\ntype MyCommandCallTaskDAState = DeviceActionState<\n CallTaskInAppDAOutput<MyCommandResponse>,\n CallTaskInAppDAError<UnknownDAError>,\n CallTaskInAppDAIntermediateValue<\n UserInteractionRequired.None | UserInteractionRequired.VerifyAddress\n >\n>;\n"],
5
+ "mappings": "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",
6
+ "names": ["import_purify_ts", "import_xstate", "import_ApduBuilder", "import_CommandResult", "import_makeInternalApi", "import_testDeviceActionStates", "import_DeviceActionState", "import_UserInteractionRequired", "import_Errors", "import_OpenAppDeviceAction", "import_src", "import_CallTaskInAppDeviceAction", "importOriginal", "original", "setupOpenAppDAMock", "error", "callMyTask", "extractDependenciesMock", "apiSendCommandMock", "commandParams", "mockedCommandResponse", "deviceAction", "internalApi", "TestCommand", "resolve", "reject", "expectedStates", "params"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var t=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var A=(r,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of t(e))!l.call(r,p)&&p!==n&&o(r,p,{get:()=>e[p],enumerable:!(a=s(e,p))||a.enumerable});return r};var d=r=>A(o({},"__esModule",{value:!0}),r);var i={};module.exports=d(i);
2
+ //# sourceMappingURL=CallTaskInAppDeviceActionTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.ts"],
4
+ "sourcesContent": ["import {\n type CommandErrorResult,\n type CommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport {\n type OpenAppDAError,\n type OpenAppDAIntermediateValue,\n} from \"@api/device-action/os/OpenAppDeviceAction/types\";\n\nexport type CallTaskInAppDAOutput<TaskResponse> = TaskResponse;\n\nexport type CallTaskInAppDAInput<\n TaskResponse,\n TaskErrorCodes,\n UserInteraction,\n> = {\n readonly task: (\n internalApi: InternalApi,\n ) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n readonly appName: string;\n readonly requiredUserInteraction: UserInteraction;\n readonly compatibleAppNames?: string[];\n};\n\nexport type CallTaskInAppDAError<TaskErrorCodes = void> =\n | OpenAppDAError\n | CommandErrorResult<TaskErrorCodes>[\"error\"];\n\nexport type CallTaskInAppDAIntermediateValue<UserInteraction> =\n | { readonly requiredUserInteraction: UserInteraction }\n | OpenAppDAIntermediateValue;\n\nexport type CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes> = {\n readonly taskResponse: TaskResponse | null;\n readonly error: CallTaskInAppDAError<TaskErrorCodes> | null;\n};\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["CallTaskInAppDeviceActionTypes_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var m=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var O=(i,t)=>{for(var a in t)m(i,a,{get:t[a],enumerable:!0})},I=(i,t,a,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of G(t))!x.call(i,r)&&r!==a&&m(i,r,{get:()=>t[r],enumerable:!(s=V(t,r))||s.enumerable});return i};var C=i=>I(m({},"__esModule",{value:!0}),i);var T={};O(T,{GetDeviceStatusDeviceAction:()=>M});module.exports=C(T);var D=require("purify-ts"),g=require("rxjs"),S=require("rxjs/operators"),n=require("xstate"),k=require("../../../command/model/CommandResult"),b=require("../../../command/os/GetAppAndVersionCommand"),d=require("../../../device/DeviceStatus"),c=require("../../../device-action/model/UserInteractionRequired"),E=require("../../../device-action/os/Const"),v=require("../../../device-action/os/Errors"),h=require("../../../device-action/xstate-utils/XStateDeviceAction"),y=require("../../../device-session/DeviceSessionState");class M extends h.XStateDeviceAction{makeStateMachine(t){const{getAppAndVersion:a,getDeviceSessionState:s,setDeviceSessionState:r,waitForDeviceUnlock:A,isDeviceOnboarded:u}=this.extractDependencies(t),p=this.input.unlockTimeout??E.DEFAULT_UNLOCK_TIMEOUT_MS;return(0,n.setup)({types:{input:{unlockTimeout:p},context:{},output:{}},actors:{getAppAndVersion:(0,n.fromPromise)(a),waitForDeviceUnlock:(0,n.fromObservable)(A)},guards:{isDeviceOnboarded:()=>u(),isDeviceUnlocked:()=>s().deviceStatus!==d.DeviceStatus.LOCKED,hasError:({context:e})=>e._internalState.error!==null},actions:{assignErrorDeviceNotOnboarded:(0,n.assign)({_internalState:e=>({...e.context._internalState,error:new v.DeviceNotOnboardedError})}),assignErrorDeviceLocked:(0,n.assign)({_internalState:e=>({...e.context._internalState,error:new v.DeviceLockedError}),intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice}}),assignErrorFromEvent:(0,n.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})}),assignNoUserActionNeeded:(0,n.assign)({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:c.UserInteractionRequired.None})}),assignUserActionUnlockNeeded:(0,n.assign)({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:c.UserInteractionRequired.UnlockDevice})})}}).createMachine({id:"GetDeviceStatusDeviceAction",initial:"DeviceReady",context:e=>{const o=s(),{sessionStateType:l}=o;return{input:{unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},_internalState:{onboarded:!1,locked:o.deviceStatus===d.DeviceStatus.LOCKED,currentApp:l===y.DeviceSessionStateType.ReadyWithoutSecureChannel?o.currentApp.name:null,currentAppVersion:null,error:null}}},states:{DeviceReady:{always:{target:"OnboardingCheck"}},OnboardingCheck:{always:[{guard:{type:"isDeviceOnboarded"},target:"LockingCheck",actions:(0,n.assign)({_internalState:e=>({...e.context._internalState,onboarded:!0})})},{target:"Error",actions:"assignErrorDeviceNotOnboarded"}]},LockingCheck:{always:[{target:"AppAndVersionCheck",guard:{type:"isDeviceUnlocked"},actions:(0,n.assign)({_internalState:e=>({...e.context._internalState,locked:!1})})},{target:"UserActionUnlockDevice"}]},UserActionUnlockDevice:{entry:"assignUserActionUnlockNeeded",exit:"assignNoUserActionNeeded",invoke:{id:"UserActionUnlockDevice",src:"waitForDeviceUnlock",input:e=>({unlockTimeout:p}),onDone:{target:"AppAndVersionCheck",actions:(0,n.assign)({_internalState:e=>({...e.context._internalState,locked:!1})})},onError:{target:"Error",actions:"assignErrorDeviceLocked"}}},AppAndVersionCheck:{invoke:{src:"getAppAndVersion",onDone:{target:"ApplicationAvailableResultCheck",actions:(0,n.assign)({_internalState:e=>{if((0,k.isSuccessCommandResult)(e.event.output)){const o=s();return o.sessionStateType!==y.DeviceSessionStateType.Connected&&r({...o,currentApp:e.event.output.data}),{...e.context._internalState,currentApp:e.event.output.data.name,currentAppVersion:e.event.output.data.version}}return{...e.context._internalState,error:e.event.output.error}}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},ApplicationAvailableResultCheck:{always:[{guard:"hasError",target:"Error"},{target:"Success"}]},Success:{type:"final"},Error:{type:"final"}},output:e=>{const{context:o}=e,{error:l,currentApp:U,currentAppVersion:f}=o._internalState;return l?(0,D.Left)(l):(0,D.Right)({currentApp:U,currentAppVersion:f})}})}extractDependencies(t){return{getAppAndVersion:()=>t.sendCommand(new b.GetAppAndVersionCommand),waitForDeviceUnlock:({input:r})=>new g.Observable(A=>{const u=t.getDeviceSessionStateObservable().pipe((0,S.tap)(p=>{p.deviceStatus===d.DeviceStatus.CONNECTED&&(A.complete(),u.unsubscribe())})).subscribe();return()=>{u.unsubscribe()}}).pipe((0,S.timeout)(r.unlockTimeout)),getDeviceSessionState:()=>t.getDeviceSessionState(),setDeviceSessionState:r=>t.setDeviceSessionState(r),isDeviceOnboarded:()=>!0}}}0&&(module.exports={GetDeviceStatusDeviceAction});
1
+ "use strict";var m=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var I=(i,t)=>{for(var a in t)m(i,a,{get:t[a],enumerable:!0})},C=(i,t,a,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of G(t))!x.call(i,r)&&r!==a&&m(i,r,{get:()=>t[r],enumerable:!(s=U(t,r))||s.enumerable});return i};var O=i=>C(m({},"__esModule",{value:!0}),i);var T={};I(T,{GetDeviceStatusDeviceAction:()=>M});module.exports=O(T);var D=require("purify-ts"),g=require("rxjs"),v=require("rxjs/operators"),n=require("xstate"),k=require("../../../command/model/CommandResult"),b=require("../../../command/os/GetAppAndVersionCommand"),y=require("../../../device/DeviceStatus"),c=require("../../../device-action/model/UserInteractionRequired"),f=require("../../../device-action/os/Const"),S=require("../../../device-action/os/Errors"),E=require("../../../device-action/xstate-utils/XStateDeviceAction"),d=require("../../../device-session/DeviceSessionState");class M extends E.XStateDeviceAction{makeStateMachine(t){const{getAppAndVersion:a,getDeviceSessionState:s,setDeviceSessionState:r,waitForDeviceUnlock:A,isDeviceOnboarded:u}=this.extractDependencies(t),p=this.input.unlockTimeout??f.DEFAULT_UNLOCK_TIMEOUT_MS;return(0,n.setup)({types:{input:{unlockTimeout:p},context:{},output:{}},actors:{getAppAndVersion:(0,n.fromPromise)(a),waitForDeviceUnlock:(0,n.fromObservable)(A)},guards:{isDeviceOnboarded:()=>u(),isDeviceLocked:({context:e})=>e._internalState.locked,hasError:({context:e})=>e._internalState.error!==null},actions:{assignErrorDeviceNotOnboarded:(0,n.assign)({_internalState:e=>({...e.context._internalState,error:new S.DeviceNotOnboardedError})}),assignErrorDeviceLocked:(0,n.assign)({_internalState:e=>({...e.context._internalState,error:new S.DeviceLockedError}),intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice}}),assignErrorFromEvent:(0,n.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})}),assignNoUserActionNeeded:(0,n.assign)({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:c.UserInteractionRequired.None})}),assignUserActionUnlockNeeded:(0,n.assign)({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:c.UserInteractionRequired.UnlockDevice})})}}).createMachine({id:"GetDeviceStatusDeviceAction",initial:"DeviceReady",context:e=>{const o=s(),{sessionStateType:l}=o;return{input:{unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},_internalState:{onboarded:!1,locked:!1,currentApp:l===d.DeviceSessionStateType.ReadyWithoutSecureChannel?o.currentApp.name:null,currentAppVersion:null,error:null}}},states:{DeviceReady:{always:{target:"OnboardingCheck"}},OnboardingCheck:{always:[{guard:{type:"isDeviceOnboarded"},target:"AppAndVersionCheck",actions:(0,n.assign)({_internalState:e=>({...e.context._internalState,onboarded:!0})})},{target:"Error",actions:"assignErrorDeviceNotOnboarded"}]},UserActionUnlockDevice:{entry:"assignUserActionUnlockNeeded",exit:"assignNoUserActionNeeded",invoke:{id:"UserActionUnlockDevice",src:"waitForDeviceUnlock",input:e=>({unlockTimeout:p}),onDone:{target:"AppAndVersionCheck",actions:(0,n.assign)({_internalState:e=>({...e.context._internalState,locked:!1})})},onError:{target:"Error",actions:"assignErrorDeviceLocked"}}},AppAndVersionCheck:{invoke:{src:"getAppAndVersion",onDone:{target:"ApplicationAvailableResultCheck",actions:(0,n.assign)({_internalState:e=>{if((0,k.isSuccessCommandResult)(e.event.output)){const o=s();return o.sessionStateType!==d.DeviceSessionStateType.Connected?r({...o,currentApp:e.event.output.data}):r({deviceModelId:o.deviceModelId,sessionStateType:d.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:y.DeviceStatus.CONNECTED,currentApp:e.event.output.data,installedApps:[],isSecureConnectionAllowed:!1}),{...e.context._internalState,locked:!1,currentApp:e.event.output.data.name,currentAppVersion:e.event.output.data.version}}return"errorCode"in e.event.output.error&&e.event.output.error.errorCode==="5515"?{...e.context._internalState,locked:!0}:{...e.context._internalState,error:e.event.output.error}}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},ApplicationAvailableResultCheck:{always:[{guard:"hasError",target:"Error"},{target:"UserActionUnlockDevice",guard:"isDeviceLocked"},{target:"Success"}]},Success:{type:"final"},Error:{type:"final"}},output:e=>{const{context:o}=e,{error:l,currentApp:h,currentAppVersion:V}=o._internalState;return l?(0,D.Left)(l):(0,D.Right)({currentApp:h,currentAppVersion:V})}})}extractDependencies(t){return{getAppAndVersion:()=>t.sendCommand(new b.GetAppAndVersionCommand),waitForDeviceUnlock:({input:r})=>new g.Observable(A=>{const u=t.getDeviceSessionStateObservable().pipe((0,v.tap)(p=>{p.deviceStatus===y.DeviceStatus.CONNECTED&&(A.complete(),u.unsubscribe())})).subscribe();return()=>{u.unsubscribe()}}).pipe((0,v.timeout)(r.unlockTimeout)),getDeviceSessionState:()=>t.getDeviceSessionState(),setDeviceSessionState:r=>t.setDeviceSessionState(r),isDeviceOnboarded:()=>!0}}}0&&(module.exports={GetDeviceStatusDeviceAction});
2
2
  //# sourceMappingURL=GetDeviceStatusDeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { Observable } from \"rxjs\";\nimport { tap, timeout } from \"rxjs/operators\";\nimport { assign, fromObservable, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetAppAndVersionCommand,\n type GetAppAndVersionCommandResult,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport {\n DeviceLockedError,\n DeviceNotOnboardedError,\n} from \"@api/device-action/os/Errors\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\n\nimport {\n type GetDeviceStatusDAError,\n type GetDeviceStatusDAInput,\n type GetDeviceStatusDAIntermediateValue,\n type GetDeviceStatusDAOutput,\n} from \"./types\";\n\ntype GetDeviceStatusMachineInternalState = {\n readonly onboarded: boolean;\n readonly locked: boolean;\n readonly currentApp: string | null;\n readonly currentAppVersion: string | null;\n readonly error: GetDeviceStatusDAError | null;\n};\n\nexport type MachineDependencies = {\n readonly getAppAndVersion: () => Promise<GetAppAndVersionCommandResult>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly waitForDeviceUnlock: (args: {\n input: { unlockTimeout: number };\n }) => Observable<void>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n readonly isDeviceOnboarded: () => boolean;\n};\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class GetDeviceStatusDeviceAction extends XStateDeviceAction<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n > {\n type types = StateMachineTypes<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n >;\n\n const {\n getAppAndVersion,\n getDeviceSessionState,\n setDeviceSessionState,\n waitForDeviceUnlock,\n isDeviceOnboarded,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n return setup({\n types: {\n input: {\n unlockTimeout,\n } as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n getAppAndVersion: fromPromise(getAppAndVersion),\n waitForDeviceUnlock: fromObservable(waitForDeviceUnlock),\n },\n guards: {\n isDeviceOnboarded: () => isDeviceOnboarded(), // TODO: we don't have this info for now, this can be derived from the \"flags\" obtained in the getVersion command\n isDeviceUnlocked: () =>\n getDeviceSessionState().deviceStatus !== DeviceStatus.LOCKED,\n hasError: ({ context }) => context._internalState.error !== null,\n },\n actions: {\n assignErrorDeviceNotOnboarded: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceNotOnboardedError(),\n }),\n }),\n assignErrorDeviceLocked: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceLockedError(),\n }),\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n }),\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n assignNoUserActionNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignUserActionUnlockNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHEwBcAiYBuBLAxmAMpoCGaArrFnoQIL5q4D2AdgHQ0FgBKYpEAJ4BiANoAGALqJQAB2axcTNjJAAPRAFoArAHZx7AIwAmQ7oCcugMyHzANmMAWYwBoQgxI8vsAHOJM+VuLmVj5e2gC+EW6omDjcJORUXPSMLBwA8qwARsykAE4QuKxQAMIAFmD4ANZiUqryisqsqhoImo4O7OGhPj4h5n6Obh4IunZ2RoZ+ena6nYaGUTHoKcRklNTxqc3sWbkFRSUVVbWihtJIII1K6a1aVtoGTxOOjtbv84YjiObik7ofPM7GFDP9jNofMsQLE1olNmsGLsADLMGrFMqVGp1S5yBS3FRXNqaOzadjiHx2KyORbzcRBczmH4IbTOdjaabaKmdGy6XSRaIw1bbdZJLa0MBI9LsVHo45Ys4XBr45r3dps-n0ubaGxgx6PZlWULkkLBGmDCzGYzQ2Ei+HJEVStjsACqsDA+SdrBdrAANmjqmthBA2GB2MVsMxqmG3R6vT7-TU1hJcdcVXciYgglZycYQiYqRTQoZtMynDmbM4aW8rHYzD4BSs4hL7eLuF7Xe7PWk2AmA0GPflmPl2LJfeQAGbDgC2nbjPe9fv7IpTyqaGdAbXmxnZPkMNNM820VuZ+8M7Dsb3MznpwW31sFtpbGwdEo7dFksjorAgADUPYobAnNiIasGGEZRmGT4JC+bY7NKH5fj+-75IBrDAdUCAQfg5DpCmq5XDcqqZmMjgGDY-yGJeejjFRzJ2P47DZoEJb+Hyx42sKz5ioiC7sIh35-gB6QYcIg7DqO45oFO+SztBhCtrxuwCchwlAQqWGsJGOHNPh9SEemhKbogdLsIMTjmPuNF1nYZaOBW+5OPu9l1oCjZCs2ME8Y6fGIb6BC4WwdDYKQuDjtkvq8HAFC+mgokEXi65GeoiBguYZJOPSJa6Hm1hGsyuglkxxiUjYVjXlq7nyaKCI+cpn7+Tp6TBaF4WRXwsAxXFCpiEqBlJS0JFAo4vg+BCe55e8-QFUVVglVShjlWRtZ2FEgqsMwEBwKo1WKXVG5pgNaokmRZmQg4fyLHR7ieCNpjGPyx7aNo6UNo4nGeQpsFKdKax8AIoyJQSg3Ge0L07q9F3+Istk3Qg1IjUaZ7GNS-LlU4H1wt9+3OvseSFBiGFrsDx01mZ15mHooReFaVj0fZ5Jci5zissYIKY3a2NvnxsrVITCrE8RoMdDucxWgx1jpZCELDHDgKTC9jg6mNXKLDSHPcbV3O7LG3bNH2SYioLB3EmCI1-HuVL6Cj4hU6eNjsIVD3UrWfKXVCj5cV5Wvtr5n6CShaFE-1JMkWzPgXpCjh+Faw3Mjq5jdOlJhGvo-RzRr3uvr79VjgFzQtWFpARVFnWxcHQNCylCBm+eKPjJL4jWMEdNww4O46vSFVsfyD5Nlj3na9KRAUPghCwPAIdV20QIR7e-RzOYbNK98cN7ndgR-BSzgo+YmdfYPOfSgAovkQ75MbyVtItehmSrJgcijz2uHD+pmXyQSQnyVLs2tQA */\n id: \"GetDeviceStatusDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n const sessionState = getDeviceSessionState();\n const { sessionStateType } = sessionState;\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n onboarded: false, // we don't know how to check yet\n locked: sessionState.deviceStatus === DeviceStatus.LOCKED,\n currentApp:\n sessionStateType ===\n DeviceSessionStateType.ReadyWithoutSecureChannel\n ? sessionState.currentApp.name\n : null,\n currentAppVersion: null,\n error: null,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"OnboardingCheck\",\n },\n },\n OnboardingCheck: {\n // TODO: we don't have this info for now\n always: [\n {\n guard: {\n type: \"isDeviceOnboarded\",\n },\n target: \"LockingCheck\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n onboarded: true,\n }),\n }),\n },\n {\n target: \"Error\",\n actions: \"assignErrorDeviceNotOnboarded\",\n },\n ],\n },\n LockingCheck: {\n // We check if the device is locked in the session state\n always: [\n {\n target: \"AppAndVersionCheck\",\n guard: {\n type: \"isDeviceUnlocked\",\n },\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n locked: false,\n }),\n }),\n },\n {\n target: \"UserActionUnlockDevice\",\n },\n ],\n },\n UserActionUnlockDevice: {\n // we wait for the device to be unlocked (default timeout is 15s)\n entry: \"assignUserActionUnlockNeeded\",\n exit: \"assignNoUserActionNeeded\",\n invoke: {\n id: \"UserActionUnlockDevice\",\n src: \"waitForDeviceUnlock\",\n input: (_) => ({\n unlockTimeout,\n }),\n onDone: {\n target: \"AppAndVersionCheck\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n locked: false,\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorDeviceLocked\",\n },\n },\n },\n AppAndVersionCheck: {\n // We check the current app and version using the getAppAndVersion command\n invoke: {\n src: \"getAppAndVersion\",\n onDone: {\n target: \"ApplicationAvailableResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n const state: DeviceSessionState = getDeviceSessionState();\n // Narrow the type to ReadyWithoutSecureChannelState or ReadyWithSecureChannelState\n if (\n state.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n setDeviceSessionState({\n ...state,\n currentApp: _.event.output.data,\n });\n }\n return {\n ..._.context._internalState,\n currentApp: _.event.output.data.name,\n currentAppVersion: _.event.output.data.version,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n ApplicationAvailableResultCheck: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (args) => {\n // TODO: instead we should rely on the current state (\"Success\" or \"Error\")\n const { context } = args;\n const { error, currentApp, currentAppVersion } = context._internalState;\n if (error) {\n return Left(error);\n }\n return Right<GetDeviceStatusDAOutput>({\n currentApp: currentApp!,\n currentAppVersion: currentAppVersion!,\n });\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const getAppAndVersion = () => {\n return internalApi.sendCommand(new GetAppAndVersionCommand());\n };\n\n const waitForDeviceUnlock = ({\n input,\n }: {\n input: { unlockTimeout: number };\n }) =>\n new Observable<void>((subscriber) => {\n const inner = internalApi\n .getDeviceSessionStateObservable()\n .pipe(\n tap((state) => {\n if (state.deviceStatus === DeviceStatus.CONNECTED) {\n subscriber.complete();\n inner.unsubscribe();\n }\n }),\n )\n .subscribe();\n\n return () => {\n inner.unsubscribe();\n };\n }).pipe(timeout(input.unlockTimeout));\n\n return {\n getAppAndVersion,\n waitForDeviceUnlock,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n isDeviceOnboarded: () => true, // TODO: we don't have this info for now\n };\n }\n}\n"],
5
- "mappings": "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",
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { Observable } from \"rxjs\";\nimport { tap, timeout } from \"rxjs/operators\";\nimport { assign, fromObservable, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetAppAndVersionCommand,\n type GetAppAndVersionCommandResult,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport {\n DeviceLockedError,\n DeviceNotOnboardedError,\n} from \"@api/device-action/os/Errors\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\n\nimport {\n type GetDeviceStatusDAError,\n type GetDeviceStatusDAInput,\n type GetDeviceStatusDAIntermediateValue,\n type GetDeviceStatusDAOutput,\n} from \"./types\";\n\ntype GetDeviceStatusMachineInternalState = {\n readonly onboarded: boolean;\n readonly locked: boolean;\n readonly currentApp: string | null;\n readonly currentAppVersion: string | null;\n readonly error: GetDeviceStatusDAError | null;\n};\n\nexport type MachineDependencies = {\n readonly getAppAndVersion: () => Promise<GetAppAndVersionCommandResult>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly waitForDeviceUnlock: (args: {\n input: { unlockTimeout: number };\n }) => Observable<void>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n readonly isDeviceOnboarded: () => boolean;\n};\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class GetDeviceStatusDeviceAction extends XStateDeviceAction<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n > {\n type types = StateMachineTypes<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n >;\n\n const {\n getAppAndVersion,\n getDeviceSessionState,\n setDeviceSessionState,\n waitForDeviceUnlock,\n isDeviceOnboarded,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n return setup({\n types: {\n input: {\n unlockTimeout,\n } as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n getAppAndVersion: fromPromise(getAppAndVersion),\n waitForDeviceUnlock: fromObservable(waitForDeviceUnlock),\n },\n guards: {\n isDeviceOnboarded: () => isDeviceOnboarded(), // TODO: we don't have this info for now, this can be derived from the \"flags\" obtained in the getVersion command\n isDeviceLocked: ({ context }) => context._internalState.locked,\n hasError: ({ context }) => context._internalState.error !== null,\n },\n actions: {\n assignErrorDeviceNotOnboarded: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceNotOnboardedError(),\n }),\n }),\n assignErrorDeviceLocked: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceLockedError(),\n }),\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n }),\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n assignNoUserActionNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignUserActionUnlockNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHEwBcAiYBuBLAxmAMpoCGaArrFnoQIL5q4D2AdgHQ0FgBKYpEAJ4BiANoAGALqJQAB2axcTNjJAAPRAFoArAHZx7AIwAmQ7oCcugMyHzANmMAWYwBoQgxI8vsAHOJM+VuLmVj5e2gC+EW6omDjcJORUXPSMLBwA8qwARsykAE4QuKxQAMIAFmD4ANZiUqryisqsqhoImo4O7OGhPj4h5n6Obh4IunZ2RoZ+ena6nYaGUTHoKcRklNTxqc3sWbkFRSUVVbWihtJIII1K6a1aVtoGTxOOjtbv84YjiObik7ofPM7GFDP9jNofMsQLE1olNmsGLsADLMGrFMqVGp1S5yBS3FRXNqaOzadjiHx2KyORbzcRBczmH4IbTOdjaabaKmdGy6XSRaIw1bbdZJLa0MBI9LsVHo45Ys4XBr45r3dps-n0ubaGxgx6PZlWULkkLBGmDCzGYzQ2Ei+HJEVStjsACqsDA+SdrBdrAANmjqmthBA2GB2MVsMxqmG3R6vT7-TU1hJcdcVXciYgglZycYQiYqRTQoZtMynDmbM4aW8rHYzD4BSs4hL7eLuF7Xe7PWk2AmA0GPflmPl2LJfeQAGbDgC2nbjPe9fv7IpTyqaGdAbXmxnZPkMNNM820VuZ+8M7Dsb3MznpwW31sFtpbGwdEo7dFksjorAgADUPYobAnNiIasGGEZRmGT4JC+bY7NKH5fj+-75IBrDAdUCAQfg5DpCmq5XDcqqZmMjgGDY-yGJeejjFRzJ2P47DZoEJb+Hyx42sKz5ioiC7sIh35-gB6QYcIg7DqO45oFO+SztBhCtrxuwCchwlAQqWGsJGOHNPh9SEemhKbogdLsIMTjmPuNF1nYZaOBW+5OPu9l1oCjZCs2ME8Y6fGIb6BC4WwdDYKQuDjtkvq8HAFC+mgokEXi65GeoiBguYZJOPSJa6Hm1hGsyuglkxxiUjYVjXlq7nyaKCI+cpn7+Tp6TBaF4WRXwsAxXFCpiEqBlJS0JFAo4vg+BCe55e8-QFUVVglVShjlWRtZ2FEgqsMwEBwKo1WKXVG5pgNaokmRZmQg4fyLHR7ieCNpjGPyx7aNo6UNo4nGeQpsFKdKax8AIoyJQSg3Ge0L07q9F3+Istk3Qg1IjUaZ7GNS-LlU4H1wt9+3OvseSFBiGFrsDx01mZ15mHooReFaVj0fZ5Jci5zissYIKY3a2NvnxsrVITCrE8RoMdDucxWgx1jpZCELDHDgKTC9jg6mNXKLDSHPcbV3O7LG3bNH2SYioLB3EmCI1-HuVL6Cj4hU6eNjsIVD3UrWfKXVCj5cV5Wvtr5n6CShaFE-1JMkWzPgXpCjh+Faw3Mjq5jdOlJhGvo-RzRr3uvr79VjgFzQtWFpARVFnWxcHQNCylCBm+eKPjJL4jWMEdNww4O46vSFVsfyD5Nlj3na9KRAUPghCwPAIdV20QIR7e-RzOYbNK98cN7ndgR-BSzgo+YmdfYPOfSgAovkQ75MbyVtItehmSrJgcijz2uHD+pmXyQSQnyVLs2tQA */\n id: \"GetDeviceStatusDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n const sessionState = getDeviceSessionState();\n const { sessionStateType } = sessionState;\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n onboarded: false, // we don't know how to check yet\n locked: false,\n currentApp:\n sessionStateType ===\n DeviceSessionStateType.ReadyWithoutSecureChannel\n ? sessionState.currentApp.name\n : null,\n currentAppVersion: null,\n error: null,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"OnboardingCheck\",\n },\n },\n OnboardingCheck: {\n // TODO: we don't have this info for now\n always: [\n {\n guard: {\n type: \"isDeviceOnboarded\",\n },\n target: \"AppAndVersionCheck\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n onboarded: true,\n }),\n }),\n },\n {\n target: \"Error\",\n actions: \"assignErrorDeviceNotOnboarded\",\n },\n ],\n },\n UserActionUnlockDevice: {\n // we wait for the device to be unlocked (default timeout is 15s)\n entry: \"assignUserActionUnlockNeeded\",\n exit: \"assignNoUserActionNeeded\",\n invoke: {\n id: \"UserActionUnlockDevice\",\n src: \"waitForDeviceUnlock\",\n input: (_) => ({\n unlockTimeout,\n }),\n onDone: {\n target: \"AppAndVersionCheck\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n locked: false,\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorDeviceLocked\",\n },\n },\n },\n AppAndVersionCheck: {\n // We check the current app and version using the getAppAndVersion command\n invoke: {\n src: \"getAppAndVersion\",\n onDone: {\n target: \"ApplicationAvailableResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n const state: DeviceSessionState = getDeviceSessionState();\n if (\n state.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n // Update the current app\n setDeviceSessionState({\n ...state,\n currentApp: _.event.output.data,\n });\n } else {\n // The device can be set to Ready if GetAppAndVersionCommand was successful\n setDeviceSessionState({\n deviceModelId: state.deviceModelId,\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: _.event.output.data,\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n }\n return {\n ..._.context._internalState,\n locked: false,\n currentApp: _.event.output.data.name,\n currentAppVersion: _.event.output.data.version,\n };\n }\n if (\n \"errorCode\" in _.event.output.error &&\n _.event.output.error.errorCode === \"5515\"\n ) {\n return {\n ..._.context._internalState,\n locked: true,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n ApplicationAvailableResultCheck: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n target: \"UserActionUnlockDevice\",\n guard: \"isDeviceLocked\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (args) => {\n // TODO: instead we should rely on the current state (\"Success\" or \"Error\")\n const { context } = args;\n const { error, currentApp, currentAppVersion } = context._internalState;\n if (error) {\n return Left(error);\n }\n return Right<GetDeviceStatusDAOutput>({\n currentApp: currentApp!,\n currentAppVersion: currentAppVersion!,\n });\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const getAppAndVersion = () => {\n return internalApi.sendCommand(new GetAppAndVersionCommand());\n };\n\n const waitForDeviceUnlock = ({\n input,\n }: {\n input: { unlockTimeout: number };\n }) =>\n new Observable<void>((subscriber) => {\n const inner = internalApi\n .getDeviceSessionStateObservable()\n .pipe(\n tap((state) => {\n if (state.deviceStatus === DeviceStatus.CONNECTED) {\n subscriber.complete();\n inner.unsubscribe();\n }\n }),\n )\n .subscribe();\n\n return () => {\n inner.unsubscribe();\n };\n }).pipe(timeout(input.unlockTimeout));\n\n return {\n getAppAndVersion,\n waitForDeviceUnlock,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n isDeviceOnboarded: () => true, // TODO: we don't have this info for now\n };\n }\n}\n"],
5
+ "mappings": "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",
6
6
  "names": ["GetDeviceStatusDeviceAction_exports", "__export", "GetDeviceStatusDeviceAction", "__toCommonJS", "import_purify_ts", "import_rxjs", "import_operators", "import_xstate", "import_CommandResult", "import_GetAppAndVersionCommand", "import_DeviceStatus", "import_UserInteractionRequired", "import_Const", "import_Errors", "import_XStateDeviceAction", "import_DeviceSessionState", "internalApi", "getAppAndVersion", "getDeviceSessionState", "setDeviceSessionState", "waitForDeviceUnlock", "isDeviceOnboarded", "unlockTimeout", "context", "_", "sessionState", "sessionStateType", "state", "args", "error", "currentApp", "currentAppVersion", "input", "subscriber", "inner"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var u=require("rxjs"),v=require("../../../command/model/CommandResult"),y=require("../../../command/utils/GlobalCommandError"),S=require("../../../device/DeviceModel"),i=require("../../../device/DeviceStatus"),a=require("../../../device-action/__test-utils__/makeInternalApi"),d=require("../../../device-action/__test-utils__/testDeviceActionStates"),t=require("../../../device-action/model/DeviceActionState"),c=require("../../../device-action/model/UserInteractionRequired"),D=require("../../../device-action/os/Errors"),o=require("../../../device-session/DeviceSessionState"),p=require("./GetDeviceStatusDeviceAction");describe("GetDeviceStatusDeviceAction",()=>{const k=jest.fn(),l=jest.fn(),h=jest.fn(),f=jest.fn(),O=jest.fn();function A(){return{getAppAndVersion:k,getDeviceSessionState:l,waitForDeviceUnlock:h,setDeviceSessionState:f,isDeviceOnboarded:O}}const{sendCommand:R,getDeviceSessionState:V,getDeviceSessionStateObservable:E}=(0,a.makeDeviceActionInternalApiMock)();beforeEach(()=>{jest.resetAllMocks(),O.mockReturnValue(!0)}),describe("without overriding `extractDependencies`",()=>{it("should run the device action with an unlocked device",r=>{const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});V.mockReturnValue({sessionStateType:o.DeviceSessionStateType.Connected,deviceStatus:i.DeviceStatus.CONNECTED,deviceModelId:S.DeviceModelId.FLEX}),R.mockResolvedValue((0,v.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should run the device action with a locked device",r=>{const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});V.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.DeviceModelId.FLEX}),E.mockImplementation(()=>new u.Observable(s=>{const m=(0,u.interval)(50).subscribe({next:C=>{C>2?(s.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.DeviceModelId.FLEX}),s.complete()):s.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.DeviceModelId.FLEX})}});return()=>{m.unsubscribe()}})),R.mockResolvedValue((0,v.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)})}),describe("success cases",()=>{it("should return the device status if the device is unlocked",r=>{l.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),k.mockResolvedValue((0,v.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:void 0}});jest.spyOn(e,"extractDependencies").mockReturnValue(A());const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should return the device status if the device is locked and the user unlocks the device",r=>{l.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),k.mockResolvedValue((0,v.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}})),h.mockImplementation(()=>new u.Observable(s=>{const m=(0,u.interval)(50).subscribe({next:C=>{C>2?(s.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),s.complete()):s.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{m.unsubscribe()}}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(A());const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)})}),describe("errors cases",()=>{it("should end in an error if the device is not onboarded",r=>{l.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),O.mockReturnValue(!1);const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(A());const n=[{error:new D.DeviceNotOnboardedError,status:t.DeviceActionStatus.Error}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should end in an error if the device is locked and the user does not unlock",r=>{l.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),E.mockImplementation(()=>new u.Observable(s=>{const m=(0,u.interval)(200).subscribe({next:()=>{s.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.DeviceModelId.FLEX})}});return()=>{m.unsubscribe()}}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(A());const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{error:new D.DeviceLockedError("Device locked."),status:t.DeviceActionStatus.Error}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should end in an error if the GetAppAndVersion command fails",r=>{l.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}});const e=new y.GlobalCommandError({...y.GLOBAL_ERRORS[5501],errorCode:"5501"});k.mockResolvedValue((0,v.CommandResultFactory)({error:e})),h.mockImplementation(()=>new u.Observable(m=>{const C=(0,u.interval)(50).subscribe({next:b=>{b>2?(m.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),m.complete()):m.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{C.unsubscribe()}}));const n=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(n,"extractDependencies").mockReturnValue(A());const s=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:e,status:t.DeviceActionStatus.Error}];(0,d.testDeviceActionStates)(n,s,(0,a.makeDeviceActionInternalApiMock)(),r)}),it("should end in an error if getAppAndVersion actor throws an error",r=>{l.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),k.mockImplementation(()=>{throw new D.UnknownDAError("error")}),h.mockImplementation(()=>new u.Observable(s=>{s.complete()}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(A());const n=[{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:new D.UnknownDAError("error"),status:t.DeviceActionStatus.Error}];(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r)})}),it("should emit a stopped state if the action is cancelled",r=>{V.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:i.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.DeviceModelId.FLEX}),R.mockResolvedValue((0,v.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new p.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}}),n=[{status:t.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:c.UserInteractionRequired.None}},{status:t.DeviceActionStatus.Stopped}],{cancel:s}=(0,d.testDeviceActionStates)(e,n,(0,a.makeDeviceActionInternalApiMock)(),r);s()})});
1
+ "use strict";var m=require("rxjs"),d=require("../../../command/model/CommandResult"),v=require("../../../command/utils/GlobalCommandError"),C=require("../../../device/DeviceModel"),r=require("../../../device/DeviceStatus"),u=require("../../../device-action/__test-utils__/makeInternalApi"),p=require("../../../device-action/__test-utils__/testDeviceActionStates"),t=require("../../../device-action/model/DeviceActionState"),a=require("../../../device-action/model/UserInteractionRequired"),O=require("../../../device-action/os/Errors"),o=require("../../../device-session/DeviceSessionState"),l=require("./GetDeviceStatusDeviceAction");describe("GetDeviceStatusDeviceAction",()=>{const A=vi.fn(),D=vi.fn(),y=vi.fn(),V=vi.fn(),R=vi.fn();function k(){return{getAppAndVersion:A,getDeviceSessionState:D,waitForDeviceUnlock:y,setDeviceSessionState:V,isDeviceOnboarded:R}}const{sendCommand:E,getDeviceSessionState:w,getDeviceSessionStateObservable:N}=(0,u.makeDeviceActionInternalApiMock)();beforeEach(()=>{vi.resetAllMocks(),R.mockReturnValue(!0)}),describe("without overriding `extractDependencies`",()=>{it("should run the device action with an unlocked device",()=>new Promise((i,s)=>{const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});w.mockReturnValue({sessionStateType:o.DeviceSessionStateType.Connected,deviceStatus:r.DeviceStatus.CONNECTED,deviceModelId:C.DeviceModelId.NANO_X}),E.mockResolvedValue((0,d.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:i,onError:s})})),it("should run the device action with a locked device",()=>new Promise((i,s)=>{const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});w.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:C.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1}),N.mockImplementation(()=>new m.Observable(c=>{const S=(0,m.interval)(50).subscribe({next:h=>{h>2?(c.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:C.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1}),c.complete()):c.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:C.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1})}});return()=>{S.unsubscribe()}})),E.mockResolvedValueOnce((0,d.CommandResultFactory)({error:new v.GlobalCommandError({...v.GLOBAL_ERRORS[5515],errorCode:"5515"})})).mockResolvedValueOnce((0,d.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.DeviceActionStatus.Completed}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:i,onError:s})}))}),describe("success cases",()=>{it("should return the device status if the device is unlocked",()=>new Promise((i,s)=>{D.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),A.mockResolvedValue((0,d.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:void 0}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:()=>{expect(V).toHaveBeenCalledWith({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.CONNECTED,currentApp:{name:"BOLOS",version:"1.0.0"}}),i()},onError:s})})),it("should return the device status and update session if the device is not ready",()=>new Promise((i,s)=>{D.mockReturnValue({sessionStateType:o.DeviceSessionStateType.Connected,deviceStatus:r.DeviceStatus.CONNECTED}),A.mockResolvedValue((0,d.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:void 0}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:()=>{expect(V).toHaveBeenCalledWith({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.CONNECTED,currentApp:{name:"BOLOS",version:"1.0.0"},installedApps:[],isSecureConnectionAllowed:!1}),i()},onError:s})})),it("should return the device status if the device is locked and the user unlocks the device",()=>new Promise((i,s)=>{D.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),A.mockResolvedValueOnce((0,d.CommandResultFactory)({error:new v.GlobalCommandError({...v.GLOBAL_ERRORS[5515],errorCode:"5515"})})).mockResolvedValueOnce((0,d.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}})),y.mockImplementation(()=>new m.Observable(c=>{const S=(0,m.interval)(50).subscribe({next:h=>{h>2?(c.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),c.complete()):c.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{S.unsubscribe()}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{status:t.DeviceActionStatus.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:i,onError:s})}))}),describe("errors cases",()=>{it("should end in an error if the device is not onboarded",()=>new Promise((i,s)=>{D.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),R.mockReturnValue(!1);const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{error:new O.DeviceNotOnboardedError,status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:i,onError:s})})),it("should end in an error if the device is locked and the user does not unlock",()=>new Promise((i,s)=>{D.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),A.mockResolvedValue((0,d.CommandResultFactory)({error:new v.GlobalCommandError({...v.GLOBAL_ERRORS[5515],errorCode:"5515"})})),N.mockImplementation(()=>new m.Observable(c=>{const S=(0,m.interval)(200).subscribe({next:()=>{c.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:C.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1})}});return()=>{S.unsubscribe()}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.UnlockDevice},status:t.DeviceActionStatus.Pending},{error:new O.DeviceLockedError("Device locked."),status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:i,onError:s})})),it("should end in an error if the GetAppAndVersion command fails",()=>new Promise((i,s)=>{D.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}});const e=new v.GlobalCommandError({...v.GLOBAL_ERRORS[5501],errorCode:"5501"});A.mockResolvedValue((0,d.CommandResultFactory)({error:e})),y.mockImplementation(()=>new m.Observable(S=>{const h=(0,m.interval)(50).subscribe({next:f=>{f>2?(S.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),S.complete()):S.next({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{h.unsubscribe()}}));const n=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(n,"extractDependencies").mockReturnValue(k());const c=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:e,status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(n,c,(0,u.makeDeviceActionInternalApiMock)(),{onDone:i,onError:s})})),it("should end in an error if getAppAndVersion actor throws an error",()=>new Promise((i,s)=>{D.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),A.mockImplementation(()=>{throw new O.UnknownDAError("error")}),y.mockImplementation(()=>new m.Observable(c=>{c.complete()}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}});vi.spyOn(e,"extractDependencies").mockReturnValue(k());const n=[{intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None},status:t.DeviceActionStatus.Pending},{error:new O.UnknownDAError("error"),status:t.DeviceActionStatus.Error}];(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:i,onError:s})}))}),it("should emit a stopped state if the action is cancelled",()=>new Promise((i,s)=>{w.mockReturnValue({sessionStateType:o.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:r.DeviceStatus.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:C.DeviceModelId.NANO_X,isSecureConnectionAllowed:!1}),E.mockResolvedValue((0,d.CommandResultFactory)({data:{name:"BOLOS",version:"1.0.0"}}));const e=new l.GetDeviceStatusDeviceAction({input:{unlockTimeout:500}}),n=[{status:t.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:a.UserInteractionRequired.None}},{status:t.DeviceActionStatus.Stopped}],{cancel:c}=(0,p.testDeviceActionStates)(e,n,(0,u.makeDeviceActionInternalApiMock)(),{onDone:i,onError:s});c()}))});
2
2
  //# sourceMappingURL=GetDeviceStatusDeviceAction.test.js.map