@ledgerhq/device-management-kit 0.0.0-fix-rn-ble-20250502082216 → 0.0.0-fix-lns-20250901094837

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 (492) hide show
  1. package/README.md +3 -3
  2. package/lib/cjs/package.json +22 -23
  3. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  4. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +2 -2
  5. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
  6. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
  7. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
  8. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
  9. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js +1 -1
  10. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
  11. package/lib/cjs/src/api/command/di/commandModule.js +1 -1
  12. package/lib/cjs/src/api/command/di/commandModule.js.map +3 -3
  13. package/lib/cjs/src/api/command/di/commandModule.test.js +1 -1
  14. package/lib/cjs/src/api/command/di/commandModule.test.js.map +2 -2
  15. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  16. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  17. package/lib/cjs/src/api/command/utils/CommandUtils.js +1 -1
  18. package/lib/cjs/src/api/command/utils/CommandUtils.js.map +2 -2
  19. package/lib/cjs/src/api/command/utils/CommandUtils.test.js +1 -1
  20. package/lib/cjs/src/api/command/utils/CommandUtils.test.js.map +2 -2
  21. package/lib/cjs/src/api/command/utils/GlobalCommandError.js +1 -1
  22. package/lib/cjs/src/api/command/utils/GlobalCommandError.js.map +2 -2
  23. package/lib/cjs/src/api/device/DeviceModel.js +1 -1
  24. package/lib/cjs/src/api/device/DeviceModel.js.map +2 -2
  25. package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
  26. package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
  27. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  28. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  29. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  30. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  31. package/lib/cjs/src/api/device-action/di/deviceActionModule.js +1 -1
  32. package/lib/cjs/src/api/device-action/di/deviceActionModule.js.map +3 -3
  33. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js +1 -1
  34. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  35. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
  36. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  37. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  38. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
  39. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  40. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  41. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +1 -1
  42. package/lib/cjs/src/api/device-action/os/Errors.js +1 -1
  43. package/lib/cjs/src/api/device-action/os/Errors.js.map +3 -3
  44. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
  45. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
  46. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js +1 -1
  47. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +1 -1
  48. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  49. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
  50. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  51. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
  52. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
  53. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
  54. package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js +1 -1
  55. package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js.map +1 -1
  56. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
  57. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
  58. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
  59. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
  60. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +2 -0
  61. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
  62. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  63. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
  64. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  65. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
  66. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -1
  67. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js.map +1 -1
  68. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
  69. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
  70. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
  71. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
  72. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js +2 -0
  73. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
  74. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  75. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
  76. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  77. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  78. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js +1 -1
  79. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +1 -1
  80. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
  81. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
  82. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
  83. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
  84. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
  85. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
  86. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
  87. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
  88. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  89. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +2 -2
  90. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  91. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
  92. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.js +1 -1
  93. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.js.map +2 -2
  94. package/lib/cjs/src/api/device-model/model/DeviceModel.js +1 -1
  95. package/lib/cjs/src/api/device-model/model/DeviceModel.js.map +2 -2
  96. package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js +1 -1
  97. package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
  98. package/lib/cjs/src/api/index.js +1 -1
  99. package/lib/cjs/src/api/index.js.map +3 -3
  100. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
  101. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  102. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +1 -1
  103. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
  104. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
  105. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js +1 -1
  106. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +1 -1
  107. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
  108. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
  109. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
  110. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
  111. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
  112. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +2 -2
  113. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js +1 -1
  114. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +1 -1
  115. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  116. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  117. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
  118. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
  119. package/lib/cjs/src/api/secure-channel/task/types.js +1 -1
  120. package/lib/cjs/src/api/secure-channel/task/types.js.map +2 -2
  121. package/lib/cjs/src/api/secure-channel/utils.js +1 -1
  122. package/lib/cjs/src/api/secure-channel/utils.js.map +3 -3
  123. package/lib/cjs/src/api/secure-channel/utils.test.js +1 -1
  124. package/lib/cjs/src/api/secure-channel/utils.test.js.map +3 -3
  125. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  126. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
  127. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js +2 -0
  128. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
  129. package/lib/cjs/src/api/transport/model/Errors.js +1 -1
  130. package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
  131. package/lib/cjs/src/api/types.js +1 -1
  132. package/lib/cjs/src/api/types.js.map +1 -1
  133. package/lib/cjs/src/api/utils/AppName.js +2 -0
  134. package/lib/cjs/src/api/utils/AppName.js.map +7 -0
  135. package/lib/cjs/src/api/utils/AppName.test.js +2 -0
  136. package/lib/cjs/src/api/utils/AppName.test.js.map +7 -0
  137. package/lib/cjs/src/api/utils/HexaString.js +1 -1
  138. package/lib/cjs/src/api/utils/HexaString.js.map +3 -3
  139. package/lib/cjs/src/api/utils/HexaString.test.js +1 -1
  140. package/lib/cjs/src/api/utils/HexaString.test.js.map +2 -2
  141. package/lib/cjs/src/di.js +1 -1
  142. package/lib/cjs/src/di.js.map +2 -2
  143. package/lib/cjs/src/internal/config/di/configModule.js +1 -1
  144. package/lib/cjs/src/internal/config/di/configModule.js.map +3 -3
  145. package/lib/cjs/src/internal/config/di/configModule.test.js +1 -1
  146. package/lib/cjs/src/internal/config/di/configModule.test.js.map +2 -2
  147. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js +1 -1
  148. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  149. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  150. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  151. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  152. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  153. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  154. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  155. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  156. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +2 -2
  157. package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.js +1 -1
  158. package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.js.map +2 -2
  159. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  160. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  161. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  162. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  163. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  164. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  165. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  166. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  167. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  168. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +2 -2
  169. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  170. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  171. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js +1 -1
  172. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  173. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  174. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  175. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
  176. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  177. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  178. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  179. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  180. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  181. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  182. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  183. package/lib/cjs/src/internal/secure-channel/model/Errors.js +1 -1
  184. package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +3 -3
  185. package/lib/cjs/src/internal/send/di/sendModule.js +1 -1
  186. package/lib/cjs/src/internal/send/di/sendModule.js.map +3 -3
  187. package/lib/cjs/src/internal/send/di/sendModule.test.js +1 -1
  188. package/lib/cjs/src/internal/send/di/sendModule.test.js.map +2 -2
  189. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js +1 -1
  190. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
  191. package/lib/cjs/src/internal/transport/di/transportModule.js +1 -1
  192. package/lib/cjs/src/internal/transport/di/transportModule.js.map +3 -3
  193. package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
  194. package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
  195. package/lib/esm/package.json +22 -23
  196. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  197. package/lib/esm/src/api/DeviceManagementKit.test.js.map +2 -2
  198. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
  199. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
  200. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
  201. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
  202. package/lib/esm/src/api/apdu/utils/ByteArrayParser.js +1 -1
  203. package/lib/esm/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
  204. package/lib/esm/src/api/command/di/commandModule.js +1 -1
  205. package/lib/esm/src/api/command/di/commandModule.js.map +3 -3
  206. package/lib/esm/src/api/command/di/commandModule.test.js +1 -1
  207. package/lib/esm/src/api/command/di/commandModule.test.js.map +2 -2
  208. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  209. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  210. package/lib/esm/src/api/command/utils/CommandUtils.js +1 -1
  211. package/lib/esm/src/api/command/utils/CommandUtils.js.map +3 -3
  212. package/lib/esm/src/api/command/utils/CommandUtils.test.js +1 -1
  213. package/lib/esm/src/api/command/utils/CommandUtils.test.js.map +2 -2
  214. package/lib/esm/src/api/command/utils/GlobalCommandError.js +1 -1
  215. package/lib/esm/src/api/command/utils/GlobalCommandError.js.map +2 -2
  216. package/lib/esm/src/api/device/DeviceModel.js +1 -1
  217. package/lib/esm/src/api/device/DeviceModel.js.map +2 -2
  218. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  219. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  220. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  221. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  222. package/lib/esm/src/api/device-action/di/deviceActionModule.js +1 -1
  223. package/lib/esm/src/api/device-action/di/deviceActionModule.js.map +3 -3
  224. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js +1 -1
  225. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  226. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
  227. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  228. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  229. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
  230. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  231. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  232. package/lib/esm/src/api/device-action/os/Errors.js +1 -1
  233. package/lib/esm/src/api/device-action/os/Errors.js.map +3 -3
  234. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
  235. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
  236. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  237. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
  238. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  239. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
  240. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
  241. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
  242. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
  243. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
  244. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
  245. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
  246. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -0
  247. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
  248. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  249. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
  250. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  251. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  252. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
  253. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
  254. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
  255. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
  256. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -0
  257. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
  258. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  259. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
  260. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  261. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  262. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
  263. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
  264. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
  265. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
  266. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
  267. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
  268. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
  269. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
  270. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  271. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +2 -2
  272. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  273. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
  274. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.js +1 -1
  275. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.js.map +2 -2
  276. package/lib/esm/src/api/device-model/model/DeviceModel.js +1 -1
  277. package/lib/esm/src/api/device-model/model/DeviceModel.js.map +2 -2
  278. package/lib/esm/src/api/device-model/model/DeviceModel.stub.js +1 -1
  279. package/lib/esm/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
  280. package/lib/esm/src/api/index.js +1 -1
  281. package/lib/esm/src/api/index.js.map +3 -3
  282. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
  283. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  284. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
  285. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
  286. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
  287. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
  288. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
  289. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
  290. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
  291. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +2 -2
  292. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  293. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  294. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
  295. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
  296. package/lib/esm/src/api/secure-channel/task/types.js +1 -1
  297. package/lib/esm/src/api/secure-channel/task/types.js.map +2 -2
  298. package/lib/esm/src/api/secure-channel/utils.js +1 -1
  299. package/lib/esm/src/api/secure-channel/utils.js.map +3 -3
  300. package/lib/esm/src/api/secure-channel/utils.test.js +1 -1
  301. package/lib/esm/src/api/secure-channel/utils.test.js.map +3 -3
  302. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  303. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
  304. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js +2 -0
  305. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
  306. package/lib/esm/src/api/transport/model/Errors.js +1 -1
  307. package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
  308. package/lib/esm/src/api/utils/AppName.js +2 -0
  309. package/lib/esm/src/api/utils/AppName.js.map +7 -0
  310. package/lib/esm/src/api/utils/AppName.test.js +2 -0
  311. package/lib/esm/src/api/utils/AppName.test.js.map +7 -0
  312. package/lib/esm/src/api/utils/HexaString.js +1 -1
  313. package/lib/esm/src/api/utils/HexaString.js.map +3 -3
  314. package/lib/esm/src/api/utils/HexaString.test.js +1 -1
  315. package/lib/esm/src/api/utils/HexaString.test.js.map +2 -2
  316. package/lib/esm/src/di.js +1 -1
  317. package/lib/esm/src/di.js.map +2 -2
  318. package/lib/esm/src/internal/config/di/configModule.js +1 -1
  319. package/lib/esm/src/internal/config/di/configModule.js.map +3 -3
  320. package/lib/esm/src/internal/config/di/configModule.test.js +1 -1
  321. package/lib/esm/src/internal/config/di/configModule.test.js.map +2 -2
  322. package/lib/esm/src/internal/device-model/di/deviceModelModule.js +1 -1
  323. package/lib/esm/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  324. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  325. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  326. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  327. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  328. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  329. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  330. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  331. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +2 -2
  332. package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.js +1 -1
  333. package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.js.map +2 -2
  334. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  335. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  336. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  337. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  338. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  339. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  340. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  341. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  342. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  343. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +2 -2
  344. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  345. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  346. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js +1 -1
  347. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  348. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  349. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  350. package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
  351. package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  352. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  353. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  354. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  355. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  356. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  357. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  358. package/lib/esm/src/internal/secure-channel/model/Errors.js +1 -1
  359. package/lib/esm/src/internal/secure-channel/model/Errors.js.map +3 -3
  360. package/lib/esm/src/internal/send/di/sendModule.js +1 -1
  361. package/lib/esm/src/internal/send/di/sendModule.js.map +3 -3
  362. package/lib/esm/src/internal/send/di/sendModule.test.js +1 -1
  363. package/lib/esm/src/internal/send/di/sendModule.test.js.map +2 -2
  364. package/lib/esm/src/internal/send/use-case/SendApduUseCase.js +1 -1
  365. package/lib/esm/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
  366. package/lib/esm/src/internal/transport/di/transportModule.js +1 -1
  367. package/lib/esm/src/internal/transport/di/transportModule.js.map +3 -3
  368. package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
  369. package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
  370. package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts.map +1 -1
  371. package/lib/types/src/api/apdu/utils/ApduParser.d.ts.map +1 -1
  372. package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts +66 -0
  373. package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts.map +1 -1
  374. package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts +1 -0
  375. package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts.map +1 -1
  376. package/lib/types/src/api/command/di/commandModule.d.ts.map +1 -1
  377. package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
  378. package/lib/types/src/api/command/utils/CommandErrors.d.ts.map +1 -1
  379. package/lib/types/src/api/command/utils/CommandUtils.d.ts +3 -0
  380. package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
  381. package/lib/types/src/api/command/utils/GlobalCommandError.d.ts +1 -1
  382. package/lib/types/src/api/command/utils/GlobalCommandError.d.ts.map +1 -1
  383. package/lib/types/src/api/device/DeviceModel.d.ts +2 -1
  384. package/lib/types/src/api/device/DeviceModel.d.ts.map +1 -1
  385. package/lib/types/src/api/device-action/DeviceAction.d.ts +2 -0
  386. package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
  387. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  388. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts +5 -0
  389. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
  390. package/lib/types/src/api/device-action/di/deviceActionModule.d.ts.map +1 -1
  391. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +1 -0
  392. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
  393. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -1
  394. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +1 -2
  395. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -1
  396. package/lib/types/src/api/device-action/os/Errors.d.ts +20 -0
  397. package/lib/types/src/api/device-action/os/Errors.d.ts.map +1 -1
  398. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map +1 -1
  399. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +7 -7
  400. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -1
  401. package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
  402. package/lib/types/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.d.ts.map +1 -1
  403. package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts +3 -4
  404. package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts.map +1 -1
  405. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts +40 -0
  406. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -0
  407. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts +2 -0
  408. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts.map +1 -0
  409. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +65 -0
  410. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -0
  411. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts.map +1 -1
  412. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts +0 -1
  413. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
  414. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts +15 -0
  415. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -0
  416. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts +2 -0
  417. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts.map +1 -0
  418. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +24 -0
  419. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -0
  420. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.d.ts.map +1 -1
  421. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts +1 -2
  422. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
  423. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts +30 -0
  424. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -0
  425. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts +2 -0
  426. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts.map +1 -0
  427. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts +21 -0
  428. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts.map +1 -0
  429. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts +2 -0
  430. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts.map +1 -0
  431. package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts +1 -0
  432. package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts.map +1 -1
  433. package/lib/types/src/api/device-model/data/StaticDeviceModelDataSource.d.ts.map +1 -1
  434. package/lib/types/src/api/device-model/model/DeviceModel.d.ts +2 -0
  435. package/lib/types/src/api/device-model/model/DeviceModel.d.ts.map +1 -1
  436. package/lib/types/src/api/device-model/model/DeviceModel.stub.d.ts.map +1 -1
  437. package/lib/types/src/api/device-session/service/DefaultApduReceiverService.stub.d.ts.map +1 -1
  438. package/lib/types/src/api/device-session/service/DefaultApduSenderService.stub.d.ts.map +1 -1
  439. package/lib/types/src/api/index.d.ts +4 -1
  440. package/lib/types/src/api/index.d.ts.map +1 -1
  441. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -1
  442. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +2 -1
  443. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -1
  444. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -1
  445. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts +2 -1
  446. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts.map +1 -1
  447. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -1
  448. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts +2 -1
  449. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts.map +1 -1
  450. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts.map +1 -1
  451. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts +2 -1
  452. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -1
  453. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +5 -2
  454. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -1
  455. package/lib/types/src/api/secure-channel/task/types.d.ts +6 -1
  456. package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -1
  457. package/lib/types/src/api/secure-channel/utils.d.ts +0 -11
  458. package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -1
  459. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +8 -7
  460. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -1
  461. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts +2 -0
  462. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts.map +1 -0
  463. package/lib/types/src/api/transport/model/Errors.d.ts +5 -0
  464. package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
  465. package/lib/types/src/api/types.d.ts +3 -1
  466. package/lib/types/src/api/types.d.ts.map +1 -1
  467. package/lib/types/src/api/utils/AppName.d.ts +2 -0
  468. package/lib/types/src/api/utils/AppName.d.ts.map +1 -0
  469. package/lib/types/src/api/utils/AppName.test.d.ts +2 -0
  470. package/lib/types/src/api/utils/AppName.test.d.ts.map +1 -0
  471. package/lib/types/src/api/utils/HexaString.d.ts +4 -3
  472. package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
  473. package/lib/types/src/di.d.ts.map +1 -1
  474. package/lib/types/src/internal/config/di/configModule.d.ts.map +1 -1
  475. package/lib/types/src/internal/device-model/di/deviceModelModule.d.ts.map +1 -1
  476. package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
  477. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  478. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
  479. package/lib/types/src/internal/device-session/service/DefaultApduReceiverService.d.ts.map +1 -1
  480. package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts.map +1 -1
  481. package/lib/types/src/internal/discovery/di/discoveryModule.d.ts.map +1 -1
  482. package/lib/types/src/internal/logger-publisher/di/loggerModule.d.ts.map +1 -1
  483. package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
  484. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -1
  485. package/lib/types/src/internal/secure-channel/model/Errors.d.ts +22 -2
  486. package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -1
  487. package/lib/types/src/internal/send/di/sendModule.d.ts.map +1 -1
  488. package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts +5 -1
  489. package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts.map +1 -1
  490. package/lib/types/src/internal/transport/di/transportModule.d.ts.map +1 -1
  491. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  492. package/package.json +18 -19
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.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 { SendCommandInAppDeviceAction } from \"./SendCommandInAppDeviceAction\";\nimport {\n type SendCommandInAppDAError,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n} from \"./SendCommandInAppDeviceActionTypes\";\n\nvi.mock(\n \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\",\n async (importOriginal) => {\n const original =\n await importOriginal<\n typeof import(\"../OpenAppDeviceAction/OpenAppDeviceAction\")\n >();\n\n return {\n ...original,\n OpenAppDeviceAction: vi.fn(() => ({\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(\"SendCommandInAppDeviceAction\", () => {\n const sendMyCommand = vi.fn();\n\n const extractDependenciesMock = () => ({\n sendCommand: sendMyCommand,\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 SendCommandInAppDeviceAction({\n input: {\n command: 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: MyCommandSendCommandDAState[] = [\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 SendCommandInAppDeviceAction({\n input: {\n command: 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 send command fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n sendMyCommand.mockResolvedValue(\n CommandResultFactory({\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: 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: MyCommandSendCommandDAState[] = [\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 sendMyCommand.mockResolvedValue(\n CommandResultFactory({ data: mockedCommandResponse }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: 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: MyCommandSendCommandDAState[] = [\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 it(\"should succeed while skipping OpenApp\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n sendMyCommand.mockResolvedValue(\n CommandResultFactory({ data: mockedCommandResponse }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: true,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandSendCommandDAState[] = [\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 MyCommandSendCommandDAState = DeviceActionState<\n SendCommandInAppDAOutput<MyCommandResponse>,\n SendCommandInAppDAError<UnknownDAError>,\n SendCommandInAppDAInt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AEnBE,EAAc,qBACZ,wBAAqB,CAAE,KAAMI,CAAsB,CAAC,CACtD,EAEA,MAAMC,EAAe,IAAI,+BAA6B,CACpD,MAAO,CACL,QAAS,IAAIC,EAAYH,CAAa,EACtC,QAAS,QACT,wBAAyB,0BAAwB,cACjD,YAAa,EACf,CACF,CAAC,EAED,GAAG,MAAME,EAAc,qBAAqB,EAAE,mBAC5CJ,CACF,EAEA,MAAMQ,EAAgD,CACpD,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,aACnD,CACF,EACA,CACE,OAAQ,qBAAmB,UAC3B,OAAQL,CACV,CACF,KAEA,0BACEC,EACAI,KACA,mCAAgC,EAChC,CACE,OAAQF,EACR,QAASC,CACX,CACF,CACF,CAAC,CAAC,CACN,CAAC,CACH,CAAC,EAYD,MAAMF,CAAmE,CACvE,OACA,YAAYI,EAAyB,CACnC,KAAK,OAASA,CAChB,CACA,SAAgB,CACd,OAAO,IAAI,cAAY,CAAE,IAAK,EAAM,IAAK,EAAM,GAAI,EAAM,GAAI,CAAK,CAAC,EAChE,mBAAmB,KAAK,OAAO,WAAW,EAC1C,qBAAqB,KAAK,OAAO,WAAW,EAC5C,MAAM,CACX,CACA,eAAgB,CACd,SAAO,wBAAqB,CAAE,KAAM,CAAE,QAAS,EAAG,QAAS,SAAU,CAAE,CAAC,CAC1E,CACF",
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 { SendCommandInAppDeviceAction } from \"./SendCommandInAppDeviceAction\";\nimport {\n type SendCommandInAppDAError,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n} from \"./SendCommandInAppDeviceActionTypes\";\n\nvi.mock(\n \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\",\n async (importOriginal) => {\n const original =\n await importOriginal<\n typeof import(\"../OpenAppDeviceAction/OpenAppDeviceAction\")\n >();\n\n return {\n ...original,\n OpenAppDeviceAction: vi.fn(() => ({\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(\"SendCommandInAppDeviceAction\", () => {\n const sendMyCommand = vi.fn();\n\n const extractDependenciesMock = () => ({\n sendCommand: sendMyCommand,\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 SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\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: MyCommandSendCommandDAState[] = [\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 SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\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 send command fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n sendMyCommand.mockResolvedValue(\n CommandResultFactory({\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandSendCommandDAState[] = [\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 sendMyCommand.mockResolvedValue(\n CommandResultFactory({ data: mockedCommandResponse }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandSendCommandDAState[] = [\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 it(\"should succeed while skipping OpenApp\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n sendMyCommand.mockResolvedValue(\n CommandResultFactory({ data: mockedCommandResponse }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: true,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandSendCommandDAState[] = [\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 MyCommandSendCommandDAState = DeviceActionState<\n SendCommandInAppDAOutput<MyCommandResponse>,\n SendCommandInAppDAError<UnknownDAError>,\n SendCommandInAppDAIntermediateValue<\n UserInteractionRequired.None | UserInteractionRequired.VerifyAddress\n >\n>;\n"],
5
+ "mappings": "aACA,IAAAA,EAA4B,qBAE5BC,EAAsC,kBAGt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AAMC,EAAe,IAAI,+BAA6B,CACpD,MAAO,CACL,QAAS,IAAIC,EAAYH,CAAa,EACtC,QAAS,QACT,wBAAyB,0BAAwB,cACjD,YAAa,EACf,CACF,CAAC,EAED,GAAG,MAAME,EAAc,qBAAqB,EAAE,mBAC5CJ,CACF,EAEA,MAAMQ,EAAgD,CACpD,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,aACnD,CACF,EACA,CACE,OAAQ,qBAAmB,UAC3B,OAAQL,CACV,CACF,KAEA,0BACEC,EACAI,KACA,mCAAgC,EAChC,CACE,OAAQF,EACR,QAASC,CACX,CACF,CACF,CAAC,CAAC,CACN,CAAC,CACH,CAAC,EAYD,MAAMF,CAAmE,CACvE,OACA,YAAYI,EAAyB,CACnC,KAAK,OAASA,CAChB,CACA,SAAgB,CACd,OAAO,IAAI,cAAY,CAAE,IAAK,EAAM,IAAK,EAAM,GAAI,EAAM,GAAI,CAAK,CAAC,EAChE,mBAAmB,KAAK,OAAO,WAAW,EAC1C,qBAAqB,KAAK,OAAO,WAAW,EAC5C,MAAM,CACX,CACA,eAAgB,CACd,SAAO,wBAAqB,CAAE,KAAM,CAAE,QAAS,EAAG,QAAS,SAAU,CAAE,CAAC,CAC1E,CACF",
6
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_SendCommandInAppDeviceAction", "importOriginal", "setupOpenAppDAMock", "error", "sendMyCommand", "extractDependenciesMock", "apiSendCommandMock", "commandParams", "mockedCommandResponse", "deviceAction", "TestCommand", "resolve", "reject", "expectedStates", "params"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var m=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var t=Object.prototype.hasOwnProperty;var s=(r,e,p,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d(e))!t.call(r,o)&&o!==p&&m(r,o,{get:()=>e[o],enumerable:!(n=a(e,o))||n.enumerable});return r};var C=r=>s(m({},"__esModule",{value:!0}),r);var A={};module.exports=C(A);
1
+ "use strict";var m=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var t=Object.prototype.hasOwnProperty;var s=(r,e,p,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of a(e))!t.call(r,o)&&o!==p&&m(r,o,{get:()=>e[o],enumerable:!(n=d(e,o))||n.enumerable});return r};var C=r=>s(m({},"__esModule",{value:!0}),r);var A={};module.exports=C(A);
2
2
  //# sourceMappingURL=SendCommandInAppDeviceActionTypes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.ts"],
