@ledgerhq/device-management-kit 0.0.0-fix-rn-ble-20250502082216 → 0.0.0-hid-candidate-20250523130730

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 (284) hide show
  1. package/lib/cjs/package.json +22 -23
  2. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  3. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +2 -2
  4. package/lib/cjs/src/api/command/di/commandModule.js +1 -1
  5. package/lib/cjs/src/api/command/di/commandModule.js.map +3 -3
  6. package/lib/cjs/src/api/command/di/commandModule.test.js +1 -1
  7. package/lib/cjs/src/api/command/di/commandModule.test.js.map +2 -2
  8. package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
  9. package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
  10. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  11. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  12. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  13. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  14. package/lib/cjs/src/api/device-action/di/deviceActionModule.js +1 -1
  15. package/lib/cjs/src/api/device-action/di/deviceActionModule.js.map +3 -3
  16. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js +1 -1
  17. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  18. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  19. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
  20. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  21. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  22. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +1 -1
  23. package/lib/cjs/src/api/device-action/os/Errors.js +1 -1
  24. package/lib/cjs/src/api/device-action/os/Errors.js.map +3 -3
  25. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js +1 -1
  26. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +1 -1
  27. package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js +1 -1
  28. package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js.map +1 -1
  29. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
  30. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
  31. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
  32. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
  33. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +2 -0
  34. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
  35. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
  36. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
  37. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
  38. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
  39. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js +2 -0
  40. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
  41. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  42. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
  43. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  44. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  45. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +1 -1
  46. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
  47. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
  48. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
  49. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
  50. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
  51. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
  52. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
  53. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
  54. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  55. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
  56. package/lib/cjs/src/api/device-model/model/DeviceModel.js +1 -1
  57. package/lib/cjs/src/api/device-model/model/DeviceModel.js.map +2 -2
  58. package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js +1 -1
  59. package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
  60. package/lib/cjs/src/api/index.js +1 -1
  61. package/lib/cjs/src/api/index.js.map +3 -3
  62. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
  63. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
  64. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +2 -2
  65. package/lib/cjs/src/api/transport/model/Errors.js +1 -1
  66. package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
  67. package/lib/cjs/src/api/types.js +1 -1
  68. package/lib/cjs/src/api/types.js.map +1 -1
  69. package/lib/cjs/src/di.js +1 -1
  70. package/lib/cjs/src/di.js.map +2 -2
  71. package/lib/cjs/src/internal/config/di/configModule.js +1 -1
  72. package/lib/cjs/src/internal/config/di/configModule.js.map +3 -3
  73. package/lib/cjs/src/internal/config/di/configModule.test.js +1 -1
  74. package/lib/cjs/src/internal/config/di/configModule.test.js.map +2 -2
  75. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js +1 -1
  76. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  77. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  78. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  79. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  80. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  81. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  82. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  83. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  84. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +2 -2
  85. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  86. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  87. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  88. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  89. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  90. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +2 -2
  91. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  92. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  93. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js +1 -1
  94. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  95. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  96. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  97. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
  98. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  99. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  100. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  101. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  102. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  103. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  104. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  105. package/lib/cjs/src/internal/send/di/sendModule.js +1 -1
  106. package/lib/cjs/src/internal/send/di/sendModule.js.map +3 -3
  107. package/lib/cjs/src/internal/send/di/sendModule.test.js +1 -1
  108. package/lib/cjs/src/internal/send/di/sendModule.test.js.map +2 -2
  109. package/lib/cjs/src/internal/transport/di/transportModule.js +1 -1
  110. package/lib/cjs/src/internal/transport/di/transportModule.js.map +3 -3
  111. package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
  112. package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
  113. package/lib/esm/package.json +22 -23
  114. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  115. package/lib/esm/src/api/DeviceManagementKit.test.js.map +2 -2
  116. package/lib/esm/src/api/command/di/commandModule.js +1 -1
  117. package/lib/esm/src/api/command/di/commandModule.js.map +3 -3
  118. package/lib/esm/src/api/command/di/commandModule.test.js +1 -1
  119. package/lib/esm/src/api/command/di/commandModule.test.js.map +2 -2
  120. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  121. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  122. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  123. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  124. package/lib/esm/src/api/device-action/di/deviceActionModule.js +1 -1
  125. package/lib/esm/src/api/device-action/di/deviceActionModule.js.map +3 -3
  126. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js +1 -1
  127. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  128. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  129. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
  130. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  131. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  132. package/lib/esm/src/api/device-action/os/Errors.js +1 -1
  133. package/lib/esm/src/api/device-action/os/Errors.js.map +3 -3
  134. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
  135. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
  136. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
  137. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
  138. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -0
  139. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
  140. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
  141. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
  142. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
  143. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
  144. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -0
  145. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
  146. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  147. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
  148. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  149. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  150. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
  151. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
  152. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
  153. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
  154. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
  155. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
  156. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
  157. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
  158. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  159. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
  160. package/lib/esm/src/api/device-model/model/DeviceModel.js +1 -1
  161. package/lib/esm/src/api/device-model/model/DeviceModel.js.map +2 -2
  162. package/lib/esm/src/api/device-model/model/DeviceModel.stub.js +1 -1
  163. package/lib/esm/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
  164. package/lib/esm/src/api/index.js +1 -1
  165. package/lib/esm/src/api/index.js.map +3 -3
  166. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
  167. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
  168. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +2 -2
  169. package/lib/esm/src/api/transport/model/Errors.js +1 -1
  170. package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
  171. package/lib/esm/src/di.js +1 -1
  172. package/lib/esm/src/di.js.map +2 -2
  173. package/lib/esm/src/internal/config/di/configModule.js +1 -1
  174. package/lib/esm/src/internal/config/di/configModule.js.map +3 -3
  175. package/lib/esm/src/internal/config/di/configModule.test.js +1 -1
  176. package/lib/esm/src/internal/config/di/configModule.test.js.map +2 -2
  177. package/lib/esm/src/internal/device-model/di/deviceModelModule.js +1 -1
  178. package/lib/esm/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  179. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  180. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  181. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  182. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  183. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  184. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  185. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  186. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +2 -2
  187. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  188. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  189. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  190. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  191. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  192. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +2 -2
  193. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  194. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  195. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js +1 -1
  196. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  197. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  198. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  199. package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
  200. package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  201. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  202. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  203. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  204. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  205. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  206. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  207. package/lib/esm/src/internal/send/di/sendModule.js +1 -1
  208. package/lib/esm/src/internal/send/di/sendModule.js.map +3 -3
  209. package/lib/esm/src/internal/send/di/sendModule.test.js +1 -1
  210. package/lib/esm/src/internal/send/di/sendModule.test.js.map +2 -2
  211. package/lib/esm/src/internal/transport/di/transportModule.js +1 -1
  212. package/lib/esm/src/internal/transport/di/transportModule.js.map +3 -3
  213. package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
  214. package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
  215. package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts.map +1 -1
  216. package/lib/types/src/api/apdu/utils/ApduParser.d.ts.map +1 -1
  217. package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts.map +1 -1
  218. package/lib/types/src/api/command/di/commandModule.d.ts.map +1 -1
  219. package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
  220. package/lib/types/src/api/command/utils/CommandErrors.d.ts.map +1 -1
  221. package/lib/types/src/api/device-action/DeviceAction.d.ts +2 -0
  222. package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
  223. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  224. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts +5 -0
  225. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
  226. package/lib/types/src/api/device-action/di/deviceActionModule.d.ts.map +1 -1
  227. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +1 -1
  228. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -1
  229. package/lib/types/src/api/device-action/os/Errors.d.ts +10 -0
  230. package/lib/types/src/api/device-action/os/Errors.d.ts.map +1 -1
  231. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +5 -6
  232. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -1
  233. package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts +3 -4
  234. package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts.map +1 -1
  235. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts +40 -0
  236. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -0
  237. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts +2 -0
  238. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts.map +1 -0
  239. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +64 -0
  240. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -0
  241. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts +15 -0
  242. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -0
  243. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts +2 -0
  244. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts.map +1 -0
  245. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +25 -0
  246. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -0
  247. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts +1 -1
  248. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
  249. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts +30 -0
  250. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -0
  251. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts +2 -0
  252. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts.map +1 -0
  253. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts +21 -0
  254. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts.map +1 -0
  255. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts +2 -0
  256. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts.map +1 -0
  257. package/lib/types/src/api/device-model/data/StaticDeviceModelDataSource.d.ts.map +1 -1
  258. package/lib/types/src/api/device-model/model/DeviceModel.d.ts +2 -0
  259. package/lib/types/src/api/device-model/model/DeviceModel.d.ts.map +1 -1
  260. package/lib/types/src/api/device-model/model/DeviceModel.stub.d.ts.map +1 -1
  261. package/lib/types/src/api/device-session/service/DefaultApduReceiverService.stub.d.ts.map +1 -1
  262. package/lib/types/src/api/device-session/service/DefaultApduSenderService.stub.d.ts.map +1 -1
  263. package/lib/types/src/api/index.d.ts +4 -1
  264. package/lib/types/src/api/index.d.ts.map +1 -1
  265. package/lib/types/src/api/transport/model/Errors.d.ts +5 -0
  266. package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
  267. package/lib/types/src/api/types.d.ts +3 -1
  268. package/lib/types/src/api/types.d.ts.map +1 -1
  269. package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
  270. package/lib/types/src/di.d.ts.map +1 -1
  271. package/lib/types/src/internal/config/di/configModule.d.ts.map +1 -1
  272. package/lib/types/src/internal/device-model/di/deviceModelModule.d.ts.map +1 -1
  273. package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
  274. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  275. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
  276. package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts.map +1 -1
  277. package/lib/types/src/internal/discovery/di/discoveryModule.d.ts.map +1 -1
  278. package/lib/types/src/internal/logger-publisher/di/loggerModule.d.ts.map +1 -1
  279. package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
  280. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -1
  281. package/lib/types/src/internal/send/di/sendModule.d.ts.map +1 -1
  282. package/lib/types/src/internal/transport/di/transportModule.d.ts.map +1 -1
  283. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  284. package/package.json +14 -15
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/device-management-kit",
3
- "version": "0.6.5",
3
+ "version": "0.7.0",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
@@ -16,9 +16,9 @@
16
16
  ],
17
17
  "scripts": {
18
18
  "prebuild": "rimraf lib",
19
- "build": "pnpm lmdk-build --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
19
+ "build": "pnpm ldmk-tool build --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
20
20
  "dev": "concurrently \"pnpm watch:builds\" \"pnpm watch:types\"",
21
- "watch:builds": "pnpm lmdk-watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
21
+ "watch:builds": "pnpm ldmk-tool watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
22
22
  "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\"",
23
23
  "lint": "eslint",
24
24
  "lint:fix": "pnpm lint --fix",
@@ -32,33 +32,32 @@
32
32
  "module:create": "pnpm hygen core-module with-prompt"
33
33
  },
34
34
  "dependencies": {
35
- "@sentry/minimal": "^6.19.7",
36
- "axios": "^1.8.2",
37
- "inversify": "^6.2.2",
38
- "inversify-logger-middleware": "^3.1.0",
39
- "isomorphic-ws": "^5.0.0",
40
- "purify-ts": "^2.1.0",
41
- "reflect-metadata": "^0.2.2",
42
- "semver": "^7.6.3",
43
- "url": "^0.11.4",
44
- "uuid": "^11.0.3",
45
- "ws": "^8.18.0",
46
- "xstate": "^5.19.2"
35
+ "@sentry/minimal": "catalog:",
36
+ "axios": "catalog:",
37
+ "inversify": "catalog:",
38
+ "isomorphic-ws": "catalog:",
39
+ "purify-ts": "catalog:",
40
+ "reflect-metadata": "catalog:",
41
+ "semver": "catalog:",
42
+ "url": "catalog:",
43
+ "uuid": "catalog:",
44
+ "ws": "catalog:",
45
+ "xstate": "catalog:"
47
46
  },
48
47
  "peerDependencies": {
49
- "rxjs": "^7.8.2"
48
+ "rxjs": "catalog:"
50
49
  },
51
50
  "devDependencies": {
52
- "@ledgerhq/esbuild-tools": "workspace:*",
51
+ "@ledgerhq/ldmk-tool": "workspace:*",
53
52
  "@ledgerhq/eslint-config-dsdk": "workspace:*",
54
53
  "@ledgerhq/prettier-config-dsdk": "workspace:*",
55
54
  "@ledgerhq/tsconfig-dsdk": "workspace:*",
56
55
  "@ledgerhq/vitest-config-dmk": "workspace:*",
57
- "@statelyai/inspect": "^0.4.0",
58
- "@types/semver": "^7.5.8",
59
- "@types/uuid": "^10.0.0",
60
- "@types/ws": "^8.5.14",
61
- "rxjs": "^7.8.2",
62
- "ts-node": "^10.9.2"
56
+ "@statelyai/inspect": "catalog:",
57
+ "@types/semver": "catalog:",
58
+ "@types/uuid": "catalog:",
59
+ "@types/ws": "catalog:",
60
+ "rxjs": "catalog:",
61
+ "ts-node": "catalog:"
63
62
  }
64
63
  }
@@ -1,2 +1,2 @@
1
- "use strict";var C=Object.create;var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var U=(t,o,i,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of S(o))!x.call(t,n)&&n!==i&&a(t,n,{get:()=>o[n],enumerable:!(r=b(o,n))||r.enumerable});return t};var B=(t,o,i)=>(i=t!=null?C(k(t)):{},U(o||!t||!t.__esModule?a(i,"default",{value:t,enumerable:!0}):i,t));var m=require("../internal/config/data/LocalConfigDataSource.stub"),p=require("../internal/config/di/configTypes"),f=require("../internal/device-session/di/deviceSessionTypes"),s=require("../internal/discovery/di/discoveryTypes"),l=require("../internal/manager-api/di/managerApiTypes"),u=require("../internal/send/di/sendTypes"),h=B(require("../../package.json")),v=require("../../src/di.stub"),D=require("./command/di/commandTypes"),g=require("./logger-subscriber/service/ConsoleLogger"),c=require("./DeviceManagementKit");vi.mock("./logger-subscriber/service/ConsoleLogger");let e,d;describe("DeviceManagementKit",()=>{describe("clean",()=>{beforeEach(()=>{d=new g.ConsoleLogger,e=new c.DeviceManagementKit({stub:!1,loggers:[d],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url",firmwareDistributionSalt:"salt"}})}),it("should create an instance",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.DeviceManagementKit)}),it("should return a clean `version`",async()=>{expect(await e.getVersion()).toBe(h.default.version)}),it("should have startDiscovery method",()=>{expect(e.startDiscovering).toBeDefined()}),it("should have stopDiscovery method",()=>{expect(e.stopDiscovering).toBeDefined()}),it("should have connect method",()=>{expect(e.connect).toBeDefined()}),it("should have sendApdu method",()=>{expect(e.sendApdu).toBeDefined()}),it("should have getConnectedDevice method",()=>{expect(e.getConnectedDevice).toBeDefined()}),it("should have sendCommand method",()=>{expect(e.sendCommand).toBeDefined()}),it("should have listConnectedDevices method",()=>{expect(e.listConnectedDevices).toBeDefined()}),it("should have listenToConnectedDevice method",()=>{expect(e.listenToConnectedDevice).toBeDefined()}),it("should have disableDeviceSessionRefresher method",()=>{expect(e.disableDeviceSessionRefresher).toBeDefined()}),it("should have setProvider method",()=>{expect(e.setProvider).toBeDefined()})}),describe("stubbed",()=>{beforeEach(()=>{e=new c.DeviceManagementKit({stub:!0,loggers:[],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url",firmwareDistributionSalt:"salt"}})}),it("should create a stubbed dmk",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.DeviceManagementKit)}),it("should return a stubbed config",()=>{expect(e.container.get(p.configTypes.LocalConfigDataSource)).toBeInstanceOf(m.StubLocalConfigDataSource)}),it("should return a stubbed version",async()=>{expect(await e.getVersion()).toBe("0.0.0-stub.1")}),it.each([[s.discoveryTypes.StartDiscoveringUseCase],[s.discoveryTypes.StopDiscoveringUseCase],[s.discoveryTypes.ConnectUseCase],[u.sendTypes.SendApduUseCase],[D.commandTypes.SendCommandUseCase],[s.discoveryTypes.GetConnectedDeviceUseCase],[s.discoveryTypes.DisconnectUseCase],[f.deviceSessionTypes.GetDeviceSessionStateUseCase],[s.discoveryTypes.ListConnectedDevicesUseCase],[s.discoveryTypes.ListenToConnectedDeviceUseCase],[l.managerApiTypes.SetProviderUseCase]])("should have %s use case",t=>{const o=e.container.get(t);expect(o).toBeInstanceOf(v.StubUseCase),expect(o.execute()).toBe("stub")})})});
1
+ "use strict";var C=Object.create;var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var U=(t,o,i,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of S(o))!x.call(t,n)&&n!==i&&a(t,n,{get:()=>o[n],enumerable:!(c=b(o,n))||c.enumerable});return t};var B=(t,o,i)=>(i=t!=null?C(k(t)):{},U(o||!t||!t.__esModule?a(i,"default",{value:t,enumerable:!0}):i,t));var m=require("../internal/config/data/LocalConfigDataSource.stub"),p=require("../internal/config/di/configTypes"),f=require("../internal/device-session/di/deviceSessionTypes"),s=require("../internal/discovery/di/discoveryTypes"),l=require("../internal/manager-api/di/managerApiTypes"),u=require("../internal/send/di/sendTypes"),h=B(require("../../package.json")),v=require("../../src/di.stub"),D=require("./command/di/commandTypes"),g=require("./logger-subscriber/service/ConsoleLogger"),r=require("./DeviceManagementKit");vi.mock("./logger-subscriber/service/ConsoleLogger");let e,d;describe("DeviceManagementKit",()=>{describe("clean",()=>{beforeEach(()=>{d=new g.ConsoleLogger,e=new r.DeviceManagementKit({stub:!1,loggers:[d],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url",firmwareDistributionSalt:"salt"}})}),it("should create an instance",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(r.DeviceManagementKit)}),it("should return a clean `version`",async()=>{expect(await e.getVersion()).toBe(h.default.version)}),it("should have startDiscovery method",()=>{expect(e.startDiscovering).toBeDefined()}),it("should have stopDiscovery method",()=>{expect(e.stopDiscovering).toBeDefined()}),it("should have connect method",()=>{expect(e.connect).toBeDefined()}),it("should have sendApdu method",()=>{expect(e.sendApdu).toBeDefined()}),it("should have getConnectedDevice method",()=>{expect(e.getConnectedDevice).toBeDefined()}),it("should have sendCommand method",()=>{expect(e.sendCommand).toBeDefined()}),it("should have listConnectedDevices method",()=>{expect(e.listConnectedDevices).toBeDefined()}),it("should have listenToConnectedDevice method",()=>{expect(e.listenToConnectedDevice).toBeDefined()}),it("should have disableDeviceSessionRefresher method",()=>{expect(e.disableDeviceSessionRefresher).toBeDefined()}),it("should have setProvider method",()=>{expect(e.setProvider).toBeDefined()})}),describe("stubbed",()=>{beforeEach(()=>{e=new r.DeviceManagementKit({stub:!0,loggers:[],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url",firmwareDistributionSalt:"salt"}})}),it("should create a stubbed dmk",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(r.DeviceManagementKit)}),it("should return a stubbed config",()=>{expect(e.container.get(p.configTypes.LocalConfigDataSource)).toBeInstanceOf(m.StubLocalConfigDataSource)}),it("should return a stubbed version",async()=>{expect(await e.getVersion()).toBe("0.0.0-stub.1")}),it.each([[s.discoveryTypes.StartDiscoveringUseCase],[s.discoveryTypes.StopDiscoveringUseCase],[s.discoveryTypes.ConnectUseCase],[u.sendTypes.SendApduUseCase],[D.commandTypes.SendCommandUseCase],[s.discoveryTypes.GetConnectedDeviceUseCase],[s.discoveryTypes.DisconnectUseCase],[f.deviceSessionTypes.GetDeviceSessionStateUseCase],[s.discoveryTypes.ListConnectedDevicesUseCase],[s.discoveryTypes.ListenToConnectedDeviceUseCase],[l.managerApiTypes.SetProviderUseCase]])("should have %s use case",t=>{const o=e.container.get(t);expect(o).toBeInstanceOf(v.StubUseCase),expect(o.execute()).toBe("stub")})})});
2
2
  //# sourceMappingURL=DeviceManagementKit.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/DeviceManagementKit.test.ts"],