4
- "sourcesContent": ["import { type CommandErrorResult } from \"@api/command/model/CommandResult\";\nimport {\n type OpenAppDAError,\n type OpenAppDAIntermediateValue,\n} from \"@api/device-action/os/OpenAppDeviceAction/types\";\nimport { type Command } from \"@api/types\";\n\nexport type SendCommandInAppDAOutput<CommandResponse> = CommandResponse;\n\nexport type SendCommandInAppDAInput<\n CommandResponse,\n CommandArgs,\n CommandErrorCodes,\n UserInteraction,\n> = {\n readonly command: Command<CommandResponse, CommandArgs, CommandErrorCodes>;\n readonly appName: string;\n readonly requiredUserInteraction: UserInteraction;\n readonly compatibleAppNames?: string[];\n readonly skipOpenApp?: boolean;\n};\n\nexport type SendCommandInAppDAError<CommandErrorCodes = void> =\n | OpenAppDAError\n | CommandErrorResult<CommandErrorCodes>[\"error\"];\n\nexport type SendCommandInAppDAIntermediateValue<UserInteraction> =\n | { readonly requiredUserInteraction: UserInteraction }\n | OpenAppDAIntermediateValue;\n\nexport type SendCommandInAppDAInternalState<\n CommandResponse,\n CommandErrorCodes,\n> = {\n readonly commandResponse: CommandResponse | null;\n readonly error: SendCommandInAppDAError<CommandErrorCodes> | null;\n};\n"],
4
+ "sourcesContent": ["import { type CommandErrorResult } from \"@api/command/model/CommandResult\";\nimport {\n type OpenAppDAError,\n type OpenAppDAIntermediateValue,\n} from \"@api/device-action/os/OpenAppDeviceAction/types\";\nimport { type Command } from \"@api/types\";\n\nexport type SendCommandInAppDAOutput<CommandResponse> = CommandResponse;\n\nexport type SendCommandInAppDAInput<\n CommandResponse,\n CommandArgs,\n CommandErrorCodes,\n UserInteraction,\n> = {\n readonly command: Command<CommandResponse, CommandArgs, CommandErrorCodes>;\n readonly appName: string;\n readonly skipOpenApp: boolean;\n readonly requiredUserInteraction: UserInteraction;\n};\n\nexport type SendCommandInAppDAError<CommandErrorCodes = void> =\n | OpenAppDAError\n | CommandErrorResult<CommandErrorCodes>[\"error\"];\n\nexport type SendCommandInAppDAIntermediateValue<UserInteraction> =\n | { readonly requiredUserInteraction: UserInteraction }\n | OpenAppDAIntermediateValue;\n\nexport type SendCommandInAppDAInternalState<\n CommandResponse,\n CommandErrorCodes,\n> = {\n readonly commandResponse: CommandResponse | null;\n readonly error: SendCommandInAppDAError<CommandErrorCodes> | null;\n};\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["SendCommandInAppDeviceActionTypes_exports", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var c=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var I=(r,e)=>{for(var n in e)c(r,n,{get:e[n],enumerable:!0})},y=(r,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of v(e))!g.call(r,i)&&i!==n&&c(r,i,{get:()=>e[i],enumerable:!(a=A(e,i))||a.enumerable});return r};var M=r=>y(c({},"__esModule",{value:!0}),r);var h={};I(h,{BuildAppsInstallPlanTask:()=>D});module.exports=M(h);var f=require("semver"),p=require("../../device-action/os/Errors"),u=require("../../device-session/DeviceSessionState");class D{constructor(e,n){this.api=e;this.args=n;const a=e.getDeviceModel();this.deviceModelId=a.id}deviceModelId;run(){const e=this.api.getDeviceSessionState();if(e.sessionStateType===u.DeviceSessionStateType.Connected)return{error:new p.UnknownDAError("Invalid device state")};if(e.catalog===void 0)return{error:new p.UnknownDAError("Device apps metadata not fetched")};let n=[],a=[],i=[];for(const t of this.args.applications){const o=e.catalog.applications.find(s=>s.versionName===t.name),l=e.installedApps.find(s=>s.versionName===t.name);if(l!==void 0&&this.validateConstraint(l,o,t.constraints)){a=[...a,t.name];continue}if(o!==void 0&&this.validateConstraint(o,void 0,t.constraints))n=[...n,o];else if(this.args.allowMissingApplication)i=[...i,t.name];else return o!==void 0?{error:new p.UnsupportedFirmwareDAError(`Application ${t.name} not found in the catalog`)}:{error:new p.UnknownDAError(`Application ${t.name} not found in the catalog`)}}return n=[...n.reduce((t,o)=>{const l=o.parentName;if(l){const s=e.catalog.applications.find(d=>d.versionName===l),m=e.installedApps.find(d=>d.versionName===l);if(s&&!m)return[...t,s]}return t},[]),...n],{installPlan:n.filter((t,o)=>n.findIndex(l=>l.versionName===t.versionName)===o),missingApplications:i,alreadyInstalled:a}}validateConstraint(e,n,a){if(a===void 0)return!0;for(const i of a)if(!(i.exemptModels!==void 0&&i.exemptModels.includes(this.deviceModelId))&&!(i.applicableModels!==void 0&&!i.applicableModels.includes(this.deviceModelId)))return i.minVersion==="latest"?!n||(0,f.gte)(e.version,n.version):(0,f.gte)(e.version,i.minVersion);return!0}}0&&(module.exports={BuildAppsInstallPlanTask});
2
+ //# sourceMappingURL=BuildAppsInstallPlanTask.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/device-action/task/BuildAppsInstallPlanTask.ts"],
4
+ "sourcesContent": ["import { gte } from \"semver\";\n\nimport type { DeviceModelId } from \"@api/device/DeviceModel\";\nimport type { InternalApi } from \"@api/device-action/DeviceAction\";\nimport {\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nimport type {\n ApplicationConstraint,\n ApplicationDependency,\n} from \"@api/device-action/os/InstallOrUpdateApps/types\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport type { Application } from \"@internal/manager-api/model/Application\";\n\nexport type BuildAppsInstallPlanTaskArgs = {\n /**\n * List of applications to install or update\n */\n readonly applications: ApplicationDependency[];\n\n /**\n * Indicates if the device action should fail if an application is missing from the app store.\n */\n readonly allowMissingApplication: boolean;\n};\n\nexport type BuildAppsInstallPlanTaskResult =\n | {\n installPlan: Application[];\n alreadyInstalled: string[];\n missingApplications: string[];\n }\n | {\n error: UnknownDAError | UnsupportedFirmwareDAError;\n };\n\nexport class BuildAppsInstallPlanTask {\n private readonly deviceModelId: DeviceModelId;\n\n constructor(\n private readonly api: InternalApi,\n private readonly args: BuildAppsInstallPlanTaskArgs,\n ) {\n const deviceModel = api.getDeviceModel();\n this.deviceModelId = deviceModel.id;\n }\n\n run(): BuildAppsInstallPlanTaskResult {\n // Get device session state.\n const deviceState = this.api.getDeviceSessionState();\n if (deviceState.sessionStateType === DeviceSessionStateType.Connected) {\n return { error: new UnknownDAError(\"Invalid device state\") };\n }\n\n // Ensure the device metadata were correctly fetched.\n if (deviceState.catalog === undefined) {\n return { error: new UnknownDAError(\"Device apps metadata not fetched\") };\n }\n\n // Build the install plan\n let installPlan: Application[] = [];\n let alreadyInstalled: string[] = [];\n let missingApplications: string[] = [];\n for (const app of this.args.applications) {\n // Get app entry from catalog and from installed apps\n const catalogApp = deviceState.catalog.applications.find(\n (a) => a.versionName === app.name,\n );\n const installedApp = deviceState.installedApps.find(\n (a) => a.versionName === app.name,\n );\n\n // If app is already installed, with validated constraints, continue the iteration\n if (\n installedApp !== undefined &&\n this.validateConstraint(installedApp, catalogApp, app.constraints)\n ) {\n alreadyInstalled = [...alreadyInstalled, app.name];\n continue;\n }\n\n // Handle the catalog application\n if (\n catalogApp !== undefined &&\n this.validateConstraint(catalogApp, undefined, app.constraints)\n ) {\n // Add the catalog application to the install plan\n installPlan = [...installPlan, catalogApp];\n } else if (this.args.allowMissingApplication) {\n missingApplications = [...missingApplications, app.name];\n } else {\n // Fail immediately if missing application is not allowed\n if (catalogApp !== undefined) {\n // Is application is found in the catalog in an old version,\n // it usually means the firmware is also outdated.\n return {\n error: new UnsupportedFirmwareDAError(\n `Application ${app.name} not found in the catalog`,\n ),\n };\n } else {\n return {\n error: new UnknownDAError(\n `Application ${app.name} not found in the catalog`,\n ),\n };\n }\n }\n }\n\n // Find installPlan dependencies\n const dependencies = installPlan.reduce((apps, app) => {\n const dependency = app.parentName;\n if (dependency) {\n const catalogApp = deviceState.catalog!.applications.find(\n (a) => a.versionName === dependency,\n );\n const installedApp = deviceState.installedApps.find(\n (a) => a.versionName === dependency,\n );\n if (catalogApp && !installedApp) {\n return [...apps, catalogApp];\n }\n }\n return apps;\n }, [] as Application[]);\n\n // Reorder and deduplicate the install plan with its dependencies first\n installPlan = [...dependencies, ...installPlan];\n const reorderedInstallPlan = installPlan.filter(\n (app, index) =>\n installPlan.findIndex((a) => a.versionName === app.versionName) ===\n index,\n );\n\n return {\n installPlan: reorderedInstallPlan,\n missingApplications,\n alreadyInstalled,\n };\n }\n\n private validateConstraint(\n app: Application,\n catalogApp?: Application,\n constraints?: ApplicationConstraint[],\n ): boolean {\n if (constraints === undefined) {\n // No constraint\n return true;\n }\n\n // Validate the constraint\n for (const constraint of constraints) {\n // Is current device exempt from the constraint?\n if (\n constraint.exemptModels !== undefined &&\n constraint.exemptModels.includes(this.deviceModelId)\n ) {\n continue;\n }\n\n // Is current device not applicable for the constraint?\n if (\n constraint.applicableModels !== undefined &&\n !constraint.applicableModels.includes(this.deviceModelId)\n ) {\n continue;\n }\n\n // Validate the min version\n if (constraint.minVersion === \"latest\") {\n return !catalogApp || gte(app.version, catalogApp.version);\n } else {\n return gte(app.version, constraint.minVersion);\n }\n }\n\n // No constraint for the device\n return true;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oBA,OAAAH,EAAc,CAAC,GAjBMA,EAAY,OAAO,CAACO,EAAMJ,IAAQ,CACrD,MAAMK,EAAaL,EAAI,WACvB,GAAIK,EAAY,CACd,MAAMJ,EAAaL,EAAY,QAAS,aAAa,KAClDM,GAAMA,EAAE,cAAgBG,CAC3B,EACMF,EAAeP,EAAY,cAAc,KAC5CM,GAAMA,EAAE,cAAgBG,CAC3B,EACA,GAAIJ,GAAc,CAACE,EACjB,MAAO,CAAC,GAAGC,EAAMH,CAAU,CAE/B,CACA,OAAOG,CACT,EAAG,CAAC,CAAkB,EAGU,GAAGP,CAAW,EAOvC,CACL,YAP2BA,EAAY,OACvC,CAACG,EAAKM,IACJT,EAAY,UAAWK,GAAMA,EAAE,cAAgBF,EAAI,WAAW,IAC9DM,CACJ,EAIE,oBAAAP,EACA,iBAAAD,CACF,CACF,CAEQ,mBACNE,EACAC,EACAM,EACS,CACT,GAAIA,IAAgB,OAElB,MAAO,GAIT,UAAWC,KAAcD,EAEvB,GACE,EAAAC,EAAW,eAAiB,QAC5BA,EAAW,aAAa,SAAS,KAAK,aAAa,IAOnD,EAAAA,EAAW,mBAAqB,QAChC,CAACA,EAAW,iBAAiB,SAAS,KAAK,aAAa,GAM1D,OAAIA,EAAW,aAAe,SACrB,CAACP,MAAc,OAAID,EAAI,QAASC,EAAW,OAAO,KAElD,OAAID,EAAI,QAASQ,EAAW,UAAU,EAKjD,MAAO,EACT,CACF",
6
+ "names": ["BuildAppsInstallPlanTask_exports", "__export", "BuildAppsInstallPlanTask", "__toCommonJS", "import_semver", "import_Errors", "import_DeviceSessionState", "api", "args", "deviceModel", "deviceState", "installPlan", "alreadyInstalled", "missingApplications", "app", "catalogApp", "a", "installedApp", "apps", "dependency", "index", "constraints", "constraint"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var t=require("../../device/DeviceModel"),a=require("../../device/DeviceStatus"),r=require("../../device-action/__test-utils__/makeInternalApi"),o=require("../../device-action/os/Errors"),i=require("../../device-session/DeviceSessionState"),s=require("./BuildAppsInstallPlanTask");describe("BuildAppsInstallPlanTask",()=>{const e=(0,r.makeDeviceActionInternalApiMock)();beforeEach(()=>{vi.clearAllMocks(),e.getDeviceModel.mockReturnValue({id:t.DeviceModelId.NANO_X})}),it("Success with no changes needed",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"}],catalog:{applications:[],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum"},{name:"Bitcoin"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[],alreadyInstalled:["Ethereum","Bitcoin"],missingApplications:[]})}),it("Success with no constraints",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"MyShitCoin",version:"0.0.1"},{versionName:"Cardano",version:"1.1.0"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum"},{name:"Solana"},{name:"Cardano"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Solana",version:"1.2.0"},{versionName:"Cardano",version:"1.1.0"}],alreadyInstalled:["Ethereum"],missingApplications:[]})}),it("Success with applicable constraints",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.2.0"},{versionName:"Solana",version:"1.1.0"},{versionName:"Cardano",version:"1.1.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"MyShitCoin",version:"0.0.1"},{versionName:"Cardano",version:"1.2.0"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"1.6.0",applicableModels:[t.DeviceModelId.NANO_X]}]},{name:"Bitcoin",constraints:[{minVersion:"1.2.1",exemptModels:[t.DeviceModelId.NANO_S]}]},{name:"Solana",constraints:[{minVersion:"1.2.0"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"}],alreadyInstalled:[],missingApplications:[]})}),it("Success with non-applicable constraints",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.2.0"},{versionName:"Solana",version:"1.1.0"},{versionName:"Cardano",version:"1.1.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"MyShitCoin",version:"0.0.1"},{versionName:"Cardano",version:"1.2.0"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"1.6.0",exemptModels:[t.DeviceModelId.NANO_X]}]},{name:"Bitcoin",constraints:[{minVersion:"1.2.1",applicableModels:[t.DeviceModelId.NANO_S]}]},{name:"Cardano",constraints:[{minVersion:"1.1.0"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[],alreadyInstalled:["Ethereum","Bitcoin","Cardano"],missingApplications:[]})}),it("Success with applicable constraints latest version",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.1.0"},{versionName:"MyShitCoin",version:"0.0.1"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"Cardano",version:"1.2.0"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"latest"}]},{name:"Bitcoin",constraints:[{minVersion:"latest"}]},{name:"MyShitCoin",constraints:[{minVersion:"latest"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Ethereum",version:"1.6.0"}],alreadyInstalled:["Bitcoin","MyShitCoin"],missingApplications:[]})}),it("Success with dependencies",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"AlreadyInstalledDep",version:"1.2.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0",parentName:void 0},{versionName:"Solana",version:"1.2.0",parentName:void 0},{versionName:"MyEthShitCoin",version:"0.0.1",parentName:"Ethereum"},{versionName:"MySolShitCoin",version:"0.0.1",parentName:"Solana"},{versionName:"MyPumpFunShitCoin",version:"0.0.1",parentName:"Solana"},{versionName:"Cardano",version:"1.2.0",parentName:void 0},{versionName:"AlreadyInstalledDep",version:"1.2.0",parentName:"Cardano"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"MyEthShitCoin"},{name:"MySolShitCoin"},{name:"Solana"},{name:"MyPumpFunShitCoin"},{name:"AlreadyInstalledDep"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Ethereum",version:"1.6.0",parentName:void 0},{versionName:"Solana",version:"1.2.0",parentName:void 0},{versionName:"MyEthShitCoin",version:"0.0.1",parentName:"Ethereum"},{versionName:"MySolShitCoin",version:"0.0.1",parentName:"Solana"},{versionName:"MyPumpFunShitCoin",version:"0.0.1",parentName:"Solana"}],alreadyInstalled:["AlreadyInstalledDep"],missingApplications:[]})}),it("Success with allowed missing applications",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum"},{name:"Solana"},{name:"Cardano"}],allowMissingApplication:!0}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Solana",version:"1.2.0"}],alreadyInstalled:["Ethereum"],missingApplications:["Cardano"]})}),it("Error when device is in incorrect state",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.Connected,deviceStatus:a.DeviceStatus.CONNECTED});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new o.UnknownDAError("Invalid device state")})}),it("Error when device session was not populated",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[]});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new o.UnknownDAError("Device apps metadata not fetched")})}),it("Error when an app is not found in the catalog",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[],catalog:{applications:[],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum"},{name:"Bitcoin"},{name:"Solana"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new o.UnknownDAError("Application Ethereum not found in the catalog")})}),it("Error when an app version is not found in the catalog",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:a.DeviceStatus.CONNECTED,installedApps:[],catalog:{applications:[{versionName:"Ethereum",version:"1.5.0"}],languagePackages:[]}});const n=new s.BuildAppsInstallPlanTask(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"1.6.0"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new o.UnsupportedFirmwareDAError("Application Ethereum not found in the catalog")})})});
2
+ //# sourceMappingURL=BuildAppsInstallPlanTask.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/device-action/task/BuildAppsInstallPlanTask.test.ts"],
4
+ "sourcesContent": ["import { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport {\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nimport type { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nimport type { DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport type { Application } from \"@internal/manager-api/model/Application\";\n\nimport { BuildAppsInstallPlanTask } from \"./BuildAppsInstallPlanTask\";\n\ndescribe(\"BuildAppsInstallPlanTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n vi.clearAllMocks();\n apiMock.getDeviceModel.mockReturnValue({\n id: DeviceModelId.NANO_X,\n } as unknown as TransportDeviceModel);\n });\n\n it(\"Success with no changes needed\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }, { name: \"Bitcoin\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [],\n alreadyInstalled: [\"Ethereum\", \"Bitcoin\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with no constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Solana\" },\n { name: \"Cardano\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ],\n alreadyInstalled: [\"Ethereum\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with applicable constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.2.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [\n { minVersion: \"1.6.0\", applicableModels: [DeviceModelId.NANO_X] },\n ],\n },\n {\n name: \"Bitcoin\",\n constraints: [\n { minVersion: \"1.2.1\", exemptModels: [DeviceModelId.NANO_S] },\n ],\n },\n { name: \"Solana\", constraints: [{ minVersion: \"1.2.0\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n ],\n alreadyInstalled: [],\n missingApplications: [],\n });\n });\n\n it(\"Success with non-applicable constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.2.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [\n { minVersion: \"1.6.0\", exemptModels: [DeviceModelId.NANO_X] },\n ],\n },\n {\n name: \"Bitcoin\",\n constraints: [\n { minVersion: \"1.2.1\", applicableModels: [DeviceModelId.NANO_S] },\n ],\n },\n { name: \"Cardano\", constraints: [{ minVersion: \"1.1.0\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [],\n alreadyInstalled: [\"Ethereum\", \"Bitcoin\", \"Cardano\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with applicable constraints latest version\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\", constraints: [{ minVersion: \"latest\" }] },\n { name: \"Bitcoin\", constraints: [{ minVersion: \"latest\" }] },\n { name: \"MyShitCoin\", constraints: [{ minVersion: \"latest\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [{ versionName: \"Ethereum\", version: \"1.6.0\" }],\n alreadyInstalled: [\"Bitcoin\", \"MyShitCoin\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with dependencies\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"AlreadyInstalledDep\", version: \"1.2.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\", parentName: undefined },\n { versionName: \"Solana\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"MyEthShitCoin\",\n version: \"0.0.1\",\n parentName: \"Ethereum\",\n },\n {\n versionName: \"MySolShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n {\n versionName: \"MyPumpFunShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n { versionName: \"Cardano\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"AlreadyInstalledDep\",\n version: \"1.2.0\",\n parentName: \"Cardano\",\n },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"MyEthShitCoin\" },\n { name: \"MySolShitCoin\" },\n { name: \"Solana\" },\n { name: \"MyPumpFunShitCoin\" },\n { name: \"AlreadyInstalledDep\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Ethereum\", version: \"1.6.0\", parentName: undefined },\n { versionName: \"Solana\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"MyEthShitCoin\",\n version: \"0.0.1\",\n parentName: \"Ethereum\",\n },\n {\n versionName: \"MySolShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n {\n versionName: \"MyPumpFunShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n ],\n alreadyInstalled: [\"AlreadyInstalledDep\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with allowed missing applications\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Solana\" },\n { name: \"Cardano\" },\n ],\n allowMissingApplication: true,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [{ versionName: \"Solana\", version: \"1.2.0\" }],\n alreadyInstalled: [\"Ethereum\"],\n missingApplications: [\"Cardano\"],\n });\n });\n\n it(\"Error when device is in incorrect state\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n } as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Invalid device state\"),\n });\n });\n\n it(\"Error when device session was not populated\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Device apps metadata not fetched\"),\n });\n });\n\n it(\"Error when an app is not found in the catalog\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [] as unknown as Application[],\n catalog: {\n applications: [] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Bitcoin\" },\n { name: \"Solana\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\n \"Application Ethereum not found in the catalog\",\n ),\n });\n });\n\n it(\"Error when an app version is not found in the catalog\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [{ minVersion: \"1.6.0\" }],\n },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnsupportedFirmwareDAError(\n \"Application Ethereum not found in the catalog\",\n ),\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA8B,mCAC9BC,EAA6B,oCAC7BC,EAAgD,6DAChDC,EAGO,wCAGPC,EAAuC,kDAGvCC,EAAyC,sCAEzC,SAAS,2BAA4B,IAAM,CACzC,MAAMC,KAAU,mCAAgC,EAEhD,WAAW,IAAM,CACf,GAAG,cAAc,EACjBA,EAAQ,eAAe,gBAAgB,CACrC,GAAI,gBAAc,MACpB,CAAoC,CACtC,CAAC,EAED,GAAG,iCAAkC,IAAM,CAEzCA,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CACb,CAAE,YAAa,WAAY,QAAS,OAAQ,EAC5C,CAAE,YAAa,UAAW,QAAS,OAAQ,CAC7C,EACA,QAAS,CACP,aAAc,CAAC,EACf,iBAAkB,CAAC,CACrB,CACF,CAAkC,EAGlC,MAAMC,EAAS,IAAI,2BAAyBD,EAAS,CACnD,aAAc,CAAC,CAAE,KAAM,UAAW,EAAG,CAAE,KAAM,SAAU,CAAC,EACxD,wBAAyB,EAC3B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,YAAa,CAAC,EACd,iBAAkB,CAAC,WAAY,SAAS,EACxC,oBAAqB,CAAC,CACxB,CAAC,CACH,CAAC,EAED,GAAG,8BAA+B,IAAM,CAEtCD,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CACb,CAAE,YAAa,WAAY,QAAS,OAAQ,EAC5C,CAAE,YAAa,UAAW,QAAS,OAAQ,CAC7C,EACA,QAAS,CACP,aAAc,CACZ,CAAE,YAAa,WAAY,QAAS,OAAQ,EAC5C,CAAE,YAAa,UAAW,QAAS,OA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oB,CAChD,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,QAAS,CACP,aAAc,CAAC,EACf,iBAAkB,CAAC,CACrB,CACF,CAAkC,EAGlC,MAAMC,EAAS,IAAI,2BAAyBD,EAAS,CACnD,aAAc,CACZ,CAAE,KAAM,UAAW,EACnB,CAAE,KAAM,SAAU,EAClB,CAAE,KAAM,QAAS,CACnB,EACA,wBAAyB,EAC3B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,MAAO,IAAI,iBACT,+CACF,CACF,CAAC,CACH,CAAC,EAED,GAAG,wDAAyD,IAAM,CAEhED,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,QAAS,CACP,aAAc,CACZ,CAAE,YAAa,WAAY,QAAS,OAAQ,CAC9C,EACA,iBAAkB,CAAC,CACrB,CACF,CAAkC,EAGlC,MAAMC,EAAS,IAAI,2BAAyBD,EAAS,CACnD,aAAc,CACZ,CACE,KAAM,WACN,YAAa,CAAC,CAAE,WAAY,OAAQ,CAAC,CACvC,CACF,EACA,wBAAyB,EAC3B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,MAAO,IAAI,6BACT,+CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_DeviceModel", "import_DeviceStatus", "import_makeInternalApi", "import_Errors", "import_DeviceSessionState", "import_BuildAppsInstallPlanTask", "apiMock", "result"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var f=(t,e)=>{for(var o in e)a(t,o,{get:e[o],enumerable:!0})},b=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of y(e))!k.call(t,s)&&s!==o&&a(t,s,{get:()=>e[s],enumerable:!(r=u(e,s))||r.enumerable});return t};var B=t=>b(a({},"__esModule",{value:!0}),t);var v={};f(v,{PredictOutOfMemoryTask:()=>g});module.exports=B(v);var c=require("../../device-action/os/Errors"),l=require("../../device-session/DeviceSessionState");class g{constructor(e,o){this.api=e;this.args=o;const r=e.getDeviceModel();this.blockSize=r.blockSize,this.memoryBlocks=Math.floor(r.memorySize/this.blockSize)}blockSize;memoryBlocks;run(){const e=this.api.getDeviceSessionState();if(e.sessionStateType===l.DeviceSessionStateType.Connected)return{error:new c.UnknownDAError("Invalid device state")};if(e.firmwareUpdateContext===void 0||e.customImage===void 0||e.installedLanguages===void 0)return{error:new c.UnknownDAError("Device metadata not fetched")};const o=this.bytesToBlocks(e.firmwareUpdateContext.currentFirmware.bytes||0),r=this.bytesToBlocks(e.customImage.size||0),s=e.installedApps.reduce((i,n)=>i+this.bytesToBlocks(n.bytes||0),0),m=e.installedLanguages.reduce((i,n)=>i+this.bytesToBlocks(n.size),0),d=o+r+s+m,p=this.memoryBlocks-d;return{outOfMemory:this.args.installPlan.reduce((i,n)=>i+this.bytesToBlocks(n.bytes||0),0)>p}}bytesToBlocks(e){return Math.ceil(e/this.blockSize)}}0&&(module.exports={PredictOutOfMemoryTask});
2
+ //# sourceMappingURL=PredictOutOfMemoryTask.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/device-action/task/PredictOutOfMemoryTask.ts"],
4
+ "sourcesContent": ["import type { InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport type { Application } from \"@internal/manager-api/model/Application\";\n\nexport type PredictOutOfMemoryTaskArgs = {\n installPlan: Application[];\n};\n\nexport type PredictOutOfMemoryTaskResult =\n | {\n outOfMemory: boolean;\n }\n | {\n error: UnknownDAError;\n };\n\nexport class PredictOutOfMemoryTask {\n private readonly blockSize: number;\n private readonly memoryBlocks: number;\n\n constructor(\n private readonly api: InternalApi,\n private readonly args: PredictOutOfMemoryTaskArgs,\n ) {\n const deviceModel = api.getDeviceModel();\n this.blockSize = deviceModel.blockSize;\n this.memoryBlocks = Math.floor(deviceModel.memorySize / this.blockSize);\n }\n\n run(): PredictOutOfMemoryTaskResult {\n // Get device session state.\n const deviceState = this.api.getDeviceSessionState();\n if (deviceState.sessionStateType === DeviceSessionStateType.Connected) {\n return { error: new UnknownDAError(\"Invalid device state\") };\n }\n\n // Ensure the device metadata were correctly fetched.\n if (\n deviceState.firmwareUpdateContext === undefined ||\n deviceState.customImage === undefined ||\n deviceState.installedLanguages === undefined\n ) {\n return { error: new UnknownDAError(\"Device metadata not fetched\") };\n }\n\n // Compute device memory layout\n const firmwareBlocks = this.bytesToBlocks(\n deviceState.firmwareUpdateContext.currentFirmware.bytes || 0,\n );\n const customImageBlocks = this.bytesToBlocks(\n deviceState.customImage.size || 0,\n );\n const applicationsBlocks = deviceState.installedApps.reduce(\n (size, app) => size + this.bytesToBlocks(app.bytes || 0),\n 0,\n );\n const languagesBlocks = deviceState.installedLanguages.reduce(\n (size, lang) => size + this.bytesToBlocks(lang.size),\n 0,\n );\n const usedBlocks =\n firmwareBlocks + customImageBlocks + applicationsBlocks + languagesBlocks;\n const availableBlocks = this.memoryBlocks - usedBlocks;\n\n // Compute install plan memory consumption\n const installPlanBlocks = this.args.installPlan.reduce(\n (size, app) => size + this.bytesToBlocks(app.bytes || 0),\n 0,\n );\n return { outOfMemory: installPlanBlocks > availableBlocks };\n }\n\n private bytesToBlocks(size: number) {\n return Math.ceil(size / this.blockSize);\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAA+B,wCAC/BC,EAAuC,kDAehC,MAAMH,CAAuB,CAIlC,YACmBI,EACAC,EACjB,CAFiB,SAAAD,EACA,UAAAC,EAEjB,MAAMC,EAAcF,EAAI,eAAe,EACvC,KAAK,UAAYE,EAAY,UAC7B,KAAK,aAAe,KAAK,MAAMA,EAAY,WAAa,KAAK,SAAS,CACxE,CAViB,UACA,aAWjB,KAAoC,CAElC,MAAMC,EAAc,KAAK,IAAI,sBAAsB,EACnD,GAAIA,EAAY,mBAAqB,yBAAuB,UAC1D,MAAO,CAAE,MAAO,IAAI,iBAAe,sBAAsB,CAAE,EAI7D,GACEA,EAAY,wBAA0B,QACtCA,EAAY,cAAgB,QAC5BA,EAAY,qBAAuB,OAEnC,MAAO,CAAE,MAAO,IAAI,iBAAe,6BAA6B,CAAE,EAIpE,MAAMC,EAAiB,KAAK,cAC1BD,EAAY,sBAAsB,gBAAgB,OAAS,CAC7D,EACME,EAAoB,KAAK,cAC7BF,EAAY,YAAY,MAAQ,CAClC,EACMG,EAAqBH,EAAY,cAAc,OACnD,CAACI,EAAMC,IAAQD,EAAO,KAAK,cAAcC,EAAI,OAAS,CAAC,EACvD,CACF,EACMC,EAAkBN,EAAY,mBAAmB,OACrD,CAACI,EAAMG,IAASH,EAAO,KAAK,cAAcG,EAAK,IAAI,EACnD,CACF,EACMC,EACJP,EAAiBC,EAAoBC,EAAqBG,EACtDG,EAAkB,KAAK,aAAeD,EAO5C,MAAO,CAAE,YAJiB,KAAK,KAAK,YAAY,OAC9C,CAACJ,EAAMC,IAAQD,EAAO,KAAK,cAAcC,EAAI,OAAS,CAAC,EACvD,CACF,EAC0CI,CAAgB,CAC5D,CAEQ,cAAcL,EAAc,CAClC,OAAO,KAAK,KAAKA,EAAO,KAAK,SAAS,CACxC,CACF",
6
+ "names": ["PredictOutOfMemoryTask_exports", "__export", "PredictOutOfMemoryTask", "__toCommonJS", "import_Errors", "import_DeviceSessionState", "api", "args", "deviceModel", "deviceState", "firmwareBlocks", "customImageBlocks", "applicationsBlocks", "size", "app", "languagesBlocks", "lang", "usedBlocks", "availableBlocks"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=require("../../device/DeviceStatus"),o=require("../../device-action/__test-utils__/makeInternalApi"),i=require("../../device-action/os/Errors"),s=require("../../device-session/DeviceSessionState"),a=require("./PredictOutOfMemoryTask");describe("PredictOutOfMemoryTask",()=>{const e=(0,o.makeDeviceActionInternalApiMock)();beforeEach(()=>{vi.clearAllMocks(),e.getDeviceModel.mockReturnValue({memorySize:1569792,blockSize:32})}),it("Success enough memory",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:n.DeviceStatus.CONNECTED,firmwareUpdateContext:{currentFirmware:{bytes:397824}},customImage:{size:51893},installedApps:[{bytes:305442},{bytes:514598},{bytes:271583}],installedLanguages:[{id:1,size:20480}]});const t=new a.PredictOutOfMemoryTask(e,{installPlan:[{bytes:1324},{bytes:6559}]}).run();expect(t).toStrictEqual({outOfMemory:!1})}),it("Success not enough memory",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:n.DeviceStatus.CONNECTED,firmwareUpdateContext:{currentFirmware:{bytes:397824}},customImage:{size:51893},installedApps:[{bytes:305442},{bytes:514598},{bytes:271583}],installedLanguages:[{id:1,size:20480}]});const t=new a.PredictOutOfMemoryTask(e,{installPlan:[{bytes:1324},{bytes:6559},{bytes:1}]}).run();expect(t).toStrictEqual({outOfMemory:!0})}),it("Success undefined sizes",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:n.DeviceStatus.CONNECTED,firmwareUpdateContext:{currentFirmware:{bytes:397824}},customImage:{},installedApps:[{bytes:305442},{bytes:null},{bytes:271583}],installedLanguages:[]});const t=new a.PredictOutOfMemoryTask(e,{installPlan:[{bytes:1324},{bytes:6559}]}).run();expect(t).toStrictEqual({outOfMemory:!1})}),it("Error when device is in incorrect state",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:s.DeviceSessionStateType.Connected,deviceStatus:n.DeviceStatus.CONNECTED});const t=new a.PredictOutOfMemoryTask(e,{installPlan:[{bytes:1324}]}).run();expect(t).toStrictEqual({error:new i.UnknownDAError("Invalid device state")})}),it("Error when device session was not populated",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:s.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:n.DeviceStatus.CONNECTED,installedApps:[]});const t=new a.PredictOutOfMemoryTask(e,{installPlan:[{bytes:1324}]}).run();expect(t).toStrictEqual({error:new i.UnknownDAError("Device metadata not fetched")})})});
2
+ //# sourceMappingURL=PredictOutOfMemoryTask.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/device-action/task/PredictOutOfMemoryTask.test.ts"],
4
+ "sourcesContent": ["import { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport type { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nimport type { DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport type { Application } from \"@internal/manager-api/model/Application\";\nimport type { FinalFirmware } from \"@internal/manager-api/model/Firmware\";\n\nimport { PredictOutOfMemoryTask } from \"./PredictOutOfMemoryTask\";\n\ndescribe(\"PredictOutOfMemoryTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n vi.clearAllMocks();\n apiMock.getDeviceModel.mockReturnValue({\n memorySize: 1569792,\n blockSize: 32,\n } as unknown as TransportDeviceModel);\n });\n\n it(\"Success enough memory\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n firmwareUpdateContext: {\n currentFirmware: { bytes: 397824 } as FinalFirmware,\n },\n customImage: { size: 51893 },\n installedApps: [\n { bytes: 305442 },\n { bytes: 514598 },\n { bytes: 271583 },\n ] as unknown as Application[],\n installedLanguages: [{ id: 1, size: 20480 }],\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new PredictOutOfMemoryTask(apiMock, {\n installPlan: [\n { bytes: 1324 },\n { bytes: 6559 },\n ] as unknown as Application[],\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n outOfMemory: false,\n });\n });\n\n it(\"Success not enough memory\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n firmwareUpdateContext: {\n currentFirmware: { bytes: 397824 } as FinalFirmware,\n },\n customImage: { size: 51893 },\n installedApps: [\n { bytes: 305442 },\n { bytes: 514598 },\n { bytes: 271583 },\n ] as unknown as Application[],\n installedLanguages: [{ id: 1, size: 20480 }],\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new PredictOutOfMemoryTask(apiMock, {\n installPlan: [\n { bytes: 1324 },\n { bytes: 6559 },\n { bytes: 1 },\n ] as unknown as Application[],\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n outOfMemory: true,\n });\n });\n\n it(\"Success undefined sizes\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n firmwareUpdateContext: {\n currentFirmware: { bytes: 397824 } as FinalFirmware,\n },\n customImage: {},\n installedApps: [\n { bytes: 305442 },\n { bytes: null },\n { bytes: 271583 },\n ] as unknown as Application[],\n installedLanguages: [],\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new PredictOutOfMemoryTask(apiMock, {\n installPlan: [\n { bytes: 1324 },\n { bytes: 6559 },\n ] as unknown as Application[],\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n outOfMemory: false,\n });\n });\n\n it(\"Error when device is in incorrect state\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n } as DeviceSessionState);\n\n // WHEN\n const result = new PredictOutOfMemoryTask(apiMock, {\n installPlan: [{ bytes: 1324 }] as unknown as Application[],\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Invalid device state\"),\n });\n });\n\n it(\"Error when device session was not populated\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new PredictOutOfMemoryTask(apiMock, {\n installPlan: [{ bytes: 1324 }] as unknown as Application[],\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Device metadata not fetched\"),\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA6B,oCAC7BC,EAAgD,6DAChDC,EAA+B,wCAG/BC,EAAuC,kDAIvCC,EAAuC,oCAEvC,SAAS,yBAA0B,IAAM,CACvC,MAAMC,KAAU,mCAAgC,EAEhD,WAAW,IAAM,CACf,GAAG,cAAc,EACjBA,EAAQ,eAAe,gBAAgB,CACrC,WAAY,QACZ,UAAW,EACb,CAAoC,CACtC,CAAC,EAED,GAAG,wBAAyB,IAAM,CAEhCA,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,sBAAuB,CACrB,gBAAiB,CAAE,MAAO,MAAO,CACnC,EACA,YAAa,CAAE,KAAM,KAAM,EAC3B,cAAe,CACb,CAAE,MAAO,MAAO,EAChB,CAAE,MAAO,MAAO,EAChB,CAAE,MAAO,MAAO,CAClB,EACA,mBAAoB,CAAC,CAAE,GAAI,EAAG,KAAM,KA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B,YAAa,EACf,CAAC,CACH,CAAC,EAED,GAAG,0CAA2C,IAAM,CAElDD,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkB,yBAAuB,UACzC,aAAc,eAAa,SAC7B,CAAuB,EAGvB,MAAMC,EAAS,IAAI,yBAAuBD,EAAS,CACjD,YAAa,CAAC,CAAE,MAAO,IAAK,CAAC,CAC/B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,MAAO,IAAI,iBAAe,sBAAsB,CAClD,CAAC,CACH,CAAC,EAED,GAAG,8CAA+C,IAAM,CAEtDD,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,CAClB,CAAkC,EAGlC,MAAMC,EAAS,IAAI,yBAAuBD,EAAS,CACjD,YAAa,CAAC,CAAE,MAAO,IAAK,CAAC,CAC/B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,MAAO,IAAI,iBAAe,6BAA6B,CACzD,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_DeviceStatus", "import_makeInternalApi", "import_Errors", "import_DeviceSessionState", "import_PredictOutOfMemoryTask", "apiMock", "result"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var x=(n,e)=>{for(var r in e)s(n,r,{get:e[r],enumerable:!0})},D=(n,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of v(e))!A.call(n,t)&&t!==r&&s(n,t,{get:()=>e[t],enumerable:!(a=b(e,t))||a.enumerable});return n};var E=n=>D(s({},"__esModule",{value:!0}),n);var V={};x(V,{XStateDeviceAction:()=>M});module.exports=E(V);var i=require("rxjs"),d=require("xstate"),o=require("../../device-action/model/DeviceActionState");class M{input;inspect=!1;constructor(e){this.input=e.input,this.inspect=!!e.inspect}_execute(e){const r=this.makeStateMachine(e),a=(0,d.createActor)(r,{input:this.input}),t=new i.ReplaySubject,l=c=>{const{context:u,status:h,output:I,error:y}=c;switch(h){case"active":t.next({status:o.DeviceActionStatus.Pending,intermediateValue:u.intermediateValue});break;case"done":I.caseOf({Left:p=>{t.next({status:o.DeviceActionStatus.Error,error:p})},Right:p=>{t.next({status:o.DeviceActionStatus.Completed,output:p})}}),t.complete();break;case"error":t.error(y),t.complete();break;case"stopped":t.next({status:o.DeviceActionStatus.Stopped}),t.complete();break;default:this._exhaustiveMatchingGuard(h)}},S=new i.Observable(c=>{const u=t.subscribe(c);return()=>{m.unsubscribe(),u.unsubscribe(),a.stop()}}),m=a.subscribe(l);return a.start(),{observable:S.pipe((0,i.share)()),cancel:()=>{a.stop(),m.unsubscribe(),l(a.getSnapshot())}}}_exhaustiveMatchingGuard(e){throw console.log("_exhaustiveMatchingGuard status",e),new Error(`Unhandled status: ${e}`)}}0&&(module.exports={XStateDeviceAction});
1
+ "use strict";var s=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var A=(a,e)=>{for(var t in e)s(a,t,{get:e[t],enumerable:!0})},E=(a,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!v.call(a,r)&&r!==t&&s(a,r,{get:()=>e[r],enumerable:!(n=b(e,r))||n.enumerable});return a};var x=a=>E(s({},"__esModule",{value:!0}),a);var M={};A(M,{XStateDeviceAction:()=>D});module.exports=x(M);var i=require("rxjs"),h=require("xstate"),c=require("../../device-action/model/DeviceActionState");class D{input;inspect=!1;constructor(e){this.input=e.input,this.inspect=!!e.inspect}_execute(e){const t=this.makeStateMachine(e);return this._subscribeToStateMachine(t)}_subscribeToStateMachine(e){const t=(0,h.createActor)(e,{input:this.input}),n=new i.ReplaySubject,r=o=>{const{context:u,status:m,output:S,error:I}=o;switch(m){case"active":n.next({status:c.DeviceActionStatus.Pending,intermediateValue:u.intermediateValue});break;case"done":S.caseOf({Left:p=>{n.next({status:c.DeviceActionStatus.Error,error:p})},Right:p=>{n.next({status:c.DeviceActionStatus.Completed,output:p})}}),n.complete();break;case"error":n.error(I),n.complete();break;case"stopped":n.next({status:c.DeviceActionStatus.Stopped}),n.complete();break;default:this._exhaustiveMatchingGuard(m)}},d=new i.Observable(o=>{const u=n.subscribe(o);return()=>{l.unsubscribe(),u.unsubscribe(),t.stop()}}),l=t.subscribe(r);return t.start(),{observable:d.pipe((0,i.share)()),cancel:()=>{t.stop(),l.unsubscribe(),r(t.getSnapshot())}}}_exhaustiveMatchingGuard(e){throw console.log("_exhaustiveMatchingGuard status",e),new Error(`Unhandled status: ${e}`)}}0&&(module.exports={XStateDeviceAction});
2
2
  //# sourceMappingURL=XStateDeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/xstate-utils/XStateDeviceAction.ts"],
4
- "sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { Observable, ReplaySubject, share } from \"rxjs\";\nimport {\n createActor,\n type SnapshotFrom,\n type StateMachine,\n type StateSchema,\n} from \"xstate\";\n\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\nimport { type StateMachineTypes } from \"./StateMachineTypes\";\n\nexport type DeviceActionStateMachine<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> = StateMachine<\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"context\"], // context\n /**\n * The following usages `any` are OK because this is just a wrapper around the\n * state machine and we are not directly going to use these types.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any, // event\n any, // children\n any, // actor\n any, // action\n any, // guard\n any, // delay\n any, // state value\n any, // tag\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"input\"],\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"output\"],\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any,\n any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateSchema\n>;\n\n/**\n * A DeviceAction that uses an XState state machine to execute.\n * It maps the state machine snapshots to the DeviceActionState.\n * This class is abstract and should be extended to implement the state machine.\n */\nexport abstract class XStateDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> implements DeviceAction<Output, Input, Error, IntermediateValue>\n{\n readonly input: Input;\n readonly inspect: boolean = false;\n\n /**\n *\n * @param input The input for the DeviceAction\n * @param inspect If true, the state machine will be inspected in the browser\n */\n constructor(args: { input: Input; inspect?: boolean }) {\n this.input = args.input;\n this.inspect = Boolean(args.inspect);\n }\n\n protected abstract makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >;\n\n _execute(\n internalApi: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const stateMachine = this.makeStateMachine(internalApi);\n\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n // inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n private _exhaustiveMatchingGuard(status: never): never {\n console.log(\"_exhaustiveMatchingGuard status\", status);\n throw new Error(`Unhandled status: ${status}`);\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAiD,gBACjDC,EAKO,kBAQPC,EAGO,sDA2DA,MAAeJ,CAOtB,CACW,MACA,QAAmB,GAO5B,YAAYK,EAA2C,CACrD,KAAK,MAAQA,EAAK,MAClB,KAAK,QAAU,EAAQA,EAAK,OAC9B,CAYA,SACEC,EACiE,CACjE,MAAMC,EAAe,KAAK,iBAAiBD,CAAW,EAEhDE,KAAQ,eAAYD,EAAc,CACtC,MAAO,KAAK,KAGd,CAAC,EAQKE,EAAU,IAAI,gBAIdC,EACJC,GACG,CACH,KAAM,CAAE,QAAAC,EAAS,OAAAC,EAAQ,OAAAC,EAAQ,MAAAC,CAAM,EAAIJ,EAC3C,OAAQE,EAAQ,CACd,IAAK,SACHJ,EAAQ,KAAK,CACX,OAAQ,qBAAmB,QAC3B,kBAAmBG,EAAQ,iBAC7B,CAAC,EACD,MACF,IAAK,OACHE,EAAO,OAAO,CACZ,KAAOE,GAAQ,CACbP,EAAQ,KAAK,CACX,OAAQ,qBAAmB,MAC3B,MAAOO,CACT,CAAC,CACH,EACA,MAAQC,GAAW,CACjBR,EAAQ,KAAK,CACX,OAAQ,qBAAmB,UAC3B,OAAQQ,CACV,CAAC,CACH,CACF,CAAC,EACDR,EAAQ,SAAS,EACjB,MACF,IAAK,QAEHA,EAAQ,MAAMM,CAAK,EACnBN,EAAQ,SAAS,EACjB,MACF,IAAK,UACHA,EAAQ,KAAK,CACX,OAAQ,qBAAmB,OAC7B,CAAC,EACDA,EAAQ,SAAS,EACjB,MACF,QACE,KAAK,yBAAyBI,CAAM,CACxC,CACF,EAEMK,EAAa,IAAI,aAEpBC,GAAe,CAChB,MAAMC,EAAsBX,EAAQ,UAAUU,CAAU,EACxD,MAAO,IAAM,CACXE,EAAkB,YAAY,EAC9BD,EAAoB,YAAY,EAChCZ,EAAM,KAAK,CACb,CACF,CAAC,EAEKa,EAAoBb,EAAM,UAAUE,CAAmB,EAC7D,OAAAF,EAAM,MAAM,EAEL,CACL,WAAYU,EAAW,QAAK,SAAM,CAAC,EACnC,OAAQ,IAAM,CACZV,EAAM,KAAK,EACXa,EAAkB,YAAY,EAC9BX,EAAoBF,EAAM,YAAY,CAAC,CACzC,CACF,CACF,CAEQ,yBAAyBK,EAAsB,CACrD,cAAQ,IAAI,kCAAmCA,CAAM,EAC/C,IAAI,MAAM,qBAAqBA,CAAM,EAAE,CAC/C,CACF",
4
+ "sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { Observable, ReplaySubject, share } from \"rxjs\";\nimport {\n createActor,\n type SnapshotFrom,\n type StateMachine,\n type StateSchema,\n} from \"xstate\";\n\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\nimport { type StateMachineTypes } from \"./StateMachineTypes\";\n\nexport type DeviceActionStateMachine<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> = StateMachine<\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"context\"], // context\n /**\n * The following usages `any` are OK because this is just a wrapper around the\n * state machine and we are not directly going to use these types.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any, // event\n any, // children\n any, // actor\n any, // action\n any, // guard\n any, // delay\n any, // state value\n any, // tag\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"input\"],\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"output\"],\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any,\n any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateSchema\n>;\n\n/**\n * A DeviceAction that uses an XState state machine to execute.\n * It maps the state machine snapshots to the DeviceActionState.\n * This class is abstract and should be extended to implement the state machine.\n */\nexport abstract class XStateDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> implements DeviceAction<Output, Input, Error, IntermediateValue>\n{\n readonly input: Input;\n readonly inspect: boolean = false;\n\n /**\n *\n * @param input The input for the DeviceAction\n * @param inspect If true, the state machine will be inspected in the browser\n */\n constructor(args: { input: Input; inspect?: boolean }) {\n this.input = args.input;\n this.inspect = Boolean(args.inspect);\n }\n\n protected abstract makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >;\n\n _execute(\n internalApi: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const stateMachine = this.makeStateMachine(internalApi);\n return this._subscribeToStateMachine(stateMachine);\n }\n\n protected _subscribeToStateMachine(\n stateMachine: DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n // inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n private _exhaustiveMatchingGuard(status: never): never {\n console.log(\"_exhaustiveMatchingGuard status\", status);\n throw new Error(`Unhandled status: ${status}`);\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAiD,gBACjDC,EAKO,kBAQPC,EAGO,sDA2DA,MAAeJ,CAOtB,CACW,MACA,QAAmB,GAO5B,YAAYK,EAA2C,CACrD,KAAK,MAAQA,EAAK,MAClB,KAAK,QAAU,EAAQA,EAAK,OAC9B,CAYA,SACEC,EACiE,CACjE,MAAMC,EAAe,KAAK,iBAAiBD,CAAW,EACtD,OAAO,KAAK,yBAAyBC,CAAY,CACnD,CAEU,yBACRA,EAOiE,CACjE,MAAMC,KAAQ,eAAYD,EAAc,CACtC,MAAO,KAAK,KAGd,CAAC,EAQKE,EAAU,IAAI,gBAIdC,EACJC,GACG,CACH,KAAM,CAAE,QAAAC,EAAS,OAAAC,EAAQ,OAAAC,EAAQ,MAAAC,CAAM,EAAIJ,EAC3C,OAAQE,EAAQ,CACd,IAAK,SACHJ,EAAQ,KAAK,CACX,OAAQ,qBAAmB,QAC3B,kBAAmBG,EAAQ,iBAC7B,CAAC,EACD,MACF,IAAK,OACHE,EAAO,OAAO,CACZ,KAAOE,GAAQ,CACbP,EAAQ,KAAK,CACX,OAAQ,qBAAmB,MAC3B,MAAOO,CACT,CAAC,CACH,EACA,MAAQC,GAAW,CACjBR,EAAQ,KAAK,CACX,OAAQ,qBAAmB,UAC3B,OAAQQ,CACV,CAAC,CACH,CACF,CAAC,EACDR,EAAQ,SAAS,EACjB,MACF,IAAK,QAEHA,EAAQ,MAAMM,CAAK,EACnBN,EAAQ,SAAS,EACjB,MACF,IAAK,UACHA,EAAQ,KAAK,CACX,OAAQ,qBAAmB,OAC7B,CAAC,EACDA,EAAQ,SAAS,EACjB,MACF,QACE,KAAK,yBAAyBI,CAAM,CACxC,CACF,EAEMK,EAAa,IAAI,aAEpBC,GAAe,CAChB,MAAMC,EAAsBX,EAAQ,UAAUU,CAAU,EACxD,MAAO,IAAM,CACXE,EAAkB,YAAY,EAC9BD,EAAoB,YAAY,EAChCZ,EAAM,KAAK,CACb,CACF,CAAC,EAEKa,EAAoBb,EAAM,UAAUE,CAAmB,EAC7D,OAAAF,EAAM,MAAM,EAEL,CACL,WAAYU,EAAW,QAAK,SAAM,CAAC,EACnC,OAAQ,IAAM,CACZV,EAAM,KAAK,EACXa,EAAkB,YAAY,EAC9BX,EAAoBF,EAAM,YAAY,CAAC,CACzC,CACF,CACF,CAEQ,yBAAyBK,EAAsB,CACrD,cAAQ,IAAI,kCAAmCA,CAAM,EAC/C,IAAI,MAAM,qBAAqBA,CAAM,EAAE,CAC/C,CACF",
6
6
  "names": ["XStateDeviceAction_exports", "__export", "XStateDeviceAction", "__toCommonJS", "import_rxjs", "import_xstate", "import_DeviceActionState", "args", "internalApi", "stateMachine", "actor", "subject", "handleActorSnapshot", "snapshot", "context", "status", "output", "error", "err", "result", "observable", "subscriber", "subjectSubscription", "actorSubscription"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var y=(o,e,d)=>e in o?l(o,e,{enumerable:!0,configurable:!0,writable:!0,value:d}):o[e]=d;var N=(o,e)=>{for(var d in e)l(o,d,{get:e[d],enumerable:!0})},a=(o,e,d,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of I(e))!U.call(o,r)&&r!==d&&l(o,r,{get:()=>e[r],enumerable:!(i=m(e,r))||i.enumerable});return o};var x=o=>a(l({},"__esModule",{value:!0}),o),v=(o,e,d,i)=>{for(var r=i>1?void 0:i?m(e,d):e,u=o.length-1,n;u>=0;u--)(n=o[u])&&(r=(i?n(e,d,r):n(r))||r);return i&&r&&l(e,d,r),r};var b=(o,e,d)=>y(o,typeof e!="symbol"?e+"":e,d);var O={};N(O,{StaticDeviceModelDataSource:()=>t});module.exports=x(O);var f=require("inversify"),s=require("../../device/DeviceModel"),p=require("../../device-model/model/BleDeviceInfos"),c=require("../../device-model/model/DeviceModel");let t=class{getAllDeviceModels(){return Object.values(t.deviceModelByIds)}getDeviceModel(e){return t.deviceModelByIds[e.id]}filterDeviceModels(e){return this.getAllDeviceModels().filter(d=>Object.entries(e).every(([i,r])=>d[i]===r))}getBluetoothServicesInfos(){return Object.values(t.deviceModelByIds).reduce((e,d)=>{const{bluetoothSpec:i}=d;return i?{...e,...i.reduce((r,u)=>({...r,[u.serviceUuid]:new p.BleDeviceInfos(d,u.serviceUuid,u.writeUuid,u.writeCmdUuid,u.notifyUuid)}),{})}:e},{})}getBluetoothServices(){return Object.values(t.deviceModelByIds).map(e=>(e.bluetoothSpec||[]).map(d=>d.serviceUuid)).flat().filter(e=>!!e)}};b(t,"deviceModelByIds",{[s.DeviceModelId.NANO_S]:new c.TransportDeviceModel({id:s.DeviceModelId.NANO_S,productName:"Ledger Nano S",usbProductId:16,bootloaderUsbProductId:1,usbOnly:!0,memorySize:320*1024,masks:[823132160]}),[s.DeviceModelId.NANO_SP]:new c.TransportDeviceModel({id:s.DeviceModelId.NANO_SP,productName:"Ledger Nano S Plus",usbProductId:80,bootloaderUsbProductId:5,usbOnly:!0,memorySize:1533*1024,masks:[856686592]}),[s.DeviceModelId.NANO_X]:new c.TransportDeviceModel({id:s.DeviceModelId.NANO_X,productName:"Ledger Nano X",usbProductId:64,bootloaderUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,masks:[855638016],bluetoothSpec:[{serviceUuid:"13d63400-2c97-0004-0000-4c6564676572",notifyUuid:"13d63400-2c97-0004-0001-4c6564676572",writeUuid:"13d63400-2c97-0004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-0004-0003-4c6564676572"}]}),[s.DeviceModelId.STAX]:new c.TransportDeviceModel({id:s.DeviceModelId.STAX,productName:"Ledger Stax",usbProductId:96,bootloaderUsbProductId:6,usbOnly:!1,memorySize:1533*1024,masks:[857735168],bluetoothSpec:[{serviceUuid:"13d63400-2c97-6004-0000-4c6564676572",notifyUuid:"13d63400-2c97-6004-0001-4c6564676572",writeUuid:"13d63400-2c97-6004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-6004-0003-4c6564676572"}]}),[s.DeviceModelId.FLEX]:new c.TransportDeviceModel({id:s.DeviceModelId.FLEX,productName:"Ledger Flex",usbProductId:112,bootloaderUsbProductId:7,usbOnly:!1,memorySize:1533*1024,masks:[858783744],bluetoothSpec:[{serviceUuid:"13d63400-2c97-3004-0000-4c6564676572",notifyUuid:"13d63400-2c97-3004-0001-4c6564676572",writeUuid:"13d63400-2c97-3004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-3004-0003-4c6564676572"}]})}),t=v([(0,f.injectable)()],t);0&&(module.exports={StaticDeviceModelDataSource});