4
- "sourcesContent": ["import { type interfaces } from \"inversify\";\n\nimport { type LocalConfigDataSource } from \"@internal/config/data/ConfigDataSource\";\nimport { StubLocalConfigDataSource } from \"@internal/config/data/LocalConfigDataSource.stub\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { managerApiTypes } from \"@internal/manager-api/di/managerApiTypes\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport pkg from \"@root/package.json\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandTypes } from \"./command/di/commandTypes\";\nimport { ConsoleLogger } from \"./logger-subscriber/service/ConsoleLogger\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\nimport { type DmkConfig } from \"./DmkConfig\";\n\nvi.mock(\"./logger-subscriber/service/ConsoleLogger\");\n\nlet dmk: DeviceManagementKit;\nlet logger: ConsoleLogger;\ndescribe(\"DeviceManagementKit\", () => {\n describe(\"clean\", () => {\n beforeEach(() => {\n logger = new ConsoleLogger();\n dmk = new DeviceManagementKit({\n stub: false,\n loggers: [logger],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n firmwareDistributionSalt: \"salt\",\n } as DmkConfig,\n });\n });\n\n it(\"should create an instance\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a clean `version`\", async () => {\n expect(await dmk.getVersion()).toBe(pkg.version);\n });\n\n it(\"should have startDiscovery method\", () => {\n expect(dmk.startDiscovering).toBeDefined();\n });\n\n it(\"should have stopDiscovery method\", () => {\n expect(dmk.stopDiscovering).toBeDefined();\n });\n\n it(\"should have connect method\", () => {\n expect(dmk.connect).toBeDefined();\n });\n\n it(\"should have sendApdu method\", () => {\n expect(dmk.sendApdu).toBeDefined();\n });\n\n it(\"should have getConnectedDevice method\", () => {\n expect(dmk.getConnectedDevice).toBeDefined();\n });\n\n it(\"should have sendCommand method\", () => {\n expect(dmk.sendCommand).toBeDefined();\n });\n\n it(\"should have listConnectedDevices method\", () => {\n expect(dmk.listConnectedDevices).toBeDefined();\n });\n\n it(\"should have listenToConnectedDevice method\", () => {\n expect(dmk.listenToConnectedDevice).toBeDefined();\n });\n\n it(\"should have disableDeviceSessionRefresher method\", () => {\n expect(dmk.disableDeviceSessionRefresher).toBeDefined();\n });\n\n it(\"should have setProvider method\", () => {\n expect(dmk.setProvider).toBeDefined();\n });\n });\n\n describe(\"stubbed\", () => {\n beforeEach(() => {\n dmk = new DeviceManagementKit({\n stub: true,\n loggers: [],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n firmwareDistributionSalt: \"salt\",\n } as DmkConfig,\n });\n });\n\n it(\"should create a stubbed dmk\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a stubbed config\", () => {\n expect(\n dmk.container.get<LocalConfigDataSource>(\n configTypes.LocalConfigDataSource,\n ),\n ).toBeInstanceOf(StubLocalConfigDataSource);\n });\n\n it(\"should return a stubbed version\", async () => {\n expect(await dmk.getVersion()).toBe(\"0.0.0-stub.1\");\n });\n\n it.each([\n [discoveryTypes.StartDiscoveringUseCase],\n [discoveryTypes.StopDiscoveringUseCase],\n [discoveryTypes.ConnectUseCase],\n [sendTypes.SendApduUseCase],\n [commandTypes.SendCommandUseCase],\n [discoveryTypes.GetConnectedDeviceUseCase],\n [discoveryTypes.DisconnectUseCase],\n [deviceSessionTypes.GetDeviceSessionStateUseCase],\n [discoveryTypes.ListConnectedDevicesUseCase],\n [discoveryTypes.ListenToConnectedDeviceUseCase],\n [managerApiTypes.SetProviderUseCase],\n ])(\n \"should have %s use case\",\n (diSymbol: interfaces.ServiceIdentifier<StubUseCase>) => {\n const uc = dmk.container.get<StubUseCase>(diSymbol);\n expect(uc).toBeInstanceOf(StubUseCase);\n expect(uc.execute()).toBe(\"stub\");\n },\n );\n });\n});\n"],
5
- "mappings": "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",
4
+ "sourcesContent": ["import { type ServiceIdentifier } from \"inversify\";\n\nimport { type LocalConfigDataSource } from \"@internal/config/data/ConfigDataSource\";\nimport { StubLocalConfigDataSource } from \"@internal/config/data/LocalConfigDataSource.stub\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { managerApiTypes } from \"@internal/manager-api/di/managerApiTypes\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport pkg from \"@root/package.json\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandTypes } from \"./command/di/commandTypes\";\nimport { ConsoleLogger } from \"./logger-subscriber/service/ConsoleLogger\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\nimport { type DmkConfig } from \"./DmkConfig\";\n\nvi.mock(\"./logger-subscriber/service/ConsoleLogger\");\n\nlet dmk: DeviceManagementKit;\nlet logger: ConsoleLogger;\ndescribe(\"DeviceManagementKit\", () => {\n describe(\"clean\", () => {\n beforeEach(() => {\n logger = new ConsoleLogger();\n dmk = new DeviceManagementKit({\n stub: false,\n loggers: [logger],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n firmwareDistributionSalt: \"salt\",\n } as DmkConfig,\n });\n });\n\n it(\"should create an instance\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a clean `version`\", async () => {\n expect(await dmk.getVersion()).toBe(pkg.version);\n });\n\n it(\"should have startDiscovery method\", () => {\n expect(dmk.startDiscovering).toBeDefined();\n });\n\n it(\"should have stopDiscovery method\", () => {\n expect(dmk.stopDiscovering).toBeDefined();\n });\n\n it(\"should have connect method\", () => {\n expect(dmk.connect).toBeDefined();\n });\n\n it(\"should have sendApdu method\", () => {\n expect(dmk.sendApdu).toBeDefined();\n });\n\n it(\"should have getConnectedDevice method\", () => {\n expect(dmk.getConnectedDevice).toBeDefined();\n });\n\n it(\"should have sendCommand method\", () => {\n expect(dmk.sendCommand).toBeDefined();\n });\n\n it(\"should have listConnectedDevices method\", () => {\n expect(dmk.listConnectedDevices).toBeDefined();\n });\n\n it(\"should have listenToConnectedDevice method\", () => {\n expect(dmk.listenToConnectedDevice).toBeDefined();\n });\n\n it(\"should have disableDeviceSessionRefresher method\", () => {\n expect(dmk.disableDeviceSessionRefresher).toBeDefined();\n });\n\n it(\"should have setProvider method\", () => {\n expect(dmk.setProvider).toBeDefined();\n });\n });\n\n describe(\"stubbed\", () => {\n beforeEach(() => {\n dmk = new DeviceManagementKit({\n stub: true,\n loggers: [],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n firmwareDistributionSalt: \"salt\",\n } as DmkConfig,\n });\n });\n\n it(\"should create a stubbed dmk\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a stubbed config\", () => {\n expect(\n dmk.container.get<LocalConfigDataSource>(\n configTypes.LocalConfigDataSource,\n ),\n ).toBeInstanceOf(StubLocalConfigDataSource);\n });\n\n it(\"should return a stubbed version\", async () => {\n expect(await dmk.getVersion()).toBe(\"0.0.0-stub.1\");\n });\n\n it.each([\n [discoveryTypes.StartDiscoveringUseCase],\n [discoveryTypes.StopDiscoveringUseCase],\n [discoveryTypes.ConnectUseCase],\n [sendTypes.SendApduUseCase],\n [commandTypes.SendCommandUseCase],\n [discoveryTypes.GetConnectedDeviceUseCase],\n [discoveryTypes.DisconnectUseCase],\n [deviceSessionTypes.GetDeviceSessionStateUseCase],\n [discoveryTypes.ListConnectedDevicesUseCase],\n [discoveryTypes.ListenToConnectedDeviceUseCase],\n [managerApiTypes.SetProviderUseCase],\n ])(\n \"should have %s use case\",\n (diSymbol: ServiceIdentifier<StubUseCase>) => {\n const uc = dmk.container.get<StubUseCase>(diSymbol);\n expect(uc).toBeInstanceOf(StubUseCase);\n expect(uc.execute()).toBe(\"stub\");\n },\n );\n });\n});\n"],
5
+ "mappings": "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",
6
6
  "names": ["import_LocalConfigDataSource", "import_configTypes", "import_deviceSessionTypes", "import_discoveryTypes", "import_managerApiTypes", "import_sendTypes", "import_package", "import_di", "import_commandTypes", "import_ConsoleLogger", "import_DeviceManagementKit", "dmk", "logger", "pkg", "diSymbol", "uc"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var c=(n,o)=>{for(var m in o)d(n,m,{get:o[m],enumerable:!0})},p=(n,o,m,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of u(o))!l.call(n,e)&&e!==m&&d(n,e,{get:()=>o[e],enumerable:!(a=C(o,e))||a.enumerable});return n};var f=n=>p(d({},"__esModule",{value:!0}),n);var y={};c(y,{commandModuleFactory:()=>b});module.exports=f(y);var s=require("inversify"),r=require("../../command/use-case/SendCommandUseCase"),i=require("../../../../src/di.stub"),t=require("./commandTypes");const b=({stub:n=!1}={})=>new s.ContainerModule((o,m,a,e,_,A,M)=>{o(t.commandTypes.SendCommandUseCase).to(r.SendCommandUseCase),n&&e(t.commandTypes.SendCommandUseCase).to(i.StubUseCase)});0&&(module.exports={commandModuleFactory});
1
+ "use strict";var n=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var f=(e,o)=>{for(var m in o)n(e,m,{get:o[m],enumerable:!0})},u=(e,o,m,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of i(o))!p.call(e,a)&&a!==m&&n(e,a,{get:()=>o[a],enumerable:!(r=l(o,a))||r.enumerable});return e};var c=e=>u(n({},"__esModule",{value:!0}),e);var M={};f(M,{commandModuleFactory:()=>y});module.exports=c(M);var s=require("inversify"),t=require("../../command/use-case/SendCommandUseCase"),C=require("../../../../src/di.stub"),d=require("./commandTypes");const y=({stub:e=!1}={})=>new s.ContainerModule(({bind:o,rebindSync:m})=>{o(d.commandTypes.SendCommandUseCase).to(t.SendCommandUseCase),e&&m(d.commandTypes.SendCommandUseCase).to(C.StubUseCase)});0&&(module.exports={commandModuleFactory});
2
2
  //# sourceMappingURL=commandModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/command/di/commandModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { SendCommandUseCase } from \"@api/command/use-case/SendCommandUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandTypes } from \"./commandTypes\";\n\ntype CommandModuleArgs = Partial<{\n readonly stub: boolean;\n}>;\n\nexport const commandModuleFactory = ({\n stub = false,\n}: CommandModuleArgs = {}) =>\n new ContainerModule(\n (\n bind,\n _unbind,\n _isBound,\n rebind,\n _unbindAsync,\n _onActivation,\n _onDeactivation,\n ) => {\n bind(commandTypes.SendCommandUseCase).to(SendCommandUseCase);\n if (stub) {\n rebind(commandTypes.SendCommandUseCase).to(StubUseCase);\n }\n },\n );\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAmC,oDACnCC,EAA4B,6BAE5BC,EAA6B,0BAMtB,MAAML,EAAuB,CAAC,CACnC,KAAAM,EAAO,EACT,EAAuB,CAAC,IACtB,IAAI,kBACF,CACEC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,IACG,CACHN,EAAK,eAAa,kBAAkB,EAAE,GAAG,oBAAkB,EACvDD,GACFI,EAAO,eAAa,kBAAkB,EAAE,GAAG,aAAW,CAE1D,CACF",