1
+ "use strict";var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var I=(o,e,d)=>e in o?l(o,e,{enumerable:!0,configurable:!0,writable:!0,value:d}):o[e]=d;var a=(o,e)=>{for(var d in e)l(o,d,{get:e[d],enumerable:!0})},x=(o,e,d,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!y.call(o,r)&&r!==d&&l(o,r,{get:()=>e[r],enumerable:!(t=m(e,r))||t.enumerable});return o};var N=o=>x(l({},"__esModule",{value:!0}),o),b=(o,e,d,t)=>{for(var r=t>1?void 0:t?m(e,d):e,c=o.length-1,n;c>=0;c--)(n=o[c])&&(r=(t?n(e,d,r):n(r))||r);return t&&r&&l(e,d,r),r};var v=(o,e,d)=>I(o,typeof e!="symbol"?e+"":e,d);var P={};a(P,{StaticDeviceModelDataSource:()=>s});module.exports=N(P);var U=require("inversify"),i=require("../../device/DeviceModel"),p=require("../../device-model/model/BleDeviceInfos"),u=require("../../device-model/model/DeviceModel");let s=class{getAllDeviceModels(){return Object.values(s.deviceModelByIds)}getDeviceModel(e){return s.deviceModelByIds[e.id]}filterDeviceModels(e){return this.getAllDeviceModels().filter(d=>Object.entries(e).every(([t,r])=>d[t]===r))}getBluetoothServicesInfos(){return Object.values(s.deviceModelByIds).reduce((e,d)=>{const{bluetoothSpec:t}=d;return t?{...e,...t.reduce((r,c)=>({...r,[c.serviceUuid]:new p.BleDeviceInfos(d,c.serviceUuid,c.writeUuid,c.writeCmdUuid,c.notifyUuid)}),{})}:e},{})}getBluetoothServices(){return Object.values(s.deviceModelByIds).map(e=>(e.bluetoothSpec||[]).map(d=>d.serviceUuid)).flat().filter(e=>!!e)}};v(s,"deviceModelByIds",{[i.DeviceModelId.NANO_S]:new u.TransportDeviceModel({id:i.DeviceModelId.NANO_S,productName:"Ledger Nano S",usbProductId:16,bootloaderUsbProductId:1,usbOnly:!0,memorySize:320*1024,blockSize:4*1024,masks:[823132160]}),[i.DeviceModelId.NANO_SP]:new u.TransportDeviceModel({id:i.DeviceModelId.NANO_SP,productName:"Ledger Nano S Plus",usbProductId:80,bootloaderUsbProductId:5,usbOnly:!0,memorySize:1533*1024,blockSize:32,masks:[856686592]}),[i.DeviceModelId.NANO_X]:new u.TransportDeviceModel({id:i.DeviceModelId.NANO_X,productName:"Ledger Nano X",usbProductId:64,bootloaderUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,blockSize:4*1024,masks:[855638016],bluetoothSpec:[{serviceUuid:"13d63400-2c97-0004-0000-4c6564676572",notifyUuid:"13d63400-2c97-0004-0001-4c6564676572",writeUuid:"13d63400-2c97-0004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-0004-0003-4c6564676572"}]}),[i.DeviceModelId.STAX]:new u.TransportDeviceModel({id:i.DeviceModelId.STAX,productName:"Ledger Stax",usbProductId:96,bootloaderUsbProductId:6,usbOnly:!1,memorySize:1533*1024,blockSize:32,masks:[857735168],bluetoothSpec:[{serviceUuid:"13d63400-2c97-6004-0000-4c6564676572",notifyUuid:"13d63400-2c97-6004-0001-4c6564676572",writeUuid:"13d63400-2c97-6004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-6004-0003-4c6564676572"}]}),[i.DeviceModelId.FLEX]:new u.TransportDeviceModel({id:i.DeviceModelId.FLEX,productName:"Ledger Flex",usbProductId:112,bootloaderUsbProductId:7,usbOnly:!1,memorySize:1533*1024,blockSize:32,masks:[858783744],bluetoothSpec:[{serviceUuid:"13d63400-2c97-3004-0000-4c6564676572",notifyUuid:"13d63400-2c97-3004-0001-4c6564676572",writeUuid:"13d63400-2c97-3004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-3004-0003-4c6564676572"}]}),[i.DeviceModelId.APEX]:new u.TransportDeviceModel({id:i.DeviceModelId.APEX,productName:"Ledger Apex",usbProductId:128,bootloaderUsbProductId:8,usbOnly:!1,memorySize:1533*1024,blockSize:32,masks:[859832320],bluetoothSpec:[{serviceUuid:"13d63400-2c97-8004-0000-4c6564676572",notifyUuid:"13d63400-2c97-8004-0001-4c6564676572",writeUuid:"13d63400-2c97-8004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-8004-0003-4c6564676572"}]})}),s=b([(0,U.injectable)()],s);0&&(module.exports={StaticDeviceModelDataSource});
2
2
  //# sourceMappingURL=StaticDeviceModelDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-model/data/StaticDeviceModelDataSource.ts"],