6
- "names": ["commandModule_exports", "__export", "commandModuleFactory", "__toCommonJS", "import_inversify", "import_SendCommandUseCase", "import_di", "import_commandTypes", "stub", "bind", "_unbind", "_isBound", "rebind", "_unbindAsync", "_onActivation", "_onDeactivation"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { SendCommandUseCase } from \"@api/command/use-case/SendCommandUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandTypes } from \"./commandTypes\";\n\ntype CommandModuleArgs = Partial<{\n readonly stub: boolean;\n}>;\n\nexport const commandModuleFactory = ({\n stub = false,\n}: CommandModuleArgs = {}) =>\n new ContainerModule(({ bind, rebindSync }) => {\n bind(commandTypes.SendCommandUseCase).to(SendCommandUseCase);\n if (stub) {\n rebindSync(commandTypes.SendCommandUseCase).to(StubUseCase);\n }\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAmC,oDACnCC,EAA4B,6BAE5BC,EAA6B,0BAMtB,MAAML,EAAuB,CAAC,CACnC,KAAAM,EAAO,EACT,EAAuB,CAAC,IACtB,IAAI,kBAAgB,CAAC,CAAE,KAAAC,EAAM,WAAAC,CAAW,IAAM,CAC5CD,EAAK,eAAa,kBAAkB,EAAE,GAAG,oBAAkB,EACvDD,GACFE,EAAW,eAAa,kBAAkB,EAAE,GAAG,aAAW,CAE9D,CAAC",
6
+ "names": ["commandModule_exports", "__export", "commandModuleFactory", "__toCommonJS", "import_inversify", "import_SendCommandUseCase", "import_di", "import_commandTypes", "stub", "bind", "rebindSync"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=require("inversify"),r=require("../../command/use-case/SendCommandUseCase"),a=require("../../../internal/device-session/di/deviceSessionModule"),s=require("../../../internal/logger-publisher/di/loggerModule"),c=require("../../../../src/di.stub"),d=require("./commandModule"),m=require("./commandTypes");describe("commandModuleFactory",()=>{describe("Default",()=>{let e,o;beforeEach(()=>{o=(0,d.commandModuleFactory)(),e=new n.Container,e.load(o,(0,a.deviceSessionModuleFactory)(),(0,s.loggerModuleFactory)())}),it("should return the config module",()=>{expect(o).toBeDefined()}),it("should return non-stubbed sendCommand usecase",()=>{const t=e.get(m.commandTypes.SendCommandUseCase);expect(t).toBeInstanceOf(r.SendCommandUseCase)})}),describe("Stubbed",()=>{let e,o;beforeEach(()=>{o=(0,d.commandModuleFactory)({stub:!0}),e=new n.Container,e.load(o)}),it("should return the config module",()=>{expect(o).toBeDefined()}),it("should return stubbed sendCommand usecase",()=>{const t=e.get(m.commandTypes.SendCommandUseCase);expect(t).toBeInstanceOf(c.StubUseCase)})})});
1
+ "use strict";var n=require("inversify"),r=require("../../command/use-case/SendCommandUseCase"),a=require("../../../internal/device-session/di/deviceSessionModule"),s=require("../../../internal/logger-publisher/di/loggerModule"),c=require("../../../../src/di.stub"),d=require("./commandModule"),m=require("./commandTypes");describe("commandModuleFactory",()=>{describe("Default",()=>{let e,o;beforeEach(()=>{o=(0,d.commandModuleFactory)(),e=new n.Container,e.loadSync(o,(0,a.deviceSessionModuleFactory)(),(0,s.loggerModuleFactory)())}),it("should return the config module",()=>{expect(o).toBeDefined()}),it("should return non-stubbed sendCommand usecase",()=>{const t=e.get(m.commandTypes.SendCommandUseCase);expect(t).toBeInstanceOf(r.SendCommandUseCase)})}),describe("Stubbed",()=>{let e,o;beforeEach(()=>{o=(0,d.commandModuleFactory)({stub:!0}),e=new n.Container,e.loadSync(o)}),it("should return the config module",()=>{expect(o).toBeDefined()}),it("should return stubbed sendCommand usecase",()=>{const t=e.get(m.commandTypes.SendCommandUseCase);expect(t).toBeInstanceOf(c.StubUseCase)})})});
2
2
  //# sourceMappingURL=commandModule.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/command/di/commandModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { SendCommandUseCase } from \"@api/command/use-case/SendCommandUseCase\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandModuleFactory } from \"./commandModule\";\nimport { commandTypes } from \"./commandTypes\";\n\ndescribe(\"commandModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof commandModuleFactory>;\n beforeEach(() => {\n mod = commandModuleFactory();\n container = new Container();\n container.load(mod, deviceSessionModuleFactory(), loggerModuleFactory());\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return non-stubbed sendCommand usecase\", () => {\n const sendCommandUseCase = container.get<SendCommandUseCase>(\n commandTypes.SendCommandUseCase,\n );\n expect(sendCommandUseCase).toBeInstanceOf(SendCommandUseCase);\n });\n });\n\n describe(\"Stubbed\", () => {\n let container: Container;\n let mod: ReturnType<typeof commandModuleFactory>;\n beforeEach(() => {\n mod = commandModuleFactory({ stub: true });\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return stubbed sendCommand usecase\", () => {\n const sendCommandUseCase = container.get(commandTypes.SendCommandUseCase);\n expect(sendCommandUseCase).toBeInstanceOf(StubUseCase);\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAmC,oDACnCC,EAA2C,2DAC3CC,EAAoC,sDACpCC,EAA4B,6BAE5BC,EAAqC,2BACrCC,EAA6B,0BAE7B,SAAS,uBAAwB,IAAM,CACrC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,wBAAqB,EAC3BD,EAAY,IAAI,YAChBA,EAAU,KAAKC,KAAK,8BAA2B,KAAG,uBAAoB,CAAC,CACzE,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,gDAAiD,IAAM,CACxD,MAAMC,EAAqBF,EAAU,IACnC,eAAa,kBACf,EACA,OAAOE,CAAkB,EAAE,eAAe,oBAAkB,CAC9D,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,IAAIF,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,wBAAqB,CAAE,KAAM,EAAK,CAAC,EACzCD,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,4CAA6C,IAAM,CACpD,MAAMC,EAAqBF,EAAU,IAAI,eAAa,kBAAkB,EACxE,OAAOE,CAAkB,EAAE,eAAe,aAAW,CACvD,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { SendCommandUseCase } from \"@api/command/use-case/SendCommandUseCase\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandModuleFactory } from \"./commandModule\";\nimport { commandTypes } from \"./commandTypes\";\n\ndescribe(\"commandModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof commandModuleFactory>;\n beforeEach(() => {\n mod = commandModuleFactory();\n container = new Container();\n container.loadSync(\n mod,\n deviceSessionModuleFactory(),\n loggerModuleFactory(),\n );\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return non-stubbed sendCommand usecase\", () => {\n const sendCommandUseCase = container.get<SendCommandUseCase>(\n commandTypes.SendCommandUseCase,\n );\n expect(sendCommandUseCase).toBeInstanceOf(SendCommandUseCase);\n });\n });\n\n describe(\"Stubbed\", () => {\n let container: Container;\n let mod: ReturnType<typeof commandModuleFactory>;\n beforeEach(() => {\n mod = commandModuleFactory({ stub: true });\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return stubbed sendCommand usecase\", () => {\n const sendCommandUseCase = container.get(commandTypes.SendCommandUseCase);\n expect(sendCommandUseCase).toBeInstanceOf(StubUseCase);\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAmC,oDACnCC,EAA2C,2DAC3CC,EAAoC,sDACpCC,EAA4B,6BAE5BC,EAAqC,2BACrCC,EAA6B,0BAE7B,SAAS,uBAAwB,IAAM,CACrC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,wBAAqB,EAC3BD,EAAY,IAAI,YAChBA,EAAU,SACRC,KACA,8BAA2B,KAC3B,uBAAoB,CACtB,CACF,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,gDAAiD,IAAM,CACxD,MAAMC,EAAqBF,EAAU,IACnC,eAAa,kBACf,EACA,OAAOE,CAAkB,EAAE,eAAe,oBAAkB,CAC9D,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,IAAIF,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,wBAAqB,CAAE,KAAM,EAAK,CAAC,EACzCD,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,4CAA6C,IAAM,CACpD,MAAMC,EAAqBF,EAAU,IAAI,eAAa,kBAAkB,EACxE,OAAOE,CAAkB,EAAE,eAAe,aAAW,CACvD,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_inversify", "import_SendCommandUseCase", "import_deviceSessionModule", "import_loggerModule", "import_di", "import_commandModule", "import_commandTypes", "container", "mod", "sendCommandUseCase"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(r,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of s(e))!p.call(r,t)&&t!==i&&n(r,t,{get:()=>e[t],enumerable:!(o=a(e,t))||o.enumerable});return r};var c=r=>m(n({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
1
+ "use strict";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(r,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of s(e))!p.call(r,t)&&t!==n&&i(r,t,{get:()=>e[t],enumerable:!(o=a(e,t))||o.enumerable});return r};var c=r=>m(i({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
2
2
  //# sourceMappingURL=DeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/api/device-action/DeviceAction.ts"],
4
- "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DmkError } from \"@api/Error\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { type DeviceActionState } from \"./model/DeviceActionState\";\n\nexport type InternalApi = {\n readonly sendApdu: (\n apdu: Uint8Array,\n ) => Promise<Either<DmkError, ApduResponse>>;\n readonly sendCommand: <Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n abortTimeout?: number,\n ) => Promise<CommandResult<Response, ErrorStatusCodes>>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly getDeviceSessionStateObservable: () => Observable<DeviceSessionState>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n readonly disableRefresher: (blockerId: string) => () => void;\n readonly getManagerApiService: () => ManagerApiService;\n readonly getSecureChannelService: () => SecureChannelService;\n};\n\nexport type DeviceActionIntermediateValue = {\n readonly requiredUserInteraction: string;\n};\n\nexport type ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> = {\n readonly observable: Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >;\n cancel(): void;\n};\n\nexport interface DeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n> {\n readonly input: Input;\n\n _execute(\n params: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue>;\n}\n"],
4
+ "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { type TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DmkError } from \"@api/Error\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { type DeviceActionState } from \"./model/DeviceActionState\";\n\nexport type InternalApi = {\n readonly sendApdu: (\n apdu: Uint8Array,\n ) => Promise<Either<DmkError, ApduResponse>>;\n readonly sendCommand: <Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n abortTimeout?: number,\n ) => Promise<CommandResult<Response, ErrorStatusCodes>>;\n readonly getDeviceModel: () => TransportDeviceModel;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly getDeviceSessionStateObservable: () => Observable<DeviceSessionState>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n readonly disableRefresher: (blockerId: string) => () => void;\n readonly getManagerApiService: () => ManagerApiService;\n readonly getSecureChannelService: () => SecureChannelService;\n};\n\nexport type DeviceActionIntermediateValue = {\n readonly requiredUserInteraction: string;\n};\n\nexport type ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> = {\n readonly observable: Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >;\n cancel(): void;\n};\n\nexport interface DeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n> {\n readonly input: Input;\n\n _execute(\n params: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue>;\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["DeviceAction_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var v=(n,e)=>{for(var i in e)c(n,i,{get:e[i],enumerable:!0})},S=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!r.call(n,t)&&t!==i&&c(n,t,{get:()=>e[t],enumerable:!(o=s(e,t))||o.enumerable});return n};var p=n=>S(c({},"__esModule",{value:!0}),n);var b={};v(b,{makeDeviceActionInternalApiMock:()=>D});module.exports=p(b);const f=vi.fn(),M=vi.fn(),d=vi.fn(),k=vi.fn(),l=vi.fn(),m=vi.fn(),g=vi.fn(),A=vi.fn();function D(){return{sendApdu:f,sendCommand:M,getDeviceSessionState:d,getDeviceSessionStateObservable:k,setDeviceSessionState:l,getManagerApiService:m,getSecureChannelService:g,disableRefresher:A}}0&&(module.exports={makeDeviceActionInternalApiMock});
1
+ "use strict";var c=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var v=(n,e)=>{for(var i in e)c(n,i,{get:e[i],enumerable:!0})},S=(n,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!r.call(n,t)&&t!==i&&c(n,t,{get:()=>e[t],enumerable:!(o=s(e,t))||o.enumerable});return n};var M=n=>S(c({},"__esModule",{value:!0}),n);var u={};v(u,{makeDeviceActionInternalApiMock:()=>b});module.exports=M(u);const p=vi.fn(),d=vi.fn(),f=vi.fn(),k=vi.fn(),l=vi.fn(),g=vi.fn(),m=vi.fn(),D=vi.fn(),A=vi.fn();function b(){return{sendApdu:p,sendCommand:d,getDeviceModel:f,getDeviceSessionState:k,getDeviceSessionStateObservable:l,setDeviceSessionState:g,getManagerApiService:m,getSecureChannelService:D,disableRefresher:A}}0&&(module.exports={makeDeviceActionInternalApiMock});
2
2
  //# sourceMappingURL=makeInternalApi.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/__test-utils__/makeInternalApi.ts"],
4
- "sourcesContent": ["import { type Mocked } from \"vitest\";\n\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\n\nconst sendApduMock = vi.fn();\nconst sendCommandMock = vi.fn();\nconst apiGetDeviceSessionStateMock = vi.fn();\nconst apiGetDeviceSessionStateObservableMock = vi.fn();\nconst setDeviceSessionStateMock = vi.fn();\nconst getManagerApiServiceMock = vi.fn();\nconst getSecureChannelServiceMock = vi.fn();\nconst disableRefresherMock = vi.fn();\n\nexport function makeDeviceActionInternalApiMock(): Mocked<InternalApi> {\n return {\n sendApdu: sendApduMock,\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n getDeviceSessionStateObservable: apiGetDeviceSessionStateObservableMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n getManagerApiService: getManagerApiServiceMock,\n getSecureChannelService: getSecureChannelServiceMock,\n disableRefresher: disableRefresherMock,\n };\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,IAAA,eAAAC,EAAAH,GAIA,MAAMI,EAAe,GAAG,GAAG,EACrBC,EAAkB,GAAG,GAAG,EACxBC,EAA+B,GAAG,GAAG,EACrCC,EAAyC,GAAG,GAAG,EAC/CC,EAA4B,GAAG,GAAG,EAClCC,EAA2B,GAAG,GAAG,EACjCC,EAA8B,GAAG,GAAG,EACpCC,EAAuB,GAAG,GAAG,EAE5B,SAAST,GAAuD,CACrE,MAAO,CACL,SAAUE,EACV,YAAaC,EACb,sBAAuBC,EACvB,gCAAiCC,EACjC,sBAAuBC,EACvB,qBAAsBC,EACtB,wBAAyBC,EACzB,iBAAkBC,CACpB,CACF",
6
- "names": ["makeInternalApi_exports", "__export", "makeDeviceActionInternalApiMock", "__toCommonJS", "sendApduMock", "sendCommandMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "setDeviceSessionStateMock", "getManagerApiServiceMock", "getSecureChannelServiceMock", "disableRefresherMock"]
4
+ "sourcesContent": ["import { type Mocked } from \"vitest\";\n\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\n\nconst sendApduMock = vi.fn();\nconst sendCommandMock = vi.fn();\nconst apiGetDeviceModelMock = vi.fn();\nconst apiGetDeviceSessionStateMock = vi.fn();\nconst apiGetDeviceSessionStateObservableMock = vi.fn();\nconst setDeviceSessionStateMock = vi.fn();\nconst getManagerApiServiceMock = vi.fn();\nconst getSecureChannelServiceMock = vi.fn();\nconst disableRefresherMock = vi.fn();\n\nexport function makeDeviceActionInternalApiMock(): Mocked<InternalApi> {\n return {\n sendApdu: sendApduMock,\n sendCommand: sendCommandMock,\n getDeviceModel: apiGetDeviceModelMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n getDeviceSessionStateObservable: apiGetDeviceSessionStateObservableMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n getManagerApiService: getManagerApiServiceMock,\n getSecureChannelService: getSecureChannelServiceMock,\n disableRefresher: disableRefresherMock,\n };\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,IAAA,eAAAC,EAAAH,GAIA,MAAMI,EAAe,GAAG,GAAG,EACrBC,EAAkB,GAAG,GAAG,EACxBC,EAAwB,GAAG,GAAG,EAC9BC,EAA+B,GAAG,GAAG,EACrCC,EAAyC,GAAG,GAAG,EAC/CC,EAA4B,GAAG,GAAG,EAClCC,EAA2B,GAAG,GAAG,EACjCC,EAA8B,GAAG,GAAG,EACpCC,EAAuB,GAAG,GAAG,EAE5B,SAASV,GAAuD,CACrE,MAAO,CACL,SAAUE,EACV,YAAaC,EACb,eAAgBC,EAChB,sBAAuBC,EACvB,gCAAiCC,EACjC,sBAAuBC,EACvB,qBAAsBC,EACtB,wBAAyBC,EACzB,iBAAkBC,CACpB,CACF",
6
+ "names": ["makeInternalApi_exports", "__export", "makeDeviceActionInternalApiMock", "__toCommonJS", "sendApduMock", "sendCommandMock", "apiGetDeviceModelMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "setDeviceSessionStateMock", "getManagerApiServiceMock", "getSecureChannelServiceMock", "disableRefresherMock"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var o in e)p(t,o,{get:e[o],enumerable:!0})},I=(t,e,o,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of A(e))!k.call(t,r)&&r!==o&&p(t,r,{get:()=>e[r],enumerable:!(m=u(e,r))||m.enumerable});return t};var D=t=>I(p({},"__esModule",{value:!0}),t);var S={};y(S,{setupGetDeviceStatusMock:()=>h,setupGoToDashboardMock:()=>v,setupListAppsMock:()=>M,setupListInstalledAppsMock:()=>L});module.exports=D(S);var n=require("purify-ts"),i=require("xstate"),a=require("../../device-action/model/UserInteractionRequired"),c=require("../../device-action/os/Errors"),s=require("../../device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),d=require("../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),l=require("../../device-action/os/ListApps/ListAppsDeviceAction"),f=require("../../secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction");const M=(t,e=!1)=>{l.ListAppsDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,i.createMachine)({id:"MockListAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,i.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.AllowListApps})})},done:{type:"final"}},output:()=>e?(0,n.Left)(new c.UnknownDAError("ListApps failed")):(0,n.Right)(t)}))}))},v=(t=!1)=>{d.GoToDashboardDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,i.createMachine)({id:"MockGoToDashboardDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,i.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.None})})},done:{type:"final"}},output:()=>t?(0,n.Left)(new c.UnknownDAError("GoToDashboard failed")):(0,n.Right)(void 0)}))}))},h=(t=[{currentApp:"BOLOS",currentAppVersion:"1.0.0"}])=>{const e=vi.fn();for(const o of t)e.mockImplementationOnce(()=>"currentApp"in o?(0,n.Right)(o):(0,n.Left)(o));s.GetDeviceStatusDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,i.createMachine)({id:"MockGetDeviceStatusDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,i.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.None})})},done:{type:"final"}},output:e}))}))},L=(t=[])=>{f.ListInstalledAppsDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,i.createMachine)({id:"MockListInstalledAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,i.assign)({intermediateValue:()=>({requiredUserInteraction:a.UserInteractionRequired.None})})},done:{type:"final"}},output:t.reduce((e,o)=>e.mockImplementationOnce(()=>"installedApps"in o?(0,n.Right)(o):(0,n.Left)(o)),vi.fn()).mockImplementation(()=>(0,n.Right)([]))}))}))};0&&(module.exports={setupGetDeviceStatusMock,setupGoToDashboardMock,setupListAppsMock,setupListInstalledAppsMock});
1
+ "use strict";var c=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var o in t)c(e,o,{get:t[o],enumerable:!0})},v=(e,t,o,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of I(t))!D.call(e,p)&&p!==o&&c(e,p,{get:()=>t[p],enumerable:!(m=y(t,p))||m.enumerable});return e};var O=e=>v(c({},"__esModule",{value:!0}),e);var w={};M(w,{setupGetDeviceMetadataMock:()=>h,setupGetDeviceStatusMock:()=>L,setupGoToDashboardMock:()=>V,setupInstallOrUpdateAppsMock:()=>G,setupListAppsMock:()=>U,setupListInstalledAppsMock:()=>q,setupOpenAppMock:()=>S});module.exports=O(w);var n=require("purify-ts"),a=require("xstate"),i=require("../../device-action/model/UserInteractionRequired"),r=require("../../device-action/os/Errors"),s=require("../../device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction"),d=require("../../device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),l=require("../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),u=require("../../device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction"),f=require("../../device-action/os/ListApps/ListAppsDeviceAction"),A=require("../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),k=require("../../secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction");const U=(e,t=!1)=>{f.ListAppsDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,a.createMachine)({id:"MockListAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,a.assign)({intermediateValue:()=>({requiredUserInteraction:i.UserInteractionRequired.AllowListApps})})},done:{type:"final"}},output:()=>t?(0,n.Left)(new r.UnknownDAError("ListApps failed")):(0,n.Right)(e)}))}))},h=(e,t=!1)=>{s.GetDeviceMetadataDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,a.createMachine)({id:"MockGetDeviceMetadataDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,a.assign)({intermediateValue:()=>({requiredUserInteraction:i.UserInteractionRequired.None})})},done:{type:"final"}},output:()=>t?(0,n.Left)(new r.UnknownDAError("GetDeviceMetadata failed")):(0,n.Right)(e)}))}))},G=(e,t,o=!1)=>{u.InstallOrUpdateAppsDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,a.createMachine)({id:"MockInstallOrUpdateAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,a.assign)({intermediateValue:()=>t})},done:{type:"final"}},output:()=>o?(0,n.Left)(new r.UnknownDAError("InstallOrUpdateApps failed")):(0,n.Right)(e)}))}))},S=(e=!1)=>{A.OpenAppDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,a.createMachine)({initial:"ready",states:{ready:{entry:(0,a.assign)({intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.ConfirmOpenApp}}),after:{0:"done"}},done:{type:"final"}},output:()=>e?(0,n.Left)(new r.UnknownDAError("OpenApp failed")):(0,n.Right)(void 0)}))}))},V=(e=!1)=>{l.GoToDashboardDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,a.createMachine)({id:"MockGoToDashboardDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,a.assign)({intermediateValue:()=>({requiredUserInteraction:i.UserInteractionRequired.None})})},done:{type:"final"}},output:()=>e?(0,n.Left)(new r.UnknownDAError("GoToDashboard failed")):(0,n.Right)(void 0)}))}))},L=(e=[{currentApp:"BOLOS",currentAppVersion:"1.0.0"}])=>{const t=vi.fn();for(const o of e)t.mockImplementationOnce(()=>"currentApp"in o?(0,n.Right)(o):(0,n.Left)(o));d.GetDeviceStatusDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,a.createMachine)({id:"MockGetDeviceStatusDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,a.assign)({intermediateValue:()=>({requiredUserInteraction:i.UserInteractionRequired.None})})},done:{type:"final"}},output:t}))}))},q=(e=[])=>{k.ListInstalledAppsDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,a.createMachine)({id:"MockListInstalledAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:(0,a.assign)({intermediateValue:()=>({requiredUserInteraction:i.UserInteractionRequired.None})})},done:{type:"final"}},output:e.reduce((t,o)=>t.mockImplementationOnce(()=>"installedApps"in o?(0,n.Right)(o):(0,n.Left)(o)),vi.fn()).mockImplementation(()=>(0,n.Right)([]))}))}))};0&&(module.exports={setupGetDeviceMetadataMock,setupGetDeviceStatusMock,setupGoToDashboardMock,setupInstallOrUpdateAppsMock,setupListAppsMock,setupListInstalledAppsMock,setupOpenAppMock});
2
2
  //# sourceMappingURL=setupTestMachine.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/__test-utils__/setupTestMachine.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { type Mock } from \"vitest\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nimport { type DmkError } from \"@api/Error\";\nimport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nimport { type InstalledApp } from \"@api/secure-channel/device-action/ListInstalledApps/types\";\n\nimport { type BTC_APP } from \"./data\";\n\ntype App = typeof BTC_APP;\n\nexport const setupListAppsMock = (apps: App[], error = false) => {\n (ListAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"ListApps failed\"))\n : Right(apps);\n },\n }),\n ),\n }));\n};\n\nexport const setupGoToDashboardMock = (error: boolean = false) => {\n (GoToDashboardDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGoToDashboardDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"GoToDashboard failed\"))\n : Right(undefined);\n },\n }),\n ),\n }));\n};\n\nexport const setupGetDeviceStatusMock = (\n outputs: ReadonlyArray<\n { currentApp: string; currentAppVersion: string } | DmkError\n > = [\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n ],\n) => {\n const outputFn = vi.fn();\n\n for (const output of outputs) {\n outputFn.mockImplementationOnce(() =>\n \"currentApp\" in output ? Right(output) : Left(output),\n );\n }\n (GetDeviceStatusDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGetDeviceStatusDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputFn,\n }),\n ),\n }));\n};\n\nexport const setupListInstalledAppsMock = (\n outputs: Array<{ installedApps: InstalledApp[] } | DmkError> = [],\n) => {\n (ListInstalledAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListInstalledAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputs\n .reduce(\n (mockFn, output) =>\n mockFn.mockImplementationOnce(() =>\n \"installedApps\" in output ? Right(output) : Left(output),\n ),\n vi.fn(),\n )\n .mockImplementation(() => Right([])),\n }),\n ),\n }));\n};\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,EAAA,2BAAAC,EAAA,sBAAAC,EAAA,+BAAAC,IAAA,eAAAC,EAAAN,GAAA,IAAAO,EAA4B,qBAE5BC,EAAsC,kBAEtCC,EAAwC,4DACxCC,EAA+B,wCAC/BC,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAqC,+DAErCC,EAA8C,6FAOvC,MAAMV,EAAoB,CAACW,EAAaC,EAAQ,KAAU,CAC9D,uBAA8B,mBAAmB,KAAO,CACvD,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,OAC3C,iBAAc,CACZ,GAAI,2BACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,aACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IACCA,KACH,QAAK,IAAI,iBAAe,iBAAiB,CAAC,KAC1C,SAAMD,CAAI,CAElB,CAAC,CACH,CACF,EAAE,CACJ,EAEaZ,EAAyB,CAACa,EAAiB,KAAU,CAC/D,4BAAmC,mBAAmB,KAAO,CAC5D,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,OAC3C,iBAAc,CACZ,GAAI,gCACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IACCA,KACH,QAAK,IAAI,iBAAe,sBAAsB,CAAC,KAC/C,SAAM,MAAS,CAEvB,CAAC,CACH,CACF,EAAE,CACJ,EAEad,EAA2B,CACtCe,EAEI,CACF,CACE,WAAY,QACZ,kBAAmB,OACrB,CACF,IACG,CACH,MAAMC,EAAW,GAAG,GAAG,EAEvB,UAAWC,KAAUF,EACnBC,EAAS,uBAAuB,IAC9B,eAAgBC,KAAS,SAAMA,CAAM,KAAI,QAAKA,CAAM,CACtD,EAED,8BAAqC,mBAAmB,KAAO,CAC9D,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,OAC3C,iBAAc,CACZ,GAAI,kCACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQD,CACV,CAAC,CACH,CACF,EAAE,CACJ,EAEab,EAA6B,CACxCY,EAA+D,CAAC,IAC7D,CACF,gCAAuC,mBAAmB,KAAO,CAChE,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,OAC3C,iBAAc,CACZ,GAAI,oCACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,SAAO,UAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyB,0BAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQA,EACL,OACC,CAACG,EAAQD,IACPC,EAAO,uBAAuB,IAC5B,kBAAmBD,KAAS,SAAMA,CAAM,KAAI,QAAKA,CAAM,CACzD,EACF,GAAG,GAAG,CACR,EACC,mBAAmB,OAAM,SAAM,CAAC,CAAC,CAAC,CACvC,CAAC,CACH,CACF,EAAE,CACJ",
6
- "names": ["setupTestMachine_exports", "__export", "setupGetDeviceStatusMock", "setupGoToDashboardMock", "setupListAppsMock", "setupListInstalledAppsMock", "__toCommonJS", "import_purify_ts", "import_xstate", "import_UserInteractionRequired", "import_Errors", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_ListAppsDeviceAction", "import_ListInstalledAppsDeviceAction", "apps", "error", "outputs", "outputFn", "output", "mockFn"]
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { type Mock } from \"vitest\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nimport { type GetDeviceMetadataDAOutput } from \"@api/device-action/os/GetDeviceMetadata/types\";\nimport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nimport {\n type InstallOrUpdateAppsDAIntermediateValue,\n type InstallOrUpdateAppsDAOutput,\n} from \"@api/device-action/os/InstallOrUpdateApps/types\";\nimport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { type DmkError } from \"@api/Error\";\nimport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nimport { type InstalledApp } from \"@api/secure-channel/device-action/ListInstalledApps/types\";\n\nimport { type BTC_APP } from \"./data\";\n\ntype App = typeof BTC_APP;\n\nexport const setupListAppsMock = (apps: App[], error = false) => {\n (ListAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"ListApps failed\"))\n : Right(apps);\n },\n }),\n ),\n }));\n};\n\nexport const setupGetDeviceMetadataMock = (\n metadata: GetDeviceMetadataDAOutput,\n error = false,\n) => {\n (GetDeviceMetadataDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGetDeviceMetadataDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"GetDeviceMetadata failed\"))\n : Right(metadata);\n },\n }),\n ),\n }));\n};\n\nexport const setupInstallOrUpdateAppsMock = (\n result: InstallOrUpdateAppsDAOutput,\n intermediateValue: InstallOrUpdateAppsDAIntermediateValue,\n error = false,\n) => {\n (InstallOrUpdateAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockInstallOrUpdateAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => intermediateValue,\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"InstallOrUpdateApps failed\"))\n : Right(result);\n },\n }),\n ),\n }));\n};\n\nexport const setupOpenAppMock = (error: boolean = false) => {\n (OpenAppDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n initial: \"ready\",\n states: {\n ready: {\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: () => {\n return error\n ? Left(new UnknownDAError(\"OpenApp failed\"))\n : Right(undefined);\n },\n }),\n ),\n }));\n};\n\nexport const setupGoToDashboardMock = (error: boolean = false) => {\n (GoToDashboardDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGoToDashboardDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"GoToDashboard failed\"))\n : Right(undefined);\n },\n }),\n ),\n }));\n};\n\nexport const setupGetDeviceStatusMock = (\n outputs: ReadonlyArray<\n { currentApp: string; currentAppVersion: string } | DmkError\n > = [\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n ],\n) => {\n const outputFn = vi.fn();\n\n for (const output of outputs) {\n outputFn.mockImplementationOnce(() =>\n \"currentApp\" in output ? Right(output) : Left(output),\n );\n }\n (GetDeviceStatusDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGetDeviceStatusDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputFn,\n }),\n ),\n }));\n};\n\nexport const setupListInstalledAppsMock = (\n outputs: Array<{ installedApps: InstalledApp[] } | DmkError> = [],\n) => {\n (ListInstalledAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListInstalledAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputs\n .reduce(\n (mockFn, output) =>\n mockFn.mockImplementationOnce(() =>\n \"installedApps\" in output ? Right(output) : Left(output),\n ),\n vi.fn(),\n )\n .mockImplementation(() => Right([])),\n }),\n ),\n }));\n};\n"],
5
+ "mappings": "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",
6
+ "names": ["setupTestMachine_exports", "__export", "setupGetDeviceMetadataMock", "setupGetDeviceStatusMock", "setupGoToDashboardMock", "setupInstallOrUpdateAppsMock", "setupListAppsMock", "setupListInstalledAppsMock", "setupOpenAppMock", "__toCommonJS", "import_purify_ts", "import_xstate", "import_UserInteractionRequired", "import_Errors", "import_GetDeviceMetadataDeviceAction", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_InstallOrUpdateAppsDeviceAction", "import_ListAppsDeviceAction", "import_OpenAppDeviceAction", "import_ListInstalledAppsDeviceAction", "apps", "error", "metadata", "result", "intermediateValue", "outputs", "outputFn", "output", "mockFn"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var l=(o,e)=>{for(var t in e)c(o,t,{get:e[t],enumerable:!0})},m=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of d(e))!v.call(o,i)&&i!==t&&c(o,i,{get:()=>e[i],enumerable:!(n=A(e,i))||n.enumerable});return o};var p=o=>m(c({},"__esModule",{value:!0}),o);var D={};l(D,{deviceActionModuleFactory:()=>f});module.exports=p(D);var r=require("inversify"),a=require("../../device-action/use-case/ExecuteDeviceActionUseCase"),u=require("../../../../src/di.stub"),s=require("./deviceActionTypes");const f=({stub:o=!1}={})=>new r.ContainerModule((e,t,n,i,b,y,C)=>{e(s.deviceActionTypes.ExecuteDeviceActionUseCase).to(a.ExecuteDeviceActionUseCase),o&&i(s.deviceActionTypes.ExecuteDeviceActionUseCase).to(u.StubUseCase)});0&&(module.exports={deviceActionModuleFactory});
1
+ "use strict";var c=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var d=(o,e)=>{for(var t in e)c(o,t,{get:e[t],enumerable:!0})},p=(o,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!m.call(o,i)&&i!==t&&c(o,i,{get:()=>e[i],enumerable:!(s=A(e,i))||s.enumerable});return o};var v=o=>p(c({},"__esModule",{value:!0}),o);var C={};d(C,{deviceActionModuleFactory:()=>f});module.exports=v(C);var n=require("inversify"),a=require("../../device-action/use-case/ExecuteDeviceActionUseCase"),u=require("../../../../src/di.stub"),r=require("./deviceActionTypes");const f=({stub:o=!1}={})=>new n.ContainerModule(({bind:e,rebindSync:t})=>{e(r.deviceActionTypes.ExecuteDeviceActionUseCase).to(a.ExecuteDeviceActionUseCase),o&&t(r.deviceActionTypes.ExecuteDeviceActionUseCase).to(u.StubUseCase)});0&&(module.exports={deviceActionModuleFactory});
2
2
  //# sourceMappingURL=deviceActionModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/di/deviceActionModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { ExecuteDeviceActionUseCase } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { deviceActionTypes } from \"./deviceActionTypes\";\n\ntype DeviceActionModuleArgs = Partial<{\n readonly stub: boolean;\n}>;\n\nexport const deviceActionModuleFactory = ({\n stub = false,\n}: DeviceActionModuleArgs = {}) =>\n new ContainerModule(\n (\n bind,\n _unbind,\n _isBound,\n rebind,\n _unbindAsync,\n _onActivation,\n _onDeactivation,\n ) => {\n bind(deviceActionTypes.ExecuteDeviceActionUseCase).to(\n ExecuteDeviceActionUseCase,\n );\n if (stub) {\n rebind(deviceActionTypes.ExecuteDeviceActionUseCase).to(StubUseCase);\n }\n },\n );\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA2C,kEAC3CC,EAA4B,6BAE5BC,EAAkC,+BAM3B,MAAML,EAA4B,CAAC,CACxC,KAAAM,EAAO,EACT,EAA4B,CAAC,IAC3B,IAAI,kBACF,CACEC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,IACG,CACHN,EAAK,oBAAkB,0BAA0B,EAAE,GACjD,4BACF,EACID,GACFI,EAAO,oBAAkB,0BAA0B,EAAE,GAAG,aAAW,CAEvE,CACF",
6
- "names": ["deviceActionModule_exports", "__export", "deviceActionModuleFactory", "__toCommonJS", "import_inversify", "import_ExecuteDeviceActionUseCase", "import_di", "import_deviceActionTypes", "stub", "bind", "_unbind", "_isBound", "rebind", "_unbindAsync", "_onActivation", "_onDeactivation"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { ExecuteDeviceActionUseCase } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { deviceActionTypes } from \"./deviceActionTypes\";\n\ntype DeviceActionModuleArgs = Partial<{\n readonly stub: boolean;\n}>;\n\nexport const deviceActionModuleFactory = ({\n stub = false,\n}: DeviceActionModuleArgs = {}) =>\n new ContainerModule(({ bind, rebindSync }) => {\n bind(deviceActionTypes.ExecuteDeviceActionUseCase).to(\n ExecuteDeviceActionUseCase,\n );\n if (stub) {\n rebindSync(deviceActionTypes.ExecuteDeviceActionUseCase).to(StubUseCase);\n }\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA2C,kEAC3CC,EAA4B,6BAE5BC,EAAkC,+BAM3B,MAAML,EAA4B,CAAC,CACxC,KAAAM,EAAO,EACT,EAA4B,CAAC,IAC3B,IAAI,kBAAgB,CAAC,CAAE,KAAAC,EAAM,WAAAC,CAAW,IAAM,CAC5CD,EAAK,oBAAkB,0BAA0B,EAAE,GACjD,4BACF,EACID,GACFE,EAAW,oBAAkB,0BAA0B,EAAE,GAAG,aAAW,CAE3E,CAAC",
6
+ "names": ["deviceActionModule_exports", "__export", "deviceActionModuleFactory", "__toCommonJS", "import_inversify", "import_ExecuteDeviceActionUseCase", "import_di", "import_deviceActionTypes", "stub", "bind", "rebindSync"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var c=require("inversify"),r=require("../../device-action/use-case/ExecuteDeviceActionUseCase"),s=require("../../../internal/device-session/di/deviceSessionModule"),u=require("../../../internal/logger-publisher/di/loggerModule"),d=require("../../../../src/di.stub"),i=require("./deviceActionModule"),n=require("./deviceActionTypes");describe("deviceActionModule",()=>{describe("Default",()=>{let e,t;beforeEach(()=>{t=(0,i.deviceActionModuleFactory)(),e=new c.Container,e.load(t,(0,s.deviceSessionModuleFactory)(),(0,u.loggerModuleFactory)())}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return non-stubbed executeDeviceAction usecase",()=>{const o=e.get(n.deviceActionTypes.ExecuteDeviceActionUseCase);expect(o).toBeInstanceOf(r.ExecuteDeviceActionUseCase)})}),describe("Stubbed",()=>{let e,t;beforeEach(()=>{t=(0,i.deviceActionModuleFactory)({stub:!0}),e=new c.Container,e.load(t)}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return stubbed executeDeviceAction usecase",()=>{const o=e.get(n.deviceActionTypes.ExecuteDeviceActionUseCase);expect(o).toBeInstanceOf(d.StubUseCase)})})});
1
+ "use strict";var c=require("inversify"),r=require("../../device-action/use-case/ExecuteDeviceActionUseCase"),s=require("../../../internal/device-session/di/deviceSessionModule"),u=require("../../../internal/logger-publisher/di/loggerModule"),d=require("../../../../src/di.stub"),i=require("./deviceActionModule"),n=require("./deviceActionTypes");describe("deviceActionModule",()=>{describe("Default",()=>{let e,t;beforeEach(()=>{t=(0,i.deviceActionModuleFactory)(),e=new c.Container,e.loadSync(t,(0,s.deviceSessionModuleFactory)(),(0,u.loggerModuleFactory)())}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return non-stubbed executeDeviceAction usecase",()=>{const o=e.get(n.deviceActionTypes.ExecuteDeviceActionUseCase);expect(o).toBeInstanceOf(r.ExecuteDeviceActionUseCase)})}),describe("Stubbed",()=>{let e,t;beforeEach(()=>{t=(0,i.deviceActionModuleFactory)({stub:!0}),e=new c.Container,e.loadSync(t)}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return stubbed executeDeviceAction usecase",()=>{const o=e.get(n.deviceActionTypes.ExecuteDeviceActionUseCase);expect(o).toBeInstanceOf(d.StubUseCase)})})});
2
2
  //# sourceMappingURL=deviceActionModule.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/di/deviceActionModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { ExecuteDeviceActionUseCase } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { deviceActionModuleFactory } from \"./deviceActionModule\";\nimport { deviceActionTypes } from \"./deviceActionTypes\";\n\ndescribe(\"deviceActionModule\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof deviceActionModuleFactory>;\n beforeEach(() => {\n mod = deviceActionModuleFactory();\n container = new Container();\n container.load(mod, deviceSessionModuleFactory(), loggerModuleFactory());\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return non-stubbed executeDeviceAction usecase\", () => {\n const executeDeviceActionUseCase =\n container.get<ExecuteDeviceActionUseCase>(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n );\n expect(executeDeviceActionUseCase).toBeInstanceOf(\n ExecuteDeviceActionUseCase,\n );\n });\n });\n\n describe(\"Stubbed\", () => {\n let container: Container;\n let mod: ReturnType<typeof deviceActionModuleFactory>;\n beforeEach(() => {\n mod = deviceActionModuleFactory({ stub: true });\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return stubbed executeDeviceAction usecase\", () => {\n const executeDeviceActionUseCase = container.get(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n );\n expect(executeDeviceActionUseCase).toBeInstanceOf(StubUseCase);\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAA2C,kEAC3CC,EAA2C,2DAC3CC,EAAoC,sDACpCC,EAA4B,6BAE5BC,EAA0C,gCAC1CC,EAAkC,+BAElC,SAAS,qBAAsB,IAAM,CACnC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,6BAA0B,EAChCD,EAAY,IAAI,YAChBA,EAAU,KAAKC,KAAK,8BAA2B,KAAG,uBAAoB,CAAC,CACzE,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,wDAAyD,IAAM,CAChE,MAAMC,EACJF,EAAU,IACR,oBAAkB,0BACpB,EACF,OAAOE,CAA0B,EAAE,eACjC,4BACF,CACF,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,IAAIF,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,6BAA0B,CAAE,KAAM,EAAK,CAAC,EAC9CD,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,oDAAqD,IAAM,CAC5D,MAAMC,EAA6BF,EAAU,IAC3C,oBAAkB,0BACpB,EACA,OAAOE,CAA0B,EAAE,eAAe,aAAW,CAC/D,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { ExecuteDeviceActionUseCase } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { deviceActionModuleFactory } from \"./deviceActionModule\";\nimport { deviceActionTypes } from \"./deviceActionTypes\";\n\ndescribe(\"deviceActionModule\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof deviceActionModuleFactory>;\n beforeEach(() => {\n mod = deviceActionModuleFactory();\n container = new Container();\n container.loadSync(\n mod,\n deviceSessionModuleFactory(),\n loggerModuleFactory(),\n );\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return non-stubbed executeDeviceAction usecase\", () => {\n const executeDeviceActionUseCase =\n container.get<ExecuteDeviceActionUseCase>(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n );\n expect(executeDeviceActionUseCase).toBeInstanceOf(\n ExecuteDeviceActionUseCase,\n );\n });\n });\n\n describe(\"Stubbed\", () => {\n let container: Container;\n let mod: ReturnType<typeof deviceActionModuleFactory>;\n beforeEach(() => {\n mod = deviceActionModuleFactory({ stub: true });\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return stubbed executeDeviceAction usecase\", () => {\n const executeDeviceActionUseCase = container.get(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n );\n expect(executeDeviceActionUseCase).toBeInstanceOf(StubUseCase);\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAA2C,kEAC3CC,EAA2C,2DAC3CC,EAAoC,sDACpCC,EAA4B,6BAE5BC,EAA0C,gCAC1CC,EAAkC,+BAElC,SAAS,qBAAsB,IAAM,CACnC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,6BAA0B,EAChCD,EAAY,IAAI,YAChBA,EAAU,SACRC,KACA,8BAA2B,KAC3B,uBAAoB,CACtB,CACF,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,wDAAyD,IAAM,CAChE,MAAMC,EACJF,EAAU,IACR,oBAAkB,0BACpB,EACF,OAAOE,CAA0B,EAAE,eACjC,4BACF,CACF,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,IAAIF,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,6BAA0B,CAAE,KAAM,EAAK,CAAC,EAC9CD,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,oDAAqD,IAAM,CAC5D,MAAMC,EAA6BF,EAAU,IAC3C,oBAAkB,0BACpB,EACA,OAAOE,CAA0B,EAAE,eAAe,aAAW,CAC/D,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_inversify", "import_ExecuteDeviceActionUseCase", "import_deviceSessionModule", "import_loggerModule", "import_di", "import_deviceActionModule", "import_deviceActionTypes", "container", "mod", "executeDeviceActionUseCase"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var I=(r,t)=>{for(var s in t)o(r,s,{get:t[s],enumerable:!0})},C=(r,t,s,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!m.call(r,n)&&n!==s&&o(r,n,{get:()=>t[n],enumerable:!(e=A(t,n))||e.enumerable});return r};var d=r=>C(o({},"__esModule",{value:!0}),r);var S={};I(S,{CallTaskInAppDeviceAction:()=>D});module.exports=d(S);var p=require("purify-ts"),a=require("xstate"),l=require("../../../command/model/CommandResult"),i=require("../../../device-action/model/UserInteractionRequired"),c=require("../../../device-action/os/Errors"),u=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),k=require("../../../device-action/xstate-utils/XStateDeviceAction");class D extends k.XStateDeviceAction{makeStateMachine(t){const{callTask:s}=this.extractDependencies(t);return(0,a.setup)({types:{input:{},context:{},output:{}},actors:{callTask:(0,a.fromPromise)(s),openAppStateMachine:new u.OpenAppDeviceAction({input:{appName:this.input.appName,compatibleAppNames:this.input.compatibleAppNames}}).makeStateMachine(t)},guards:{skipOpenApp:()=>!!this.input.skipOpenApp,noInternalError:({context:e})=>e._internalState.error===null},actions:{assignErrorFromEvent:(0,a.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"CallTaskInAppDeviceAction",initial:"InitialState",context:({input:e})=>({input:e,intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None},_internalState:{taskResponse:null,error:null}}),states:{InitialState:{always:[{target:"CallTask",guard:"skipOpenApp"},"OpenAppDeviceAction"]},OpenAppDeviceAction:{invoke:{id:"openAppStateMachine",input:{appName:this.input.appName,compatibleAppNames:this.input.compatibleAppNames},src:"openAppStateMachine",onSnapshot:{actions:(0,a.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{actions:(0,a.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:n=>({...e.context._internalState,error:n})})}),target:"CheckOpenAppDeviceActionResult"}}},CheckOpenAppDeviceActionResult:{always:[{target:"CallTask",guard:"noInternalError"},"Error"]},CallTask:{entry:(0,a.assign)({intermediateValue:{requiredUserInteraction:this.input.requiredUserInteraction}}),exit:(0,a.assign)({intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None}}),invoke:{id:"callTask",src:"callTask",input:e=>e.context.input.task,onDone:{target:"CallTaskResultCheck",actions:[(0,a.assign)({_internalState:({event:e,context:n})=>(0,l.isSuccessCommandResult)(e.output)?{...n._internalState,taskResponse:e.output.data}:{...n._internalState,error:e.output.error}})]},onError:{target:"Error",actions:"assignErrorFromEvent"}}},CallTaskResultCheck:{always:[{target:"Success",guard:"noInternalError"},"Error"]},Success:{type:"final"},Error:{type:"final"}},output:({context:e})=>e._internalState.taskResponse?(0,p.Right)(e._internalState.taskResponse):(0,p.Left)(e._internalState.error||new c.UnknownDAError("No error in final state"))})}extractDependencies(t){return{callTask:s=>s.input(t)}}}0&&(module.exports={CallTaskInAppDeviceAction});
1
+ "use strict";var o=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var I=(r,t)=>{for(var s in t)o(r,s,{get:t[s],enumerable:!0})},C=(r,t,s,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!m.call(r,n)&&n!==s&&o(r,n,{get:()=>t[n],enumerable:!(e=A(t,n))||e.enumerable});return r};var d=r=>C(o({},"__esModule",{value:!0}),r);var S={};I(S,{CallTaskInAppDeviceAction:()=>D});module.exports=d(S);var p=require("purify-ts"),a=require("xstate"),l=require("../../../command/model/CommandResult"),i=require("../../../device-action/model/UserInteractionRequired"),c=require("../../../device-action/os/Errors"),u=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),k=require("../../../device-action/xstate-utils/XStateDeviceAction");class D extends k.XStateDeviceAction{makeStateMachine(t){const{callTask:s}=this.extractDependencies(t);return(0,a.setup)({types:{input:{},context:{},output:{}},actors:{callTask:(0,a.fromPromise)(s),openAppStateMachine:new u.OpenAppDeviceAction({input:{appName:this.input.appName,compatibleAppNames:this.input.compatibleAppNames}}).makeStateMachine(t)},guards:{skipOpenApp:()=>this.input.skipOpenApp,noInternalError:({context:e})=>e._internalState.error===null},actions:{assignErrorFromEvent:(0,a.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"CallTaskInAppDeviceAction",initial:"InitialState",context:({input:e})=>({input:e,intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None},_internalState:{taskResponse:null,error:null}}),states:{InitialState:{always:[{target:"CallTask",guard:"skipOpenApp"},"OpenAppDeviceAction"]},OpenAppDeviceAction:{invoke:{id:"openAppStateMachine",input:{appName:this.input.appName,compatibleAppNames:this.input.compatibleAppNames},src:"openAppStateMachine",onSnapshot:{actions:(0,a.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{actions:(0,a.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:n=>({...e.context._internalState,error:n})})}),target:"CheckOpenAppDeviceActionResult"}}},CheckOpenAppDeviceActionResult:{always:[{target:"CallTask",guard:"noInternalError"},"Error"]},CallTask:{entry:(0,a.assign)({intermediateValue:{requiredUserInteraction:this.input.requiredUserInteraction}}),exit:(0,a.assign)({intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None}}),invoke:{id:"callTask",src:"callTask",input:e=>e.context.input.task,onDone:{target:"CallTaskResultCheck",actions:[(0,a.assign)({_internalState:({event:e,context:n})=>(0,l.isSuccessCommandResult)(e.output)?{...n._internalState,taskResponse:e.output.data}:{...n._internalState,error:e.output.error}})]},onError:{target:"Error",actions:"assignErrorFromEvent"}}},CallTaskResultCheck:{always:[{target:"Success",guard:"noInternalError"},"Error"]},Success:{type:"final"},Error:{type:"final"}},output:({context:e})=>e._internalState.taskResponse?(0,p.Right)(e._internalState.taskResponse):(0,p.Left)(e._internalState.error||new c.UnknownDAError("No error in final state"))})}extractDependencies(t){return{callTask:s=>s.input(t)}}}0&&(module.exports={CallTaskInAppDeviceAction});
2
2
  //# sourceMappingURL=CallTaskInAppDeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport {\n type CommandResult,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\n\nimport {\n type CallTaskInAppDAError,\n type CallTaskInAppDAInput,\n type CallTaskInAppDAIntermediateValue,\n type CallTaskInAppDAInternalState,\n type CallTaskInAppDAOutput,\n} from \"./CallTaskInAppDeviceActionTypes\";\n\n/**\n * Tries to open an app on the device, and if it is successful, calls a task\n * in the app.\n * The output will be the result of the task.\n *\n * ```ts\n * input: {\n * appName: string;\n * task: (internalApi: InternalApi) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n * requiredUserInteraction: UserInteraction;\n * }\n * ```\n *\n * Example of usage:\n *\n * ```ts\n * const deviceAction = new CallTaskInAppDeviceAction({\n * input: {\n * appName: \"MyApp\",\n * task: async (internalApi: InternalApi) => internalApi.sendCommand(new MyAppSpecificCommand()),\n * requiredUserInteraction: UserInteractionRequired.None,\n * },\n * });\n * dmk.executeDeviceAction({ sessionId: \"mySessionId\", deviceAction });\n * ```\n */\nexport class CallTaskInAppDeviceAction<\n TaskResponse,\n TaskErrorCodes,\n UserInteraction extends UserInteractionRequired,\n> extends XStateDeviceAction<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n> {\n makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n > {\n type types = StateMachineTypes<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n >;\n\n const { callTask } = this.extractDependencies(internalAPI);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n callTask: fromPromise(callTask),\n openAppStateMachine: new OpenAppDeviceAction({\n input: {\n appName: this.input.appName,\n compatibleAppNames: this.input.compatibleAppNames,\n },\n }).makeStateMachine(internalAPI),\n },\n guards: {\n skipOpenApp: () => !!this.input.skipOpenApp,\n noInternalError: ({ context }) => context._internalState.error === null,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n },\n }).createMachine({\n id: \"CallTaskInAppDeviceAction\",\n initial: \"InitialState\",\n context: ({ input }) => {\n return {\n input: input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n taskResponse: null,\n error: null,\n },\n };\n },\n states: {\n InitialState: {\n always: [\n {\n target: \"CallTask\",\n guard: \"skipOpenApp\",\n },\n \"OpenAppDeviceAction\",\n ],\n },\n OpenAppDeviceAction: {\n invoke: {\n id: \"openAppStateMachine\",\n input: {\n appName: this.input.appName,\n compatibleAppNames: this.input.compatibleAppNames,\n },\n src: \"openAppStateMachine\",\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n >({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n target: \"CheckOpenAppDeviceActionResult\",\n },\n },\n },\n CheckOpenAppDeviceActionResult: {\n always: [\n {\n target: \"CallTask\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n CallTask: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: this.input.requiredUserInteraction,\n },\n }),\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n }),\n invoke: {\n id: \"callTask\",\n src: \"callTask\",\n input: (_: { context: types[\"context\"] }) => _.context.input.task,\n onDone: {\n target: \"CallTaskResultCheck\",\n actions: [\n assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n taskResponse: event.output.data,\n };\n }\n return {\n ...context._internalState,\n error: event.output.error,\n };\n },\n }),\n ],\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n CallTaskResultCheck: {\n always: [\n {\n target: \"Success\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: ({ context }) =>\n context._internalState.taskResponse\n ? Right(context._internalState.taskResponse)\n : Left(\n context._internalState.error ||\n new UnknownDAError(\"No error in final state\"),\n ),\n });\n }\n\n extractDependencies(internalApi: InternalApi) {\n return {\n callTask: (_: {\n input: (\n internalApi: InternalApi,\n ) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n }): Promise<CommandResult<TaskResponse, TaskErrorCodes>> =>\n _.input(internalApi),\n };\n }\n}\n"],
5
- "mappings": "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",
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport {\n type CommandResult,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\n\nimport {\n type CallTaskInAppDAError,\n type CallTaskInAppDAInput,\n type CallTaskInAppDAIntermediateValue,\n type CallTaskInAppDAInternalState,\n type CallTaskInAppDAOutput,\n} from \"./CallTaskInAppDeviceActionTypes\";\n\n/**\n * Tries to open an app on the device, and if it is successful, calls a task\n * in the app.\n * The output will be the result of the task.\n *\n * ```ts\n * input: {\n * appName: string;\n * task: (internalApi: InternalApi) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n * requiredUserInteraction: UserInteraction;\n * }\n * ```\n *\n * Example of usage:\n *\n * ```ts\n * const deviceAction = new CallTaskInAppDeviceAction({\n * input: {\n * appName: \"MyApp\",\n * task: async (internalApi: InternalApi) => internalApi.sendCommand(new MyAppSpecificCommand()),\n * requiredUserInteraction: UserInteractionRequired.None,\n * },\n * });\n * dmk.executeDeviceAction({ sessionId: \"mySessionId\", deviceAction });\n * ```\n */\nexport class CallTaskInAppDeviceAction<\n TaskResponse,\n TaskErrorCodes,\n UserInteraction extends UserInteractionRequired,\n> extends XStateDeviceAction<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n> {\n makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n > {\n type types = StateMachineTypes<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n >;\n\n const { callTask } = this.extractDependencies(internalAPI);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n callTask: fromPromise(callTask),\n openAppStateMachine: new OpenAppDeviceAction({\n input: {\n appName: this.input.appName,\n compatibleAppNames: this.input.compatibleAppNames,\n },\n }).makeStateMachine(internalAPI),\n },\n guards: {\n skipOpenApp: () => this.input.skipOpenApp,\n noInternalError: ({ context }) => context._internalState.error === null,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n },\n }).createMachine({\n id: \"CallTaskInAppDeviceAction\",\n initial: \"InitialState\",\n context: ({ input }) => {\n return {\n input: input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n taskResponse: null,\n error: null,\n },\n };\n },\n states: {\n InitialState: {\n always: [\n {\n target: \"CallTask\",\n guard: \"skipOpenApp\",\n },\n \"OpenAppDeviceAction\",\n ],\n },\n OpenAppDeviceAction: {\n invoke: {\n id: \"openAppStateMachine\",\n input: {\n appName: this.input.appName,\n compatibleAppNames: this.input.compatibleAppNames,\n },\n src: \"openAppStateMachine\",\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n >({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n target: \"CheckOpenAppDeviceActionResult\",\n },\n },\n },\n CheckOpenAppDeviceActionResult: {\n always: [\n {\n target: \"CallTask\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n CallTask: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: this.input.requiredUserInteraction,\n },\n }),\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n }),\n invoke: {\n id: \"callTask\",\n src: \"callTask\",\n input: (_: { context: types[\"context\"] }) => _.context.input.task,\n onDone: {\n target: \"CallTaskResultCheck\",\n actions: [\n assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n taskResponse: event.output.data,\n };\n }\n return {\n ...context._internalState,\n error: event.output.error,\n };\n },\n }),\n ],\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n CallTaskResultCheck: {\n always: [\n {\n target: \"Success\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: ({ context }) =>\n context._internalState.taskResponse\n ? Right(context._internalState.taskResponse)\n : Left(\n context._internalState.error ||\n new UnknownDAError(\"No error in final state\"),\n ),\n });\n }\n\n extractDependencies(internalApi: InternalApi) {\n return {\n callTask: (_: {\n input: (\n internalApi: InternalApi,\n ) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n }): Promise<CommandResult<TaskResponse, TaskErrorCodes>> =>\n _.input(internalApi),\n };\n }\n}\n"],
5
+ "mappings": "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",
6
6
  "names": ["CallTaskInAppDeviceAction_exports", "__export", "CallTaskInAppDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandResult", "import_UserInteractionRequired", "import_Errors", "import_OpenAppDeviceAction", "import_XStateDeviceAction", "internalAPI", "callTask", "context", "_", "input", "error", "event", "internalApi"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var f=require("purify-ts"),C=require("xstate"),I=require("../../../apdu/utils/ApduBuilder"),u=require("../../../command/model/CommandResult"),p=require("../../../device-action/__test-utils__/makeInternalApi"),k=require("../../../device-action/__test-utils__/testDeviceActionStates"),n=require("../../../device-action/model/DeviceActionState"),e=require("../../../device-action/model/UserInteractionRequired"),v=require("../../../device-action/os/Errors"),M=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),D=require("../../../../../src"),c=require("./CallTaskInAppDeviceAction");vi.mock("@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction",async a=>{const o=await a();return{...o,OpenAppDeviceAction:vi.fn(()=>({...o.OpenAppDeviceAction,makeStateMachine:vi.fn()}))}});const A=a=>{M.OpenAppDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,C.createMachine)({initial:"pending",states:{pending:{entry:(0,C.assign)({intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}}),after:{0:"done"}},done:{type:"final"}},output:()=>a?(0,f.Left)(a):(0,f.Right)(void 0)}))}))};describe("CallTaskInAppDeviceAction",()=>{const a=vi.fn(),o=()=>({callTask:a}),{sendCommand:w}=(0,p.makeDeviceActionInternalApiMock)(),m={paramString:"aParameter",paramNumber:1234},y={aNumber:5678,aString:"mockedResponseString"};beforeEach(()=>{vi.resetAllMocks()}),describe("without mocking extractDependencies",()=>{it("should call sendCommand on internalApi with the correct parameters",async()=>{A(),w.mockResolvedValue((0,u.CommandResultFactory)({data:void 0}));const i=new c.CallTaskInAppDeviceAction({input:{task:async r=>await r.sendCommand(new d(m)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}});await new Promise((r,t)=>{i._execute((0,p.makeDeviceActionInternalApiMock)()).observable.subscribe({error:()=>t(),complete:()=>r(),next:()=>{}})}),expect(w).toHaveBeenCalledWith(new d(m))})}),describe("error cases",()=>{it("should error and output the error if the open app fails",()=>new Promise((i,r)=>{A(new v.UnknownDAError("Mocked error"));const t=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:n.DeviceActionStatus.Error,error:new v.UnknownDAError("Mocked error")}];(0,k.testDeviceActionStates)(new c.CallTaskInAppDeviceAction({input:{task:async s=>await s.sendCommand(new d(m)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}}),t,(0,p.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})})),it("should error and output an error if the call task fails",()=>new Promise((i,r)=>{A(),a.mockResolvedValue((0,u.CommandResultFactory)({error:new D.UnknownDeviceExchangeError("Mocked error")}));const t=new c.CallTaskInAppDeviceAction({input:{task:async l=>await l.sendCommand(new d(m)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}});vi.spyOn(t,"extractDependencies").mockImplementation(o);const s=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}},{status:n.DeviceActionStatus.Error,error:new D.UnknownDeviceExchangeError("Mocked error")}];(0,k.testDeviceActionStates)(t,s,(0,p.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})}))}),describe("success cases",()=>{it("should succeed and output the command result if the send command succeeds",()=>new Promise((i,r)=>{A(),a.mockResolvedValue((0,u.CommandResultFactory)({data:y}));const t=new c.CallTaskInAppDeviceAction({input:{task:async l=>await l.sendCommand(new d(m)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}});vi.spyOn(t,"extractDependencies").mockImplementation(o);const s=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}},{status:n.DeviceActionStatus.Completed,output:y}];(0,k.testDeviceActionStates)(t,s,(0,p.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})})),it("should succeed while skipping OpenApp",()=>new Promise((i,r)=>{A(),a.mockResolvedValue((0,u.CommandResultFactory)({data:y}));const t=new c.CallTaskInAppDeviceAction({input:{task:async l=>await l.sendCommand(new d(m)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!0}});vi.spyOn(t,"extractDependencies").mockImplementation(o);const s=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}},{status:n.DeviceActionStatus.Completed,output:y}];(0,k.testDeviceActionStates)(t,s,(0,p.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})}))})});class d{params;constructor(o){this.params=o}getApdu(){return new I.ApduBuilder({cla:0,ins:1,p1:2,p2:3}).add32BitUIntToData(this.params.paramNumber).addAsciiStringToData(this.params.paramString).build()}parseResponse(){return(0,u.CommandResultFactory)({data:{aNumber:1,aString:"aString"}})}}