4
- "sourcesContent": ["import { injectable } from \"inversify\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceModelDataSource } from \"@api/device-model/data/DeviceModelDataSource\";\nimport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nimport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\n\n/**\n * Static/in memory implementation of the device model data source\n */\n@injectable()\nexport class StaticDeviceModelDataSource implements DeviceModelDataSource {\n private static deviceModelByIds: {\n [_key in DeviceModelId]: TransportDeviceModel;\n } = {\n [DeviceModelId.NANO_S]: new TransportDeviceModel({\n id: DeviceModelId.NANO_S,\n productName: \"Ledger Nano S\",\n usbProductId: 0x10,\n bootloaderUsbProductId: 0x0001,\n usbOnly: true,\n memorySize: 320 * 1024,\n masks: [0x31100000],\n }),\n [DeviceModelId.NANO_SP]: new TransportDeviceModel({\n id: DeviceModelId.NANO_SP,\n productName: \"Ledger Nano S Plus\",\n usbProductId: 0x50,\n bootloaderUsbProductId: 0x0005,\n usbOnly: true,\n memorySize: 1533 * 1024,\n masks: [0x33100000],\n }),\n [DeviceModelId.NANO_X]: new TransportDeviceModel({\n id: DeviceModelId.NANO_X,\n productName: \"Ledger Nano X\",\n usbProductId: 0x40,\n bootloaderUsbProductId: 0x0004,\n usbOnly: false,\n memorySize: 2 * 1024 * 1024,\n masks: [0x33000000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-0004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-0004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-0004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-0004-0003-4c6564676572\",\n },\n ],\n }),\n [DeviceModelId.STAX]: new TransportDeviceModel({\n id: DeviceModelId.STAX,\n productName: \"Ledger Stax\",\n usbProductId: 0x60,\n bootloaderUsbProductId: 0x0006,\n usbOnly: false,\n memorySize: 1533 * 1024,\n masks: [0x33200000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-6004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-6004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-6004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-6004-0003-4c6564676572\",\n },\n ],\n }),\n [DeviceModelId.FLEX]: new TransportDeviceModel({\n id: DeviceModelId.FLEX,\n productName: \"Ledger Flex\",\n usbProductId: 0x70,\n bootloaderUsbProductId: 0x0007,\n usbOnly: false,\n memorySize: 1533 * 1024,\n masks: [0x33300000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-3004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-3004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-3004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-3004-0003-4c6564676572\",\n },\n ],\n }),\n };\n\n getAllDeviceModels(): TransportDeviceModel[] {\n return Object.values(StaticDeviceModelDataSource.deviceModelByIds);\n }\n\n getDeviceModel(params: { id: DeviceModelId }): TransportDeviceModel {\n return StaticDeviceModelDataSource.deviceModelByIds[params.id];\n }\n\n /**\n * Returns the list of device models that match all the given parameters\n */\n filterDeviceModels(\n params: Partial<TransportDeviceModel>,\n ): TransportDeviceModel[] {\n return this.getAllDeviceModels().filter((deviceModel) => {\n return Object.entries(params).every(([key, value]) => {\n return deviceModel[key as keyof TransportDeviceModel] === value;\n });\n });\n }\n\n getBluetoothServicesInfos(): Record<string, BleDeviceInfos> {\n return Object.values(StaticDeviceModelDataSource.deviceModelByIds).reduce<\n Record<string, BleDeviceInfos>\n >((acc, deviceModel) => {\n const { bluetoothSpec } = deviceModel;\n if (bluetoothSpec) {\n return {\n ...acc,\n ...bluetoothSpec.reduce<Record<string, BleDeviceInfos>>(\n (serviceToModel, bleSpec) => ({\n ...serviceToModel,\n [bleSpec.serviceUuid]: new BleDeviceInfos(\n deviceModel,\n bleSpec.serviceUuid,\n bleSpec.writeUuid,\n bleSpec.writeCmdUuid,\n bleSpec.notifyUuid,\n ),\n }),\n {},\n ),\n };\n }\n return acc;\n }, {});\n }\n\n getBluetoothServices(): string[] {\n return Object.values(StaticDeviceModelDataSource.deviceModelByIds)\n .map((deviceModel) =>\n (deviceModel.bluetoothSpec || []).map((spec) => spec.serviceUuid),\n )\n .flat()\n .filter((u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,IAAM,KAClB,MAAO,CAAC,SAAU,CACpB,CAAC,EACD,CAAC,gBAAc,OAAO,EAAG,IAAI,uBAAqB,CAChD,GAAI,gBAAc,QAClB,YAAa,qBACb,aAAc,GACd,uBAAwB,EACxB,QAAS,GACT,WAAY,KAAO,KACnB,MAAO,CAAC,SAAU,CACpB,CAAC,EACD,CAAC,gBAAc,MAAM,EAAG,IAAI,uBAAqB,CAC/C,GAAI,gBAAc,OAClB,YAAa,gBACb,aAAc,GACd,uBAAwB,EACxB,QAAS,GACT,WAAY,EAAI,KAAO,KACvB,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,CACF,CAAC,EACD,CAAC,gBAAc,IAAI,EAAG,IAAI,uBAAqB,CAC7C,GAAI,gBAAc,KAClB,YAAa,cACb,aAAc,GACd,uBAAwB,EACxB,QAAS,GACT,WAAY,KAAO,KACnB,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,CACF,CAAC,EACD,CAAC,gBAAc,IAAI,EAAG,IAAI,uBAAqB,CAC7C,GAAI,gBAAc,KAClB,YAAa,cACb,aAAc,IACd,uBAAwB,EACxB,QAAS,GACT,WAAY,KAAO,KACnB,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,CACF,CAAC,CACH,GAzEWA,EAANY,EAAA,IADN,cAAW,GACCZ",
4
+ "sourcesContent": ["import { injectable } from \"inversify\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceModelDataSource } from \"@api/device-model/data/DeviceModelDataSource\";\nimport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nimport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\n\n/**\n * Static/in memory implementation of the device model data source\n */\n@injectable()\nexport class StaticDeviceModelDataSource implements DeviceModelDataSource {\n private static deviceModelByIds: {\n [_key in DeviceModelId]: TransportDeviceModel;\n } = {\n [DeviceModelId.NANO_S]: new TransportDeviceModel({\n id: DeviceModelId.NANO_S,\n productName: \"Ledger Nano S\",\n usbProductId: 0x10,\n bootloaderUsbProductId: 0x0001,\n usbOnly: true,\n memorySize: 320 * 1024,\n blockSize: 4 * 1024,\n masks: [0x31100000],\n }),\n [DeviceModelId.NANO_SP]: new TransportDeviceModel({\n id: DeviceModelId.NANO_SP,\n productName: \"Ledger Nano S Plus\",\n usbProductId: 0x50,\n bootloaderUsbProductId: 0x0005,\n usbOnly: true,\n memorySize: 1533 * 1024,\n blockSize: 32,\n masks: [0x33100000],\n }),\n [DeviceModelId.NANO_X]: new TransportDeviceModel({\n id: DeviceModelId.NANO_X,\n productName: \"Ledger Nano X\",\n usbProductId: 0x40,\n bootloaderUsbProductId: 0x0004,\n usbOnly: false,\n memorySize: 2 * 1024 * 1024,\n blockSize: 4 * 1024,\n masks: [0x33000000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-0004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-0004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-0004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-0004-0003-4c6564676572\",\n },\n ],\n }),\n [DeviceModelId.STAX]: new TransportDeviceModel({\n id: DeviceModelId.STAX,\n productName: \"Ledger Stax\",\n usbProductId: 0x60,\n bootloaderUsbProductId: 0x0006,\n usbOnly: false,\n memorySize: 1533 * 1024,\n blockSize: 32,\n masks: [0x33200000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-6004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-6004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-6004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-6004-0003-4c6564676572\",\n },\n ],\n }),\n [DeviceModelId.FLEX]: new TransportDeviceModel({\n id: DeviceModelId.FLEX,\n productName: \"Ledger Flex\",\n usbProductId: 0x70,\n bootloaderUsbProductId: 0x0007,\n usbOnly: false,\n memorySize: 1533 * 1024,\n blockSize: 32,\n masks: [0x33300000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-3004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-3004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-3004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-3004-0003-4c6564676572\",\n },\n ],\n }),\n [DeviceModelId.APEX]: new TransportDeviceModel({\n id: DeviceModelId.APEX,\n productName: \"Ledger Apex\",\n usbProductId: 0x80,\n bootloaderUsbProductId: 0x0008,\n usbOnly: false,\n memorySize: 1533 * 1024,\n blockSize: 32,\n masks: [0x33400000],\n bluetoothSpec: [\n {\n serviceUuid: \"13d63400-2c97-8004-0000-4c6564676572\",\n notifyUuid: \"13d63400-2c97-8004-0001-4c6564676572\",\n writeUuid: \"13d63400-2c97-8004-0002-4c6564676572\",\n writeCmdUuid: \"13d63400-2c97-8004-0003-4c6564676572\",\n },\n ],\n }),\n };\n\n getAllDeviceModels(): TransportDeviceModel[] {\n return Object.values(StaticDeviceModelDataSource.deviceModelByIds);\n }\n\n getDeviceModel(params: { id: DeviceModelId }): TransportDeviceModel {\n return StaticDeviceModelDataSource.deviceModelByIds[params.id];\n }\n\n /**\n * Returns the list of device models that match all the given parameters\n */\n filterDeviceModels(\n params: Partial<TransportDeviceModel>,\n ): TransportDeviceModel[] {\n return this.getAllDeviceModels().filter((deviceModel) => {\n return Object.entries(params).every(([key, value]) => {\n return deviceModel[key as keyof TransportDeviceModel] === value;\n });\n });\n }\n\n getBluetoothServicesInfos(): Record<string, BleDeviceInfos> {\n return Object.values(StaticDeviceModelDataSource.deviceModelByIds).reduce<\n Record<string, BleDeviceInfos>\n >((acc, deviceModel) => {\n const { bluetoothSpec } = deviceModel;\n if (bluetoothSpec) {\n return {\n ...acc,\n ...bluetoothSpec.reduce<Record<string, BleDeviceInfos>>(\n (serviceToModel, bleSpec) => ({\n ...serviceToModel,\n [bleSpec.serviceUuid]: new BleDeviceInfos(\n deviceModel,\n bleSpec.serviceUuid,\n bleSpec.writeUuid,\n bleSpec.writeCmdUuid,\n bleSpec.notifyUuid,\n ),\n }),\n {},\n ),\n };\n }\n return acc;\n }, {});\n }\n\n getBluetoothServices(): string[] {\n return Object.values(StaticDeviceModelDataSource.deviceModelByIds)\n .map((deviceModel) =>\n (deviceModel.bluetoothSpec || []).map((spec) => spec.serviceUuid),\n )\n .flat()\n .filter((uuid) => !!uuid);\n }\n}\n"],
5
+ "mappings": "mrBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA2B,qBAE3BC,EAA8B,mCAE9BC,EAA+B,kDAC/BD,EAAqC,+CAM9B,IAAME,EAAN,KAAmE,CAkGxE,oBAA6C,CAC3C,OAAO,OAAO,OAAOA,EAA4B,gBAAgB,CACnE,CAEA,eAAeC,EAAqD,CAClE,OAAOD,EAA4B,iBAAiBC,EAAO,EAAE,CAC/D,CAKA,mBACEA,EACwB,CACxB,OAAO,KAAK,mBAAmB,EAAE,OAAQC,GAChC,OAAO,QAAQD,CAAM,EAAE,MAAM,CAAC,CAACE,EAAKC,CAAK,IACvCF,EAAYC,CAAiC,IAAMC,CAC3D,CACF,CACH,CAEA,2BAA4D,CAC1D,OAAO,OAAO,OAAOJ,EAA4B,gBAAgB,EAAE,OAEjE,CAACK,EAAKH,IAAgB,CACtB,KAAM,CAAE,cAAAI,CAAc,EAAIJ,EAC1B,OAAII,EACK,CACL,GAAGD,EACH,GAAGC,EAAc,OACf,CAACC,EAAgBC,KAAa,CAC5B,GAAGD,EACH,CAACC,EAAQ,WAAW,EAAG,IAAI,iBACzBN,EACAM,EAAQ,YACRA,EAAQ,UACRA,EAAQ,aACRA,EAAQ,UACV,CACF,GACA,CAAC,CACH,CACF,E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,EACxB,QAAS,GACT,WAAY,KAAO,KACnB,UAAW,GACX,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,CACF,CAAC,EACD,CAAC,gBAAc,IAAI,EAAG,IAAI,uBAAqB,CAC7C,GAAI,gBAAc,KAClB,YAAa,cACb,aAAc,IACd,uBAAwB,EACxB,QAAS,GACT,WAAY,KAAO,KACnB,UAAW,GACX,MAAO,CAAC,SAAU,EAClB,cAAe,CACb,CACE,YAAa,uCACb,WAAY,uCACZ,UAAW,uCACX,aAAc,sCAChB,CACF,CACF,CAAC,CACH,GAhGWA,EAANY,EAAA,IADN,cAAW,GACCZ",
6
6
  "names": ["StaticDeviceModelDataSource_exports", "__export", "StaticDeviceModelDataSource", "__toCommonJS", "import_inversify", "import_DeviceModel", "import_BleDeviceInfos", "StaticDeviceModelDataSource", "params", "deviceModel", "key", "value", "acc", "bluetoothSpec", "serviceToModel", "bleSpec", "spec", "uuid", "__publicField", "__decorateClass"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("../../device/DeviceModel"),s=require("../../device-model/model/BleDeviceInfos"),i=require("./StaticDeviceModelDataSource");describe("StaticDeviceModelDataSource",()=>{describe("getAllDeviceModels",()=>{it("should return all device models",()=>{const c=new i.StaticDeviceModelDataSource().getAllDeviceModels();expect(c.length).toEqual(5),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_S})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_X})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.STAX})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.FLEX}))})}),describe("getDeviceModel",()=>{it("should return the associated device model",()=>{const t=new i.StaticDeviceModelDataSource,c=t.getDeviceModel({id:e.DeviceModelId.NANO_S});expect(c).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_S}));const o=t.getDeviceModel({id:e.DeviceModelId.NANO_SP});expect(o).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP}));const d=t.getDeviceModel({id:e.DeviceModelId.NANO_X});expect(d).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_X}));const n=t.getDeviceModel({id:e.DeviceModelId.STAX});expect(n).toEqual(expect.objectContaining({id:e.DeviceModelId.STAX}));const l=t.getDeviceModel({id:e.DeviceModelId.FLEX});expect(l).toEqual(expect.objectContaining({id:e.DeviceModelId.FLEX}))})}),describe("filterDeviceModels",()=>{it("should return the device models that match the given single parameter",()=>{const t=new i.StaticDeviceModelDataSource,c=t.filterDeviceModels({usbOnly:!0});expect(c.length).toEqual(2),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_S}));const o=t.filterDeviceModels({usbProductId:16});expect(o.length).toEqual(1),expect(o[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_S}));const d=t.filterDeviceModels({usbProductId:64});expect(d.length).toEqual(1),expect(d[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_X}));const n=t.filterDeviceModels({usbProductId:80});expect(n.length).toEqual(1),expect(n[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP}));const l=t.filterDeviceModels({usbProductId:96});expect(l.length).toEqual(1),expect(l[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.STAX}));const a=t.filterDeviceModels({usbProductId:0});expect(a.length).toEqual(0)}),it("should return the device models that match the given multiple parameters",()=>{const t=new i.StaticDeviceModelDataSource,c=t.filterDeviceModels({usbOnly:!1,usbProductId:64});expect(c.length).toEqual(1),expect(c[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_X}));const o=t.filterDeviceModels({usbOnly:!0,usbProductId:80});expect(o.length).toEqual(1),expect(o[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP}));const d=t.filterDeviceModels({usbOnly:!1,usbProductId:16});expect(d.length).toEqual(0)})}),describe("getBluetoothServicesInfos",()=>{it("should return the ble service infos record",()=>{const t=new i.StaticDeviceModelDataSource,c=t.getBluetoothServicesInfos();expect(c).toStrictEqual({"13d63400-2c97-0004-0000-4c6564676572":new s.BleDeviceInfos(t.getDeviceModel({id:e.DeviceModelId.NANO_X}),"13d63400-2c97-0004-0000-4c6564676572","13d63400-2c97-0004-0002-4c6564676572","13d63400-2c97-0004-0003-4c6564676572","13d63400-2c97-0004-0001-4c6564676572"),"13d63400-2c97-6004-0000-4c6564676572":new s.BleDeviceInfos(t.getDeviceModel({id:e.DeviceModelId.STAX}),"13d63400-2c97-6004-0000-4c6564676572","13d63400-2c97-6004-0002-4c6564676572","13d63400-2c97-6004-0003-4c6564676572","13d63400-2c97-6004-0001-4c6564676572"),"13d63400-2c97-3004-0000-4c6564676572":new s.BleDeviceInfos(t.getDeviceModel({id:e.DeviceModelId.FLEX}),"13d63400-2c97-3004-0000-4c6564676572","13d63400-2c97-3004-0002-4c6564676572","13d63400-2c97-3004-0003-4c6564676572","13d63400-2c97-3004-0001-4c6564676572")})})}),describe("getBluetoothServices",()=>{it("should return the bluetooth services",()=>{const c=new i.StaticDeviceModelDataSource().getBluetoothServices();expect(c).toStrictEqual(["13d63400-2c97-0004-0000-4c6564676572","13d63400-2c97-6004-0000-4c6564676572","13d63400-2c97-3004-0000-4c6564676572"])})})});
1
+ "use strict";var e=require("../../device/DeviceModel"),n=require("../../device-model/model/BleDeviceInfos"),i=require("./StaticDeviceModelDataSource");describe("StaticDeviceModelDataSource",()=>{describe("getAllDeviceModels",()=>{it("should return all device models",()=>{const c=new i.StaticDeviceModelDataSource().getAllDeviceModels();expect(c.length).toEqual(6),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.APEX})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_S})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_X})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.STAX})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.FLEX}))})}),describe("getDeviceModel",()=>{it("should return the associated device model",()=>{const t=new i.StaticDeviceModelDataSource,c=t.getDeviceModel({id:e.DeviceModelId.NANO_S});expect(c).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_S}));const o=t.getDeviceModel({id:e.DeviceModelId.NANO_SP});expect(o).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP}));const d=t.getDeviceModel({id:e.DeviceModelId.NANO_X});expect(d).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_X}));const l=t.getDeviceModel({id:e.DeviceModelId.STAX});expect(l).toEqual(expect.objectContaining({id:e.DeviceModelId.STAX}));const a=t.getDeviceModel({id:e.DeviceModelId.FLEX});expect(a).toEqual(expect.objectContaining({id:e.DeviceModelId.FLEX}))})}),describe("filterDeviceModels",()=>{it("should return the device models that match the given single parameter",()=>{const t=new i.StaticDeviceModelDataSource,c=t.filterDeviceModels({usbOnly:!0});expect(c.length).toEqual(2),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP})),expect(c).toContainEqual(expect.objectContaining({id:e.DeviceModelId.NANO_S}));const o=t.filterDeviceModels({usbProductId:16});expect(o.length).toEqual(1),expect(o[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_S}));const d=t.filterDeviceModels({usbProductId:64});expect(d.length).toEqual(1),expect(d[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_X}));const l=t.filterDeviceModels({usbProductId:80});expect(l.length).toEqual(1),expect(l[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP}));const a=t.filterDeviceModels({usbProductId:96});expect(a.length).toEqual(1),expect(a[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.STAX}));const s=t.filterDeviceModels({usbProductId:0});expect(s.length).toEqual(0)}),it("should return the device models that match the given multiple parameters",()=>{const t=new i.StaticDeviceModelDataSource,c=t.filterDeviceModels({usbOnly:!1,usbProductId:64});expect(c.length).toEqual(1),expect(c[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_X}));const o=t.filterDeviceModels({usbOnly:!0,usbProductId:80});expect(o.length).toEqual(1),expect(o[0]).toEqual(expect.objectContaining({id:e.DeviceModelId.NANO_SP}));const d=t.filterDeviceModels({usbOnly:!1,usbProductId:16});expect(d.length).toEqual(0)})}),describe("getBluetoothServicesInfos",()=>{it("should return the ble service infos record",()=>{const t=new i.StaticDeviceModelDataSource,c=t.getBluetoothServicesInfos();expect(c).toStrictEqual({"13d63400-2c97-0004-0000-4c6564676572":new n.BleDeviceInfos(t.getDeviceModel({id:e.DeviceModelId.NANO_X}),"13d63400-2c97-0004-0000-4c6564676572","13d63400-2c97-0004-0002-4c6564676572","13d63400-2c97-0004-0003-4c6564676572","13d63400-2c97-0004-0001-4c6564676572"),"13d63400-2c97-6004-0000-4c6564676572":new n.BleDeviceInfos(t.getDeviceModel({id:e.DeviceModelId.STAX}),"13d63400-2c97-6004-0000-4c6564676572","13d63400-2c97-6004-0002-4c6564676572","13d63400-2c97-6004-0003-4c6564676572","13d63400-2c97-6004-0001-4c6564676572"),"13d63400-2c97-3004-0000-4c6564676572":new n.BleDeviceInfos(t.getDeviceModel({id:e.DeviceModelId.FLEX}),"13d63400-2c97-3004-0000-4c6564676572","13d63400-2c97-3004-0002-4c6564676572","13d63400-2c97-3004-0003-4c6564676572","13d63400-2c97-3004-0001-4c6564676572"),"13d63400-2c97-8004-0000-4c6564676572":new n.BleDeviceInfos(t.getDeviceModel({id:e.DeviceModelId.APEX}),"13d63400-2c97-8004-0000-4c6564676572","13d63400-2c97-8004-0002-4c6564676572","13d63400-2c97-8004-0003-4c6564676572","13d63400-2c97-8004-0001-4c6564676572")})})}),describe("getBluetoothServices",()=>{it("should return the bluetooth services",()=>{const c=new i.StaticDeviceModelDataSource().getBluetoothServices();expect(c).toStrictEqual(["13d63400-2c97-0004-0000-4c6564676572","13d63400-2c97-6004-0000-4c6564676572","13d63400-2c97-3004-0000-4c6564676572","13d63400-2c97-8004-0000-4c6564676572"])})})});
2
2
  //# sourceMappingURL=StaticDeviceModelDataSource.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-model/data/StaticDeviceModelDataSource.test.ts"],