1
+ "use strict";var f=require("purify-ts"),C=require("xstate"),I=require("../../../apdu/utils/ApduBuilder"),u=require("../../../command/model/CommandResult"),p=require("../../../device-action/__test-utils__/makeInternalApi"),k=require("../../../device-action/__test-utils__/testDeviceActionStates"),n=require("../../../device-action/model/DeviceActionState"),e=require("../../../device-action/model/UserInteractionRequired"),v=require("../../../device-action/os/Errors"),M=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),D=require("../../../../../src"),c=require("./CallTaskInAppDeviceAction");vi.mock("@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction",async a=>{const o=await a();return{...o,OpenAppDeviceAction:vi.fn(()=>({...o.OpenAppDeviceAction,makeStateMachine:vi.fn()}))}});const A=a=>{M.OpenAppDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,C.createMachine)({initial:"pending",states:{pending:{entry:(0,C.assign)({intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}}),after:{0:"done"}},done:{type:"final"}},output:()=>a?(0,f.Left)(a):(0,f.Right)(void 0)}))}))};describe("CallTaskInAppDeviceAction",()=>{const a=vi.fn(),o=()=>({callTask:a}),{sendCommand:w}=(0,p.makeDeviceActionInternalApiMock)(),m={paramString:"aParameter",paramNumber:1234},y={aNumber:5678,aString:"mockedResponseString"};beforeEach(()=>{vi.resetAllMocks()}),describe("without mocking extractDependencies",()=>{it("should call sendCommand on internalApi with the correct parameters",async()=>{A(),w.mockResolvedValue((0,u.CommandResultFactory)({data:void 0}));const i=new c.CallTaskInAppDeviceAction({input:{task:async r=>await r.sendCommand(new d(m)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}});await new Promise((r,t)=>{i._execute((0,p.makeDeviceActionInternalApiMock)()).observable.subscribe({error:()=>t(),complete:()=>r(),next:()=>{}})}),expect(w).toHaveBeenCalledWith(new d(m))})}),describe("error cases",()=>{it("should error and output the error if the open app fails",()=>new Promise((i,r)=>{A(new v.UnknownDAError("Mocked error"));const t=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:n.DeviceActionStatus.Error,error:new v.UnknownDAError("Mocked error")}];(0,k.testDeviceActionStates)(new c.CallTaskInAppDeviceAction({input:{task:async s=>await s.sendCommand(new d(m)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}}),t,(0,p.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})})),it("should error and output an error if the call task fails",()=>new Promise((i,r)=>{A(),a.mockResolvedValue((0,u.CommandResultFactory)({error:new D.UnknownDeviceExchangeError("Mocked error")}));const t=new c.CallTaskInAppDeviceAction({input:{task:async l=>await l.sendCommand(new d(m)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}});vi.spyOn(t,"extractDependencies").mockImplementation(o);const s=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}},{status:n.DeviceActionStatus.Error,error:new D.UnknownDeviceExchangeError("Mocked error")}];(0,k.testDeviceActionStates)(t,s,(0,p.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})}))}),describe("success cases",()=>{it("should succeed and output the command result if the send command succeeds",()=>new Promise((i,r)=>{A(),a.mockResolvedValue((0,u.CommandResultFactory)({data:y}));const t=new c.CallTaskInAppDeviceAction({input:{task:async l=>await l.sendCommand(new d(m)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}});vi.spyOn(t,"extractDependencies").mockImplementation(o);const s=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}},{status:n.DeviceActionStatus.Completed,output:y}];(0,k.testDeviceActionStates)(t,s,(0,p.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})})),it("should succeed while skipping OpenApp",()=>new Promise((i,r)=>{A(),a.mockResolvedValue((0,u.CommandResultFactory)({data:y}));const t=new c.CallTaskInAppDeviceAction({input:{task:async l=>await l.sendCommand(new d(m)),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!0}});vi.spyOn(t,"extractDependencies").mockImplementation(o);const s=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}},{status:n.DeviceActionStatus.Completed,output:y}];(0,k.testDeviceActionStates)(t,s,(0,p.makeDeviceActionInternalApiMock)(),{onDone:i,onError:r})}))})});class d{params;constructor(o){this.params=o}getApdu(){return new I.ApduBuilder({cla:0,ins:1,p1:2,p2:3}).add32BitUIntToData(this.params.paramNumber).addAsciiStringToData(this.params.paramString).build()}parseResponse(){return(0,u.CommandResultFactory)({data:{aNumber:1,aString:"aString"}})}}
2
2
  //# sourceMappingURL=CallTaskInAppDeviceAction.test.js.map