4
- "sourcesContent": ["import { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\n\nimport { StaticDeviceModelDataSource } from \"./StaticDeviceModelDataSource\";\n\ndescribe(\"StaticDeviceModelDataSource\", () => {\n describe(\"getAllDeviceModels\", () => {\n it(\"should return all device models\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n const deviceModels = dataSource.getAllDeviceModels();\n\n // Currently supporting 4 device models\n expect(deviceModels.length).toEqual(5);\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_S }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_X }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.STAX }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.FLEX }),\n );\n });\n });\n\n describe(\"getDeviceModel\", () => {\n it(\"should return the associated device model\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n\n const deviceModel1 = dataSource.getDeviceModel({\n id: DeviceModelId.NANO_S,\n });\n expect(deviceModel1).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_S }),\n );\n\n const deviceModel2 = dataSource.getDeviceModel({\n id: DeviceModelId.NANO_SP,\n });\n expect(deviceModel2).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n\n const deviceModel3 = dataSource.getDeviceModel({\n id: DeviceModelId.NANO_X,\n });\n expect(deviceModel3).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_X }),\n );\n\n const deviceModel4 = dataSource.getDeviceModel({\n id: DeviceModelId.STAX,\n });\n expect(deviceModel4).toEqual(\n expect.objectContaining({ id: DeviceModelId.STAX }),\n );\n\n const deviceModel5 = dataSource.getDeviceModel({\n id: DeviceModelId.FLEX,\n });\n expect(deviceModel5).toEqual(\n expect.objectContaining({ id: DeviceModelId.FLEX }),\n );\n });\n });\n\n describe(\"filterDeviceModels\", () => {\n it(\"should return the device models that match the given single parameter\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n\n const deviceModels1 = dataSource.filterDeviceModels({ usbOnly: true });\n expect(deviceModels1.length).toEqual(2);\n expect(deviceModels1).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n expect(deviceModels1).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_S }),\n );\n\n const deviceModels2 = dataSource.filterDeviceModels({\n usbProductId: 0x10,\n });\n expect(deviceModels2.length).toEqual(1);\n expect(deviceModels2[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_S }),\n );\n\n const deviceModels3 = dataSource.filterDeviceModels({\n usbProductId: 0x40,\n });\n expect(deviceModels3.length).toEqual(1);\n expect(deviceModels3[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_X }),\n );\n\n const deviceModels4 = dataSource.filterDeviceModels({\n usbProductId: 0x50,\n });\n expect(deviceModels4.length).toEqual(1);\n expect(deviceModels4[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n\n const deviceModels5 = dataSource.filterDeviceModels({\n usbProductId: 0x60,\n });\n expect(deviceModels5.length).toEqual(1);\n expect(deviceModels5[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.STAX }),\n );\n\n const deviceModels6 = dataSource.filterDeviceModels({\n usbProductId: 0x00,\n });\n expect(deviceModels6.length).toEqual(0);\n });\n\n it(\"should return the device models that match the given multiple parameters\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n\n const deviceModels1 = dataSource.filterDeviceModels({\n usbOnly: false,\n usbProductId: 0x40,\n });\n expect(deviceModels1.length).toEqual(1);\n expect(deviceModels1[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_X }),\n );\n\n const deviceModels2 = dataSource.filterDeviceModels({\n usbOnly: true,\n usbProductId: 0x50,\n });\n expect(deviceModels2.length).toEqual(1);\n expect(deviceModels2[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n\n // Nano S is usbOnly\n const deviceModels3 = dataSource.filterDeviceModels({\n usbOnly: false,\n usbProductId: 0x10,\n });\n expect(deviceModels3.length).toEqual(0);\n });\n });\n describe(\"getBluetoothServicesInfos\", () => {\n it(\"should return the ble service infos record\", () => {\n // given\n const dataSource = new StaticDeviceModelDataSource();\n // when\n const bleServiceInfos = dataSource.getBluetoothServicesInfos();\n // then\n expect(bleServiceInfos).toStrictEqual({\n \"13d63400-2c97-0004-0000-4c6564676572\": new BleDeviceInfos(\n dataSource.getDeviceModel({ id: DeviceModelId.NANO_X }),\n \"13d63400-2c97-0004-0000-4c6564676572\",\n \"13d63400-2c97-0004-0002-4c6564676572\",\n \"13d63400-2c97-0004-0003-4c6564676572\",\n \"13d63400-2c97-0004-0001-4c6564676572\",\n ),\n \"13d63400-2c97-6004-0000-4c6564676572\": new BleDeviceInfos(\n dataSource.getDeviceModel({ id: DeviceModelId.STAX }),\n \"13d63400-2c97-6004-0000-4c6564676572\",\n \"13d63400-2c97-6004-0002-4c6564676572\",\n \"13d63400-2c97-6004-0003-4c6564676572\",\n \"13d63400-2c97-6004-0001-4c6564676572\",\n ),\n \"13d63400-2c97-3004-0000-4c6564676572\": new BleDeviceInfos(\n dataSource.getDeviceModel({ id: DeviceModelId.FLEX }),\n \"13d63400-2c97-3004-0000-4c6564676572\",\n \"13d63400-2c97-3004-0002-4c6564676572\",\n \"13d63400-2c97-3004-0003-4c6564676572\",\n \"13d63400-2c97-3004-0001-4c6564676572\",\n ),\n });\n });\n });\n describe(\"getBluetoothServices\", () => {\n it(\"should return the bluetooth services\", () => {\n // given\n const dataSource = new StaticDeviceModelDataSource();\n // when\n const bleServices = dataSource.getBluetoothServices();\n // then\n expect(bleServices).toStrictEqual([\n \"13d63400-2c97-0004-0000-4c6564676572\",\n \"13d63400-2c97-6004-0000-4c6564676572\",\n \"13d63400-2c97-3004-0000-4c6564676572\",\n ]);\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA8B,mCAC9BC,EAA+B,kDAE/BC,EAA4C,yCAE5C,SAAS,8BAA+B,IAAM,CAC5C,SAAS,qBAAsB,IAAM,CACnC,GAAG,kCAAmC,IAAM,CAE1C,MAAMC,EADa,IAAI,8BAA4B,EACnB,mBAAmB,EAGnD,OAAOA,EAAa,MAAM,EAAE,QAAQ,CAAC,EACrC,OAAOA,CAAY,EAAE,eACnB,OAAO,iBAAiB,CAAE,GAAI,gBAAc,MAAO,CAAC,CACtD,EACA,OAAOA,CAAY,EAAE,eACnB,OAAO,iBAAiB,CAAE,GAAI,gBAAc,OAAQ,CAAC,CACvD,EACA,OAAOA,CAAY,EAAE,eACnB,OAAO,iBAAiB,CAAE,GAAI,gBAAc,MAAO,CAAC,CACtD,EACA,OAAOA,CAAY,EAAE,eACnB,OAAO,iBAAiB,CAAE,GAAI,gBAAc,IAAK,CAAC,CACpD,EACA,OAAOA,CAAY,EAAE,eACnB,OAAO,iBAAiB,CAAE,GAAI,gBAAc,IAAK,CAAC,CACpD,CACF,CAAC,CACH,CAAC,EAED,SAAS,iBAAkB,IAAM,CAC/B,GAAG,4CAA6C,IAAM,CACpD,MAAMC,EAAa,IAAI,8BAEjBC,EAAeD,EAAW,eAAe,CAC7C,GAAI,gBAAc,MACpB,CAAC,EACD,OAAOC,CAAY,EAAE,QACnB,OAAO,iBAAiB,CAAE,GAAI,gBAAc,MAA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ACxC,CAAC,CACH,CAAC,EACD,SAAS,4BAA6B,IAAM,CAC1C,GAAG,6CAA8C,IAAM,CAErD,MAAMR,EAAa,IAAI,8BAEjBY,EAAkBZ,EAAW,0BAA0B,EAE7D,OAAOY,CAAe,EAAE,cAAc,CACpC,uCAAwC,IAAI,iBAC1CZ,EAAW,eAAe,CAAE,GAAI,gBAAc,MAAO,CAAC,EACtD,uCACA,uCACA,uCACA,sCACF,EACA,uCAAwC,IAAI,iBAC1CA,EAAW,eAAe,CAAE,GAAI,gBAAc,IAAK,CAAC,EACpD,uCACA,uCACA,uCACA,sCACF,EACA,uCAAwC,IAAI,iBAC1CA,EAAW,eAAe,CAAE,GAAI,gBAAc,IAAK,CAAC,EACpD,uCACA,uCACA,uCACA,sCACF,CACF,CAAC,CACH,CAAC,CACH,CAAC,EACD,SAAS,uBAAwB,IAAM,CACrC,GAAG,uCAAwC,IAAM,CAI/C,MAAMa,EAFa,IAAI,8BAA4B,EAEpB,qBAAqB,EAEpD,OAAOA,CAAW,EAAE,cAAc,CAChC,uCACA,uCACA,sCACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\n\nimport { StaticDeviceModelDataSource } from \"./StaticDeviceModelDataSource\";\n\ndescribe(\"StaticDeviceModelDataSource\", () => {\n describe(\"getAllDeviceModels\", () => {\n it(\"should return all device models\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n const deviceModels = dataSource.getAllDeviceModels();\n\n expect(deviceModels.length).toEqual(6);\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.APEX }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_S }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_X }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.STAX }),\n );\n expect(deviceModels).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.FLEX }),\n );\n });\n });\n\n describe(\"getDeviceModel\", () => {\n it(\"should return the associated device model\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n\n const deviceModel1 = dataSource.getDeviceModel({\n id: DeviceModelId.NANO_S,\n });\n expect(deviceModel1).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_S }),\n );\n\n const deviceModel2 = dataSource.getDeviceModel({\n id: DeviceModelId.NANO_SP,\n });\n expect(deviceModel2).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n\n const deviceModel3 = dataSource.getDeviceModel({\n id: DeviceModelId.NANO_X,\n });\n expect(deviceModel3).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_X }),\n );\n\n const deviceModel4 = dataSource.getDeviceModel({\n id: DeviceModelId.STAX,\n });\n expect(deviceModel4).toEqual(\n expect.objectContaining({ id: DeviceModelId.STAX }),\n );\n\n const deviceModel5 = dataSource.getDeviceModel({\n id: DeviceModelId.FLEX,\n });\n expect(deviceModel5).toEqual(\n expect.objectContaining({ id: DeviceModelId.FLEX }),\n );\n });\n });\n\n describe(\"filterDeviceModels\", () => {\n it(\"should return the device models that match the given single parameter\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n\n const deviceModels1 = dataSource.filterDeviceModels({ usbOnly: true });\n expect(deviceModels1.length).toEqual(2);\n expect(deviceModels1).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n expect(deviceModels1).toContainEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_S }),\n );\n\n const deviceModels2 = dataSource.filterDeviceModels({\n usbProductId: 0x10,\n });\n expect(deviceModels2.length).toEqual(1);\n expect(deviceModels2[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_S }),\n );\n\n const deviceModels3 = dataSource.filterDeviceModels({\n usbProductId: 0x40,\n });\n expect(deviceModels3.length).toEqual(1);\n expect(deviceModels3[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_X }),\n );\n\n const deviceModels4 = dataSource.filterDeviceModels({\n usbProductId: 0x50,\n });\n expect(deviceModels4.length).toEqual(1);\n expect(deviceModels4[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n\n const deviceModels5 = dataSource.filterDeviceModels({\n usbProductId: 0x60,\n });\n expect(deviceModels5.length).toEqual(1);\n expect(deviceModels5[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.STAX }),\n );\n\n const deviceModels6 = dataSource.filterDeviceModels({\n usbProductId: 0x00,\n });\n expect(deviceModels6.length).toEqual(0);\n });\n\n it(\"should return the device models that match the given multiple parameters\", () => {\n const dataSource = new StaticDeviceModelDataSource();\n\n const deviceModels1 = dataSource.filterDeviceModels({\n usbOnly: false,\n usbProductId: 0x40,\n });\n expect(deviceModels1.length).toEqual(1);\n expect(deviceModels1[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_X }),\n );\n\n const deviceModels2 = dataSource.filterDeviceModels({\n usbOnly: true,\n usbProductId: 0x50,\n });\n expect(deviceModels2.length).toEqual(1);\n expect(deviceModels2[0]).toEqual(\n expect.objectContaining({ id: DeviceModelId.NANO_SP }),\n );\n\n // Nano S is usbOnly\n const deviceModels3 = dataSource.filterDeviceModels({\n usbOnly: false,\n usbProductId: 0x10,\n });\n expect(deviceModels3.length).toEqual(0);\n });\n });\n describe(\"getBluetoothServicesInfos\", () => {\n it(\"should return the ble service infos record\", () => {\n // given\n const dataSource = new StaticDeviceModelDataSource();\n // when\n const bleServiceInfos = dataSource.getBluetoothServicesInfos();\n // then\n expect(bleServiceInfos).toStrictEqual({\n \"13d63400-2c97-0004-0000-4c6564676572\": new BleDeviceInfos(\n dataSource.getDeviceModel({ id: DeviceModelId.NANO_X }),\n \"13d63400-2c97-0004-0000-4c6564676572\",\n \"13d63400-2c97-0004-0002-4c6564676572\",\n \"13d63400-2c97-0004-0003-4c6564676572\",\n \"13d63400-2c97-0004-0001-4c6564676572\",\n ),\n \"13d63400-2c97-6004-0000-4c6564676572\": new BleDeviceInfos(\n dataSource.getDeviceModel({ id: DeviceModelId.STAX }),\n \"13d63400-2c97-6004-0000-4c6564676572\",\n \"13d63400-2c97-6004-0002-4c6564676572\",\n \"13d63400-2c97-6004-0003-4c6564676572\",\n \"13d63400-2c97-6004-0001-4c6564676572\",\n ),\n \"13d63400-2c97-3004-0000-4c6564676572\": new BleDeviceInfos(\n dataSource.getDeviceModel({ id: DeviceModelId.FLEX }),\n \"13d63400-2c97-3004-0000-4c6564676572\",\n \"13d63400-2c97-3004-0002-4c6564676572\",\n \"13d63400-2c97-3004-0003-4c6564676572\",\n \"13d63400-2c97-3004-0001-4c6564676572\",\n ),\n \"13d63400-2c97-8004-0000-4c6564676572\": new BleDeviceInfos(\n dataSource.getDeviceModel({ id: DeviceModelId.APEX }),\n \"13d63400-2c97-8004-0000-4c6564676572\",\n \"13d63400-2c97-8004-0002-4c6564676572\",\n \"13d63400-2c97-8004-0003-4c6564676572\",\n \"13d63400-2c97-8004-0001-4c6564676572\",\n ),\n });\n });\n });\n describe(\"getBluetoothServices\", () => {\n it(\"should return the bluetooth services\", () => {\n // given\n const dataSource = new StaticDeviceModelDataSource();\n // when\n const bleServices = dataSource.getBluetoothServices();\n // then\n expect(bleServices).toStrictEqual([\n \"13d63400-2c97-0004-0000-4c6564676572\",\n \"13d63400-2c97-6004-0000-4c6564676572\",\n \"13d63400-2c97-3004-0000-4c6564676572\",\n \"13d63400-2c97-8004-0000-4c6564676572\",\n ]);\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA8B,mCAC9BC,EAA+B,kDAE/BC,EAA4C,yCAE5C,SAAS,8BAA+B,IAAM,CAC5C,SAAS,qBAAsB,IAAM,CACnC,GAAG,kCAAmC,IAAM,CAE1C,MAAMC,EADa,IAAI,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AC,EACpD,uCACA,uCACA,uCACA,sCACF,EACA,uCAAwC,IAAI,iBAC1CA,EAAW,eAAe,CAAE,GAAI,gBAAc,IAAK,CAAC,EACpD,uCACA,uCACA,uCACA,sCACF,CACF,CAAC,CACH,CAAC,CACH,CAAC,EACD,SAAS,uBAAwB,IAAM,CACrC,GAAG,uCAAwC,IAAM,CAI/C,MAAMa,EAFa,IAAI,8BAA4B,EAEpB,qBAAqB,EAEpD,OAAOA,CAAW,EAAE,cAAc,CAChC,uCACA,uCACA,uCACA,sCACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_DeviceModel", "import_BleDeviceInfos", "import_StaticDeviceModelDataSource", "deviceModels", "dataSource", "deviceModel1", "deviceModel2", "deviceModel3", "deviceModel4", "deviceModel5", "deviceModels1", "deviceModels2", "deviceModels3", "deviceModels4", "deviceModels5", "deviceModels6", "bleServiceInfos", "bleServices"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.create;var d=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var a=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var r in e)d(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of b(e))!l.call(t,o)&&o!==r&&d(t,o,{get:()=>e[o],enumerable:!(u=m(e,o))||u.enumerable});return t};var g=(t,e,r)=>(r=t!=null?n(a(t)):{},c(e||!t||!t.__esModule?d(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>c(d({},"__esModule",{value:!0}),t);var I={};h(I,{TransportDeviceModel:()=>U});module.exports=S(I);var s=g(require("semver")),i=require("../../device/DeviceModel");class U{id;productName;usbProductId;bootloaderUsbProductId;usbOnly;memorySize;masks;bluetoothSpec;constructor(e){this.id=e.id,this.productName=e.productName,this.usbProductId=e.usbProductId,this.bootloaderUsbProductId=e.bootloaderUsbProductId,this.usbOnly=e.usbOnly,this.memorySize=e.memorySize,this.masks=e.masks,this.bluetoothSpec=e.bluetoothSpec}getBlockSize(e){switch(this.id){case i.DeviceModelId.NANO_S:return s.default.lt(s.default.coerce(e)??"","2.0.0")?4*1024:2*1024;case i.DeviceModelId.NANO_X:return 4*1024;case i.DeviceModelId.NANO_SP:case i.DeviceModelId.STAX:case i.DeviceModelId.FLEX:return 32}}}0&&(module.exports={TransportDeviceModel});
1
+ "use strict";var b=Object.create;var s=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty;var S=(t,e)=>{for(var i in e)s(t,i,{get:e[i],enumerable:!0})},c=(t,e,i,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of m(e))!a.call(t,o)&&o!==i&&s(t,o,{get:()=>e[o],enumerable:!(d=n(e,o))||d.enumerable});return t};var h=(t,e,i)=>(i=t!=null?b(l(t)):{},c(e||!t||!t.__esModule?s(i,"default",{value:t,enumerable:!0}):i,t)),g=t=>c(s({},"__esModule",{value:!0}),t);var I={};S(I,{TransportDeviceModel:()=>U});module.exports=g(I);var u=h(require("semver")),r=require("../../device/DeviceModel");class U{id;productName;usbProductId;bootloaderUsbProductId;usbOnly;memorySize;blockSize;masks;bluetoothSpec;constructor(e){this.id=e.id,this.productName=e.productName,this.usbProductId=e.usbProductId,this.bootloaderUsbProductId=e.bootloaderUsbProductId,this.usbOnly=e.usbOnly,this.memorySize=e.memorySize,this.blockSize=e.blockSize,this.masks=e.masks,this.bluetoothSpec=e.bluetoothSpec}getBlockSize(e){switch(this.id){case r.DeviceModelId.NANO_S:return u.default.lt(u.default.coerce(e)??"","2.0.0")?4*1024:2*1024;case r.DeviceModelId.NANO_X:return 4*1024;case r.DeviceModelId.NANO_SP:case r.DeviceModelId.STAX:case r.DeviceModelId.FLEX:case r.DeviceModelId.APEX:return 32}}}0&&(module.exports={TransportDeviceModel});
2
2
  //# sourceMappingURL=DeviceModel.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-model/model/DeviceModel.ts"],
4
- "sourcesContent": ["import semver from \"semver\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\n/**\n * The info of a device model\n */\nexport class TransportDeviceModel {\n id: DeviceModelId;\n productName: string;\n usbProductId: number;\n bootloaderUsbProductId: number;\n usbOnly: boolean;\n memorySize: number;\n masks: number[];\n bluetoothSpec?: {\n serviceUuid: string;\n writeUuid: string;\n writeCmdUuid: string;\n notifyUuid: string;\n }[];\n\n constructor(props: {\n id: DeviceModelId;\n productName: string;\n usbProductId: number;\n bootloaderUsbProductId: number;\n usbOnly: boolean;\n memorySize: number;\n masks: number[];\n\n bluetoothSpec?: {\n serviceUuid: string;\n writeUuid: string;\n writeCmdUuid: string;\n notifyUuid: string;\n }[];\n }) {\n this.id = props.id;\n this.productName = props.productName;\n this.usbProductId = props.usbProductId;\n this.bootloaderUsbProductId = props.bootloaderUsbProductId;\n this.usbOnly = props.usbOnly;\n this.memorySize = props.memorySize;\n this.masks = props.masks;\n this.bluetoothSpec = props.bluetoothSpec;\n }\n\n getBlockSize(firmwareVersion: string): number {\n switch (this.id) {\n case DeviceModelId.NANO_S:\n return semver.lt(semver.coerce(firmwareVersion) ?? \"\", \"2.0.0\")\n ? 4 * 1024\n : 2 * 1024;\n case DeviceModelId.NANO_X:\n return 4 * 1024;\n case DeviceModelId.NANO_SP:\n case DeviceModelId.STAX:\n case DeviceModelId.FLEX:\n return 32;\n }\n }\n}\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmB,qBAEnBC,EAA8B,mCAKvB,MAAMH,CAAqB,CAChC,GACA,YACA,aACA,uBACA,QACA,WACA,MACA,cAOA,YAAYI,EAeT,CACD,KAAK,GAAKA,EAAM,GAChB,KAAK,YAAcA,EAAM,YACzB,KAAK,aAAeA,EAAM,aAC1B,KAAK,uBAAyBA,EAAM,uBACpC,KAAK,QAAUA,EAAM,QACrB,KAAK,WAAaA,EAAM,WACxB,KAAK,MAAQA,EAAM,MACnB,KAAK,cAAgBA,EAAM,aAC7B,CAEA,aAAaC,EAAiC,CAC5C,OAAQ,KAAK,GAAI,CACf,KAAK,gBAAc,OACjB,OAAO,EAAAC,QAAO,GAAG,EAAAA,QAAO,OAAOD,CAAe,GAAK,GAAI,OAAO,EAC1D,EAAI,KACJ,EAAI,KACV,KAAK,gBAAc,OACjB,MAAO,GAAI,KACb,KAAK,gBAAc,QACnB,KAAK,gBAAc,KACnB,KAAK,gBAAc,KACjB,MAAO,GACX,CACF,CACF",
4
+ "sourcesContent": ["import semver from \"semver\";\n\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\n/**\n * The info of a device model\n */\nexport class TransportDeviceModel {\n id: DeviceModelId;\n productName: string;\n usbProductId: number;\n bootloaderUsbProductId: number;\n usbOnly: boolean;\n memorySize: number;\n blockSize: number;\n masks: number[];\n bluetoothSpec?: {\n serviceUuid: string;\n writeUuid: string;\n writeCmdUuid: string;\n notifyUuid: string;\n }[];\n\n constructor(props: {\n id: DeviceModelId;\n productName: string;\n usbProductId: number;\n bootloaderUsbProductId: number;\n usbOnly: boolean;\n memorySize: number;\n blockSize: number;\n masks: number[];\n\n bluetoothSpec?: {\n serviceUuid: string;\n writeUuid: string;\n writeCmdUuid: string;\n notifyUuid: string;\n }[];\n }) {\n this.id = props.id;\n this.productName = props.productName;\n this.usbProductId = props.usbProductId;\n this.bootloaderUsbProductId = props.bootloaderUsbProductId;\n this.usbOnly = props.usbOnly;\n this.memorySize = props.memorySize;\n this.blockSize = props.blockSize;\n this.masks = props.masks;\n this.bluetoothSpec = props.bluetoothSpec;\n }\n\n getBlockSize(firmwareVersion: string): number {\n switch (this.id) {\n case DeviceModelId.NANO_S:\n return semver.lt(semver.coerce(firmwareVersion) ?? \"\", \"2.0.0\")\n ? 4 * 1024\n : 2 * 1024;\n case DeviceModelId.NANO_X:\n return 4 * 1024;\n case DeviceModelId.NANO_SP:\n case DeviceModelId.STAX:\n case DeviceModelId.FLEX:\n case DeviceModelId.APEX:\n return 32;\n }\n }\n}\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmB,qBAEnBC,EAA8B,mCAKvB,MAAMH,CAAqB,CAChC,GACA,YACA,aACA,uBACA,QACA,WACA,UACA,MACA,cAOA,YAAYI,EAgBT,CACD,KAAK,GAAKA,EAAM,GAChB,KAAK,YAAcA,EAAM,YACzB,KAAK,aAAeA,EAAM,aAC1B,KAAK,uBAAyBA,EAAM,uBACpC,KAAK,QAAUA,EAAM,QACrB,KAAK,WAAaA,EAAM,WACxB,KAAK,UAAYA,EAAM,UACvB,KAAK,MAAQA,EAAM,MACnB,KAAK,cAAgBA,EAAM,aAC7B,CAEA,aAAaC,EAAiC,CAC5C,OAAQ,KAAK,GAAI,CACf,KAAK,gBAAc,OACjB,OAAO,EAAAC,QAAO,GAAG,EAAAA,QAAO,OAAOD,CAAe,GAAK,GAAI,OAAO,EAC1D,EAAI,KACJ,EAAI,KACV,KAAK,gBAAc,OACjB,MAAO,GAAI,KACb,KAAK,gBAAc,QACnB,KAAK,gBAAc,KACnB,KAAK,gBAAc,KACnB,KAAK,gBAAc,KACjB,MAAO,GACX,CACF,CACF",
6
6
  "names": ["DeviceModel_exports", "__export", "TransportDeviceModel", "__toCommonJS", "import_semver", "import_DeviceModel", "props", "firmwareVersion", "semver"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var s=(e,o)=>{for(var r in o)i(e,r,{get:o[r],enumerable:!0})},m=(e,o,r,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of l(o))!a.call(e,d)&&d!==r&&i(e,d,{get:()=>o[d],enumerable:!(t=u(o,d))||t.enumerable});return e};var n=e=>m(i({},"__esModule",{value:!0}),e);var b={};s(b,{deviceModelStubBuilder:()=>p});module.exports=n(b);var c=require("../../device/DeviceModel");function p(e={}){return{id:c.DeviceModelId.NANO_X,productName:"Ledger Nano X",usbProductId:64,bootloaderUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,masks:[855638016],bluetoothSpec:[{serviceUuid:"13d63400-2c97-0004-0000-4c6564676572",notifyUuid:"13d63400-2c97-0004-0001-4c6564676572",writeUuid:"13d63400-2c97-0004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-0004-0003-4c6564676572"}],getBlockSize:()=>4*1024,...e}}0&&(module.exports={deviceModelStubBuilder});
1
+ "use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var s=(e,o)=>{for(var r in o)i(e,r,{get:o[r],enumerable:!0})},m=(e,o,r,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of l(o))!a.call(e,d)&&d!==r&&i(e,d,{get:()=>o[d],enumerable:!(c=u(o,d))||c.enumerable});return e};var n=e=>m(i({},"__esModule",{value:!0}),e);var b={};s(b,{deviceModelStubBuilder:()=>p});module.exports=n(b);var t=require("../../device/DeviceModel");function p(e={}){return{id:t.DeviceModelId.NANO_X,productName:"Ledger Nano X",usbProductId:64,bootloaderUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,blockSize:32,masks:[855638016],bluetoothSpec:[{serviceUuid:"13d63400-2c97-0004-0000-4c6564676572",notifyUuid:"13d63400-2c97-0004-0001-4c6564676572",writeUuid:"13d63400-2c97-0004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-0004-0003-4c6564676572"}],getBlockSize:()=>4*1024,...e}}0&&(module.exports={deviceModelStubBuilder});
2
2
  //# sourceMappingURL=DeviceModel.stub.js.map