@ledgerhq/device-management-kit 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (390) hide show
  1. package/README.md +63 -28
  2. package/lib/cjs/package.json +1 -1
  3. package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
  4. package/lib/cjs/src/api/DeviceManagementKit.js.map +2 -2
  5. package/lib/cjs/src/api/apdu/utils/ApduBuilder.js +1 -1
  6. package/lib/cjs/src/api/apdu/utils/ApduBuilder.js.map +3 -3
  7. package/lib/cjs/src/api/command/os/GetBackgroundImageSizeCommand.js +2 -0
  8. package/lib/cjs/src/api/command/os/GetBackgroundImageSizeCommand.js.map +7 -0
  9. package/lib/cjs/src/api/command/os/GetBackgroundImageSizeCommand.test.js +2 -0
  10. package/lib/cjs/src/api/command/os/GetBackgroundImageSizeCommand.test.js.map +7 -0
  11. package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
  12. package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
  13. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  14. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  15. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  16. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  17. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
  18. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  19. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  20. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +3 -3
  21. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  22. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +3 -3
  23. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -1
  24. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +3 -3
  25. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
  26. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
  27. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +1 -1
  28. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +3 -3
  29. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js +1 -1
  30. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +3 -3
  31. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  32. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +3 -3
  33. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  34. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
  35. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/types.js +1 -1
  36. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/types.js.map +3 -3
  37. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
  38. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
  39. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
  40. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +3 -3
  41. package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js +1 -1
  42. package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js.map +3 -3
  43. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
  44. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +2 -2
  45. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +1 -1
  46. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +2 -2
  47. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -1
  48. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +3 -3
  49. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
  50. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +3 -3
  51. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js +1 -1
  52. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js.map +3 -3
  53. package/lib/cjs/src/api/device-action/os/ListApps/types.js +1 -1
  54. package/lib/cjs/src/api/device-action/os/ListApps/types.js.map +3 -3
  55. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  56. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  57. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
  58. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
  59. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/types.js +1 -1
  60. package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/types.js.map +3 -3
  61. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  62. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
  63. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  64. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  65. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -1
  66. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js.map +3 -3
  67. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
  68. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +3 -3
  69. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +1 -1
  70. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +3 -3
  71. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -1
  72. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +3 -3
  73. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  74. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +3 -3
  75. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  76. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +3 -3
  77. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js +1 -1
  78. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +3 -3
  79. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
  80. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js.map +3 -3
  81. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  82. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
  83. package/lib/cjs/src/api/index.js +1 -1
  84. package/lib/cjs/src/api/index.js.map +3 -3
  85. package/lib/cjs/src/api/logger-publisher/utils/noopLoggerFactory.js +2 -0
  86. package/lib/cjs/src/api/logger-publisher/utils/noopLoggerFactory.js.map +7 -0
  87. package/lib/cjs/src/api/logger-publisher/utils/noopLoggerFactory.test.js +2 -0
  88. package/lib/cjs/src/api/logger-publisher/utils/noopLoggerFactory.test.js.map +7 -0
  89. package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
  90. package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +2 -2
  91. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  92. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  93. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  94. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
  95. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js +1 -1
  96. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +3 -3
  97. package/lib/cjs/src/api/transport/model/Errors.js +1 -1
  98. package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
  99. package/lib/cjs/src/api/types.js +1 -1
  100. package/lib/cjs/src/api/types.js.map +1 -1
  101. package/lib/cjs/src/api/utils/ApplicationChecker.js +2 -0
  102. package/lib/cjs/src/api/utils/ApplicationChecker.js.map +7 -0
  103. package/lib/cjs/src/api/utils/ApplicationChecker.test.js +2 -0
  104. package/lib/cjs/src/api/utils/ApplicationChecker.test.js.map +7 -0
  105. package/lib/cjs/src/api/utils/ApplicationResolver.js +2 -0
  106. package/lib/cjs/src/api/utils/ApplicationResolver.js.map +7 -0
  107. package/lib/cjs/src/api/utils/Base64String.js +1 -1
  108. package/lib/cjs/src/api/utils/Base64String.js.map +3 -3
  109. package/lib/cjs/src/api/utils/Base64String.test.js +1 -1
  110. package/lib/cjs/src/api/utils/Base64String.test.js.map +3 -3
  111. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  112. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  113. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  114. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  115. package/lib/cjs/src/internal/device-session/model/DevicePinger.js +1 -1
  116. package/lib/cjs/src/internal/device-session/model/DevicePinger.js.map +2 -2
  117. package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js +1 -1
  118. package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js.map +2 -2
  119. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  120. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
  121. package/lib/cjs/src/internal/device-session/model/DeviceSession.test.js +1 -1
  122. package/lib/cjs/src/internal/device-session/model/DeviceSession.test.js.map +3 -3
  123. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js +1 -1
  124. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +2 -2
  125. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  126. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
  127. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  128. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
  129. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
  130. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
  131. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
  132. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +2 -2
  133. package/lib/cjs/src/internal/device-session/service/IntentQueueService.js +2 -0
  134. package/lib/cjs/src/internal/device-session/service/IntentQueueService.js.map +7 -0
  135. package/lib/cjs/src/internal/device-session/service/IntentQueueService.test.js +2 -0
  136. package/lib/cjs/src/internal/device-session/service/IntentQueueService.test.js.map +7 -0
  137. package/lib/cjs/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.js +2 -0
  138. package/lib/cjs/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.js.map +7 -0
  139. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  140. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  141. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
  142. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
  143. package/lib/esm/package.json +1 -1
  144. package/lib/esm/src/api/DeviceManagementKit.js +1 -1
  145. package/lib/esm/src/api/DeviceManagementKit.js.map +2 -2
  146. package/lib/esm/src/api/apdu/utils/ApduBuilder.js +1 -1
  147. package/lib/esm/src/api/apdu/utils/ApduBuilder.js.map +3 -3
  148. package/lib/esm/src/api/command/os/GetBackgroundImageSizeCommand.js +2 -0
  149. package/lib/esm/src/api/command/os/GetBackgroundImageSizeCommand.js.map +7 -0
  150. package/lib/esm/src/api/command/os/GetBackgroundImageSizeCommand.test.js +2 -0
  151. package/lib/esm/src/api/command/os/GetBackgroundImageSizeCommand.test.js.map +7 -0
  152. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  153. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  154. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  155. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  156. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
  157. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  158. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  159. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +3 -3
  160. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  161. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +3 -3
  162. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -0
  163. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +4 -4
  164. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
  165. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +3 -3
  166. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +1 -1
  167. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +3 -3
  168. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js +1 -0
  169. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js.map +4 -4
  170. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  171. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +3 -3
  172. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  173. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
  174. package/lib/esm/src/api/device-action/os/GetDeviceStatus/types.js +1 -0
  175. package/lib/esm/src/api/device-action/os/GetDeviceStatus/types.js.map +4 -4
  176. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
  177. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
  178. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
  179. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +3 -3
  180. package/lib/esm/src/api/device-action/os/GoToDashboard/types.js +1 -0
  181. package/lib/esm/src/api/device-action/os/GoToDashboard/types.js.map +4 -4
  182. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
  183. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +3 -3
  184. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +1 -1
  185. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +3 -3
  186. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -0
  187. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js.map +4 -4
  188. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
  189. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +3 -3
  190. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js +1 -1
  191. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.test.js.map +3 -3
  192. package/lib/esm/src/api/device-action/os/ListApps/types.js +1 -0
  193. package/lib/esm/src/api/device-action/os/ListApps/types.js.map +4 -4
  194. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
  195. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +3 -3
  196. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
  197. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
  198. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/types.js +1 -0
  199. package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/types.js.map +4 -4
  200. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  201. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
  202. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  203. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  204. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -0
  205. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/types.js.map +4 -4
  206. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
  207. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +3 -3
  208. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +1 -1
  209. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +3 -3
  210. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -0
  211. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js.map +4 -4
  212. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  213. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +3 -3
  214. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  215. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +3 -3
  216. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js +1 -0
  217. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +4 -4
  218. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
  219. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js.map +3 -3
  220. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  221. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
  222. package/lib/esm/src/api/index.js +1 -1
  223. package/lib/esm/src/api/index.js.map +3 -3
  224. package/lib/esm/src/api/logger-publisher/utils/noopLoggerFactory.js +2 -0
  225. package/lib/esm/src/api/logger-publisher/utils/noopLoggerFactory.js.map +7 -0
  226. package/lib/esm/src/api/logger-publisher/utils/noopLoggerFactory.test.js +2 -0
  227. package/lib/esm/src/api/logger-publisher/utils/noopLoggerFactory.test.js.map +7 -0
  228. package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
  229. package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +3 -3
  230. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  231. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  232. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  233. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
  234. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js +1 -1
  235. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +3 -3
  236. package/lib/esm/src/api/transport/model/Errors.js +1 -1
  237. package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
  238. package/lib/esm/src/api/utils/ApplicationChecker.js +2 -0
  239. package/lib/esm/src/api/utils/ApplicationChecker.js.map +7 -0
  240. package/lib/esm/src/api/utils/ApplicationChecker.test.js +2 -0
  241. package/lib/esm/src/api/utils/ApplicationChecker.test.js.map +7 -0
  242. package/lib/esm/src/api/utils/ApplicationResolver.js +1 -0
  243. package/lib/esm/src/api/utils/ApplicationResolver.js.map +7 -0
  244. package/lib/esm/src/api/utils/Base64String.js +1 -1
  245. package/lib/esm/src/api/utils/Base64String.js.map +3 -3
  246. package/lib/esm/src/api/utils/Base64String.test.js +1 -1
  247. package/lib/esm/src/api/utils/Base64String.test.js.map +3 -3
  248. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  249. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  250. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  251. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  252. package/lib/esm/src/internal/device-session/model/DevicePinger.js +1 -1
  253. package/lib/esm/src/internal/device-session/model/DevicePinger.js.map +2 -2
  254. package/lib/esm/src/internal/device-session/model/DevicePinger.test.js +1 -1
  255. package/lib/esm/src/internal/device-session/model/DevicePinger.test.js.map +2 -2
  256. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  257. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
  258. package/lib/esm/src/internal/device-session/model/DeviceSession.test.js +1 -1
  259. package/lib/esm/src/internal/device-session/model/DeviceSession.test.js.map +3 -3
  260. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js +1 -1
  261. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +2 -2
  262. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  263. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
  264. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  265. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
  266. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
  267. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
  268. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
  269. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +2 -2
  270. package/lib/esm/src/internal/device-session/service/IntentQueueService.js +2 -0
  271. package/lib/esm/src/internal/device-session/service/IntentQueueService.js.map +7 -0
  272. package/lib/esm/src/internal/device-session/service/IntentQueueService.test.js +2 -0
  273. package/lib/esm/src/internal/device-session/service/IntentQueueService.test.js.map +7 -0
  274. package/lib/esm/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.js +2 -0
  275. package/lib/esm/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.js.map +7 -0
  276. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  277. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  278. package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
  279. package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
  280. package/lib/types/src/api/DeviceManagementKit.d.ts +10 -0
  281. package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
  282. package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts +7 -0
  283. package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts.map +1 -1
  284. package/lib/types/src/api/command/os/GetBackgroundImageSizeCommand.d.ts +17 -0
  285. package/lib/types/src/api/command/os/GetBackgroundImageSizeCommand.d.ts.map +1 -0
  286. package/lib/types/src/api/command/os/GetBackgroundImageSizeCommand.test.d.ts +2 -0
  287. package/lib/types/src/api/command/os/GetBackgroundImageSizeCommand.test.d.ts.map +1 -0
  288. package/lib/types/src/api/device-action/DeviceAction.d.ts +2 -1
  289. package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
  290. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  291. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
  292. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +4 -1
  293. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
  294. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -1
  295. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +9 -1
  296. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -1
  297. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map +1 -1
  298. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +13 -2
  299. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -1
  300. package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
  301. package/lib/types/src/api/device-action/os/GetDeviceStatus/types.d.ts +6 -0
  302. package/lib/types/src/api/device-action/os/GetDeviceStatus/types.d.ts.map +1 -1
  303. package/lib/types/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.d.ts +1 -1
  304. package/lib/types/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.d.ts.map +1 -1
  305. package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts +9 -1
  306. package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts.map +1 -1
  307. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -1
  308. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +9 -1
  309. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -1
  310. package/lib/types/src/api/device-action/os/ListApps/ListAppsDeviceAction.d.ts.map +1 -1
  311. package/lib/types/src/api/device-action/os/ListApps/types.d.ts +6 -0
  312. package/lib/types/src/api/device-action/os/ListApps/types.d.ts.map +1 -1
  313. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts.map +1 -1
  314. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/types.d.ts +8 -1
  315. package/lib/types/src/api/device-action/os/ListAppsWithMetadata/types.d.ts.map +1 -1
  316. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts.map +1 -1
  317. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts +12 -2
  318. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
  319. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -1
  320. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +8 -0
  321. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -1
  322. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.d.ts.map +1 -1
  323. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts +9 -1
  324. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
  325. package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts +10 -1
  326. package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts.map +1 -1
  327. package/lib/types/src/api/index.d.ts +11 -4
  328. package/lib/types/src/api/index.d.ts.map +1 -1
  329. package/lib/types/src/api/logger-publisher/utils/noopLoggerFactory.d.ts +12 -0
  330. package/lib/types/src/api/logger-publisher/utils/noopLoggerFactory.d.ts.map +1 -0
  331. package/lib/types/src/api/logger-publisher/utils/noopLoggerFactory.test.d.ts +2 -0
  332. package/lib/types/src/api/logger-publisher/utils/noopLoggerFactory.test.d.ts.map +1 -0
  333. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -1
  334. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +1 -0
  335. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -1
  336. package/lib/types/src/api/transport/model/Errors.d.ts +5 -0
  337. package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
  338. package/lib/types/src/api/types.d.ts +1 -0
  339. package/lib/types/src/api/types.d.ts.map +1 -1
  340. package/lib/types/src/api/utils/ApplicationChecker.d.ts +14 -0
  341. package/lib/types/src/api/utils/ApplicationChecker.d.ts.map +1 -0
  342. package/lib/types/src/api/utils/ApplicationChecker.test.d.ts +2 -0
  343. package/lib/types/src/api/utils/ApplicationChecker.test.d.ts.map +1 -0
  344. package/lib/types/src/api/utils/ApplicationResolver.d.ts +12 -0
  345. package/lib/types/src/api/utils/ApplicationResolver.d.ts.map +1 -0
  346. package/lib/types/src/api/utils/Base64String.d.ts +1 -0
  347. package/lib/types/src/api/utils/Base64String.d.ts.map +1 -1
  348. package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
  349. package/lib/types/src/internal/device-session/di/deviceSessionTypes.d.ts +1 -0
  350. package/lib/types/src/internal/device-session/di/deviceSessionTypes.d.ts.map +1 -1
  351. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +13 -2
  352. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  353. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts +3 -1
  354. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts.map +1 -1
  355. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts +0 -1
  356. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts.map +1 -1
  357. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts +1 -0
  358. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts.map +1 -1
  359. package/lib/types/src/internal/device-session/service/IntentQueueService.d.ts +101 -0
  360. package/lib/types/src/internal/device-session/service/IntentQueueService.d.ts.map +1 -0
  361. package/lib/types/src/internal/device-session/service/IntentQueueService.test.d.ts +2 -0
  362. package/lib/types/src/internal/device-session/service/IntentQueueService.test.d.ts.map +1 -0
  363. package/lib/types/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.d.ts +19 -0
  364. package/lib/types/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.d.ts.map +1 -0
  365. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  366. package/package.json +4 -4
  367. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js +0 -2
  368. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js.map +0 -7
  369. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js +0 -2
  370. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js.map +0 -7
  371. package/lib/cjs/src/internal/device-session/service/MutexService.js +0 -2
  372. package/lib/cjs/src/internal/device-session/service/MutexService.js.map +0 -7
  373. package/lib/cjs/src/internal/device-session/service/MutexService.test.js +0 -2
  374. package/lib/cjs/src/internal/device-session/service/MutexService.test.js.map +0 -7
  375. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js +0 -2
  376. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js.map +0 -7
  377. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js +0 -2
  378. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js.map +0 -7
  379. package/lib/esm/src/internal/device-session/service/MutexService.js +0 -2
  380. package/lib/esm/src/internal/device-session/service/MutexService.js.map +0 -7
  381. package/lib/esm/src/internal/device-session/service/MutexService.test.js +0 -2
  382. package/lib/esm/src/internal/device-session/service/MutexService.test.js.map +0 -7
  383. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts +0 -17
  384. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts.map +0 -1
  385. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts +0 -2
  386. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts.map +0 -1
  387. package/lib/types/src/internal/device-session/service/MutexService.d.ts +0 -6
  388. package/lib/types/src/internal/device-session/service/MutexService.d.ts.map +0 -1
  389. package/lib/types/src/internal/device-session/service/MutexService.test.d.ts +0 -2
  390. package/lib/types/src/internal/device-session/service/MutexService.test.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var I=(o,n)=>{for(var a in n)p(o,a,{get:n[a],enumerable:!0})},l=(o,n,a,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of A(n))!S.call(o,r)&&r!==a&&p(o,r,{get:()=>n[r],enumerable:!(e=u(n,r))||e.enumerable});return o};var D=o=>l(p({},"__esModule",{value:!0}),o);var R={};I(R,{SendCommandInAppDeviceAction:()=>E});module.exports=D(R);var m=require("purify-ts"),t=require("xstate"),i=require("../../../command/model/CommandResult"),d=require("../../../device-action/model/UserInteractionRequired"),s=require("../../../device-action/os/Errors"),C=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),c=require("../../../device-action/xstate-utils/XStateDeviceAction");class E extends c.XStateDeviceAction{makeStateMachine(n){const{sendCommand:a}=this.extractDependencies(n);return(0,t.setup)({types:{input:{},context:{},output:{}},actors:{sendCommand:(0,t.fromPromise)(a),openAppStateMachine:new C.OpenAppDeviceAction({input:{appName:this.input.appName}}).makeStateMachine(n)},guards:{skipOpenApp:()=>this.input.skipOpenApp,noInternalError:({context:e})=>e._internalState.error===null},actions:{assignErrorFromEvent:(0,t.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"SendCommandInAppDeviceAction",initial:"InitialState",context:({input:e})=>({input:e,intermediateValue:{requiredUserInteraction:d.UserInteractionRequired.None},_internalState:{commandResponse:null,error:null}}),states:{InitialState:{always:[{target:"SendCommand",guard:"skipOpenApp"},"OpenAppDeviceAction"]},OpenAppDeviceAction:{invoke:{id:"openAppStateMachine",input:{appName:this.input.appName},src:"openAppStateMachine",onSnapshot:{actions:(0,t.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{actions:(0,t.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:r=>({...e.context._internalState,error:r})})}),target:"CheckOpenAppDeviceActionResult"}}},CheckOpenAppDeviceActionResult:{always:[{target:"SendCommand",guard:"noInternalError"},"Error"]},SendCommand:{entry:(0,t.assign)({intermediateValue:{requiredUserInteraction:this.input.requiredUserInteraction}}),exit:(0,t.assign)({intermediateValue:{requiredUserInteraction:d.UserInteractionRequired.None}}),invoke:{id:"sendCommand",src:"sendCommand",input:({context:e})=>e.input.command,onDone:{target:"SendCommandResultCheck",actions:[(0,t.assign)({_internalState:({event:e,context:r})=>(0,i.isSuccessCommandResult)(e.output)?{...r._internalState,commandResponse:e.output.data}:{...r._internalState,error:e.output.error}})]},onError:{target:"Error",actions:"assignErrorFromEvent"}}},SendCommandResultCheck:{always:[{target:"Success",guard:"noInternalError"},"Error"]},Success:{type:"final"},Error:{type:"final"}},output:({context:e})=>e._internalState.commandResponse?(0,m.Right)(e._internalState.commandResponse):(0,m.Left)(e._internalState.error||new s.UnknownDAError("No error in final state"))})}extractDependencies(n){return{sendCommand:a=>n.sendCommand(a.input)}}}0&&(module.exports={SendCommandInAppDeviceAction});
1
+ "use strict";var d=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var l=(o,n)=>{for(var a in n)d(o,a,{get:n[a],enumerable:!0})},D=(o,n,a,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of S(n))!I.call(o,r)&&r!==a&&d(o,r,{get:()=>n[r],enumerable:!(e=A(n,r))||e.enumerable});return o};var E=o=>D(d({},"__esModule",{value:!0}),o);var y={};l(y,{SendCommandInAppDeviceAction:()=>R});module.exports=E(y);var p=require("purify-ts"),t=require("xstate"),s=require("../../../command/model/CommandResult"),i=require("../../../device-action/model/UserInteractionRequired"),C=require("../../../device-action/os/Errors"),c=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),u=require("../../../device-action/xstate-utils/XStateDeviceAction"),m=require("./SendCommandInAppDeviceActionTypes");class R extends u.XStateDeviceAction{makeStateMachine(n){const{sendCommand:a}=this.extractDependencies(n);return(0,t.setup)({types:{input:{},context:{},output:{}},actors:{sendCommand:(0,t.fromPromise)(a),openAppStateMachine:new c.OpenAppDeviceAction({input:{appName:this.input.appName}}).makeStateMachine(n)},guards:{skipOpenApp:()=>this.input.skipOpenApp,noInternalError:({context:e})=>e._internalState.error===null},actions:{assignErrorFromEvent:(0,t.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"SendCommandInAppDeviceAction",initial:"InitialState",context:({input:e})=>({input:e,intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None,step:m.sendCommandInAppDAStateStep.OPEN_APP},_internalState:{commandResponse:null,error:null}}),states:{InitialState:{always:[{target:"SendCommand",guard:"skipOpenApp"},"OpenAppDeviceAction"]},OpenAppDeviceAction:{invoke:{id:"openAppStateMachine",input:{appName:this.input.appName},src:"openAppStateMachine",onSnapshot:{actions:(0,t.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{actions:(0,t.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:r=>({...e.context._internalState,error:r})})}),target:"CheckOpenAppDeviceActionResult"}}},CheckOpenAppDeviceActionResult:{always:[{target:"SendCommand",guard:"noInternalError"},"Error"]},SendCommand:{entry:(0,t.assign)({intermediateValue:{requiredUserInteraction:this.input.requiredUserInteraction,step:m.sendCommandInAppDAStateStep.SEND_COMMAND}}),exit:(0,t.assign)({intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None,step:m.sendCommandInAppDAStateStep.SEND_COMMAND}}),invoke:{id:"sendCommand",src:"sendCommand",input:({context:e})=>e.input.command,onDone:{target:"SendCommandResultCheck",actions:[(0,t.assign)({_internalState:({event:e,context:r})=>(0,s.isSuccessCommandResult)(e.output)?{...r._internalState,commandResponse:e.output.data}:{...r._internalState,error:e.output.error}})]},onError:{target:"Error",actions:"assignErrorFromEvent"}}},SendCommandResultCheck:{always:[{target:"Success",guard:"noInternalError"},"Error"]},Success:{type:"final"},Error:{type:"final"}},output:({context:e})=>e._internalState.commandResponse?(0,p.Right)(e._internalState.commandResponse):(0,p.Left)(e._internalState.error||new C.UnknownDAError("No error in final state"))})}extractDependencies(n){return{sendCommand:a=>n.sendCommand(a.input)}}}0&&(module.exports={SendCommandInAppDeviceAction});
2
2
  //# sourceMappingURL=SendCommandInAppDeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.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\";\nimport { type Command } from \"@api/types\";\n\nimport {\n type SendCommandInAppDAError,\n type SendCommandInAppDAInput,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAInternalState,\n type SendCommandInAppDAOutput,\n} from \"./SendCommandInAppDeviceActionTypes\";\n\n/**\n * Tries to open an app on the device, and if it is successful, sends a command\n * to the app.\n * The output will be the result of the command.\n *\n * ```ts\n * input: {\n * appName: string;\n * command: Command<CommandResult, CommandArgs>;\n * requiredUserInteraction: UserInteraction;\n * }\n * ```\n *\n * Example of usage:\n *\n * ```ts\n * const deviceAction = new SendCommandInAppDeviceAction({\n * input: {\n * appName: \"MyApp\",\n * command: new MyAppSpecificCommand({commandSpecificArg: \"foo\"}),\n * requiredUserInteraction: UserInteractionRequired.None,\n * },\n * });\n * dmk.executeDeviceAction({ sessionId: \"mySessionId\", deviceAction });\n * ```\n */\nexport class SendCommandInAppDeviceAction<\n CommandResponse,\n CommandArgs,\n CommandErrorCodes,\n UserInteraction extends UserInteractionRequired,\n> extends XStateDeviceAction<\n SendCommandInAppDAOutput<CommandResponse>,\n SendCommandInAppDAInput<\n CommandResponse,\n CommandArgs,\n CommandErrorCodes,\n UserInteraction\n >,\n SendCommandInAppDAError<CommandErrorCodes>,\n SendCommandInAppDAIntermediateValue<UserInteraction>,\n SendCommandInAppDAInternalState<CommandResponse, CommandErrorCodes>\n> {\n makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n SendCommandInAppDAOutput<CommandResponse>,\n SendCommandInAppDAInput<\n CommandResponse,\n CommandArgs,\n CommandErrorCodes,\n UserInteraction\n >,\n SendCommandInAppDAError<CommandErrorCodes>,\n SendCommandInAppDAIntermediateValue<UserInteraction>,\n SendCommandInAppDAInternalState<CommandResponse, CommandErrorCodes>\n > {\n type types = StateMachineTypes<\n SendCommandInAppDAOutput<CommandResponse>,\n SendCommandInAppDAInput<\n CommandResponse,\n CommandArgs,\n CommandErrorCodes,\n UserInteraction\n >,\n SendCommandInAppDAError<CommandErrorCodes>,\n SendCommandInAppDAIntermediateValue<UserInteraction>,\n SendCommandInAppDAInternalState<CommandResponse, CommandErrorCodes>\n >;\n\n const { sendCommand } = 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 sendCommand: fromPromise(sendCommand),\n openAppStateMachine: new OpenAppDeviceAction({\n input: {\n appName: this.input.appName,\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 /** @xstate-layout N4IgpgJg5mDOIC5QFEAuALA0mAngJwEsA7KAcTFQEEII85YARMANwIGMxK3UCB7IgHQB5AA5gilESKasOXHvwDEEfmAHFmvANZreYiVIDKqAIaowAWRNt0xMAG0ADAF1EoEb1gEFRNyAAeiACMQQDsAgAcACwAzKEArABMUfGpEQCcEYkANCA4iFGO8QKhjokxERUpQenp8QC+9bloWLiEJORUNHSwjCzsnNx8ggDC6GBsWqLiktL9ckP8AEpwAK4ANqiKTq5IIB5ePn6BCEFR4YkAbKE1Zemh55URufkI8fcC8TGXl0EVoelHJcio1mhhsPhiGQKNRaPQZAN5MMBGMJlN9LMEQsfCtYBstvYgrt3J5vMNjgUQgJLokHlEgldko50rEXoh3uEvj8-hEAUCQU0QC0Ie1oV04b0sYMfAJOrCerARrwALbKkxECDKVTqIiaHQCGDihVK1XqiA7PwHMn8CmnRJBASOFIxKJXJ21GLpHJ5RARGoCEL3CKXDLpS4pCKgoXgtpQuXdeHzaXI+MSxUqtUaxRgPB4Xh4AQidZmABm+eVBphCd6Jsz5pcltJRz2Jyiv0dvIeNJi8UqoWePoQIccn3iId+sSqkajRF4EDgfmFsY6VbTUqRNr2VuboBOAFpLmzTpd0iV+0EkkEylcAVEo0vISujYnZMn+MIMVJ14tfFum+SWwKb1XkSMdIhuQFEidYNSjvQUH1FVMFW-GVUUmaYDDmV8NyIXF8UbQ4AN3X0ogEF17S9eJQhiJ0ojbI8khHc54mvRwGUBXl7xjR8xXlF9ER-WVV2NDMzQI61f2IhBXUdRw5NDX54gvXkjx+CIzxuMdfnKd44LBVoeKQ-jsWRQxVjYDhenEncAmCcMBHKBlqKyIEYivGIjzDGJqQSYMamDa4BX0kU42E4y30EZBc3zayiNshBSmKFjqn7GCMgHV57lIz0aT9P0lL+S5GkaIA */\n id: \"SendCommandInAppDeviceAction\",\n initial: \"InitialState\",\n context: ({ input }) => {\n return {\n input: input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n commandResponse: null,\n error: null,\n },\n };\n },\n states: {\n InitialState: {\n always: [\n {\n target: \"SendCommand\",\n guard: \"skipOpenApp\",\n },\n \"OpenAppDeviceAction\",\n ],\n },\n OpenAppDeviceAction: {\n invoke: {\n id: \"openAppStateMachine\",\n input: {\n appName: this.input.appName,\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 SendCommandInAppDAInternalState<\n CommandResponse,\n CommandErrorCodes\n >\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: \"SendCommand\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n SendCommand: {\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: \"sendCommand\",\n src: \"sendCommand\",\n input: ({ context }) => context.input.command,\n onDone: {\n target: \"SendCommandResultCheck\",\n actions: [\n assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n commandResponse: 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 SendCommandResultCheck: {\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.commandResponse\n ? Right(context._internalState.commandResponse)\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 sendCommand: (_: {\n input: Command<CommandResponse, CommandArgs, CommandErrorCodes>;\n }): Promise<CommandResult<CommandResponse, CommandErrorCodes>> =>\n internalApi.sendCommand(_.input),\n };\n }\n}\n"],
5
- "mappings": "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",
6
- "names": ["SendCommandInAppDeviceAction_exports", "__export", "SendCommandInAppDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandResult", "import_UserInteractionRequired", "import_Errors", "import_OpenAppDeviceAction", "import_XStateDeviceAction", "internalAPI", "sendCommand", "context", "_", "input", "error", "event", "internalApi"]
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\";\nimport { type Command } from \"@api/types\";\n\nimport {\n type SendCommandInAppDAError,\n type SendCommandInAppDAInput,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAInternalState,\n type SendCommandInAppDAOutput,\n sendCommandInAppDAStateStep,\n} from \"./SendCommandInAppDeviceActionTypes\";\n\n/**\n * Tries to open an app on the device, and if it is successful, sends a command\n * to the app.\n * The output will be the result of the command.\n *\n * ```ts\n * input: {\n * appName: string;\n * command: Command<CommandResult, CommandArgs>;\n * requiredUserInteraction: UserInteraction;\n * }\n * ```\n *\n * Example of usage:\n *\n * ```ts\n * const deviceAction = new SendCommandInAppDeviceAction({\n * input: {\n * appName: \"MyApp\",\n * command: new MyAppSpecificCommand({commandSpecificArg: \"foo\"}),\n * requiredUserInteraction: UserInteractionRequired.None,\n * },\n * });\n * dmk.executeDeviceAction({ sessionId: \"mySessionId\", deviceAction });\n * ```\n */\nexport class SendCommandInAppDeviceAction<\n CommandResponse,\n CommandArgs,\n CommandErrorCodes,\n UserInteraction extends UserInteractionRequired,\n> extends XStateDeviceAction<\n SendCommandInAppDAOutput<CommandResponse>,\n SendCommandInAppDAInput<\n CommandResponse,\n CommandArgs,\n CommandErrorCodes,\n UserInteraction\n >,\n SendCommandInAppDAError<CommandErrorCodes>,\n SendCommandInAppDAIntermediateValue<UserInteraction>,\n SendCommandInAppDAInternalState<CommandResponse, CommandErrorCodes>\n> {\n makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n SendCommandInAppDAOutput<CommandResponse>,\n SendCommandInAppDAInput<\n CommandResponse,\n CommandArgs,\n CommandErrorCodes,\n UserInteraction\n >,\n SendCommandInAppDAError<CommandErrorCodes>,\n SendCommandInAppDAIntermediateValue<UserInteraction>,\n SendCommandInAppDAInternalState<CommandResponse, CommandErrorCodes>\n > {\n type types = StateMachineTypes<\n SendCommandInAppDAOutput<CommandResponse>,\n SendCommandInAppDAInput<\n CommandResponse,\n CommandArgs,\n CommandErrorCodes,\n UserInteraction\n >,\n SendCommandInAppDAError<CommandErrorCodes>,\n SendCommandInAppDAIntermediateValue<UserInteraction>,\n SendCommandInAppDAInternalState<CommandResponse, CommandErrorCodes>\n >;\n\n const { sendCommand } = 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 sendCommand: fromPromise(sendCommand),\n openAppStateMachine: new OpenAppDeviceAction({\n input: {\n appName: this.input.appName,\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 /** @xstate-layout N4IgpgJg5mDOIC5QFEAuALA0mAngJwEsA7KAcTFQEEII85YARMANwIGMxK3UCB7IgHQB5AA5gilESKasOXHvwDEEfmAHFmvANZreYiVIDKqAIaowAWRNt0xMAG0ADAF1EoEb1gEFRNyAAeiACMQQDsAgAcACwAzKEArABMUfGpEQCcEYkANCA4iFGO8QKhjokxERUpQenp8QC+9bloWLiEJORUNHSwjCzsnNx8ggDC6GBsWqLiktL9ckP8AEpwAK4ANqiKTq5IIB5ePn6BCEFR4YkAbKE1Zemh55URufkI8fcC8TGXl0EVoelHJcio1mhhsPhiGQKNRaPQZAN5MMBGMJlN9LMEQsfCtYBstvYgrt3J5vMNjgUQgJLokHlEgldko50rEXoh3uEvj8-hEAUCQU0QC0Ie1oV04b0sYMfAJOrCerARrwALbKkxECDKVTqIiaHQCGDihVK1XqiA7PwHMn8CmnRJBASOFIxKJXJ21GLpHJ5RARGoCEL3CKXDLpS4pCKgoXgtpQuXdeHzaXI+MSxUqtUaxRgPB4Xh4AQidZmABm+eVBphCd6Jsz5pcltJRz2Jyiv0dvIeNJi8UqoWePoQIccn3iId+sSqkajRF4EDgfmFsY6VbTUqRNr2VuboBOAFpLmzTpd0iV+0EkkEylcAVEo0vISujYnZMn+MIMVJ14tfFum+SWwKb1XkSMdIhuQFEidYNSjvQUH1FVMFW-GVUUmaYDDmV8NyIXF8UbQ4AN3X0ogEF17S9eJQhiJ0ojbI8khHc54mvRwGUBXl7xjR8xXlF9ER-WVV2NDMzQI61f2IhBXUdRw5NDX54gvXkjx+CIzxuMdfnKd44LBVoeKQ-jsWRQxVjYDhenEncAmCcMBHKBlqKyIEYivGIjzDGJqQSYMamDa4BX0kU42E4y30EZBc3zayiNshBSmKFjqn7GCMgHV57lIz0aT9P0lL+S5GkaIA */\n id: \"SendCommandInAppDeviceAction\",\n initial: \"InitialState\",\n context: ({ input }) => {\n return {\n input: input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: sendCommandInAppDAStateStep.OPEN_APP,\n },\n _internalState: {\n commandResponse: null,\n error: null,\n },\n };\n },\n states: {\n InitialState: {\n always: [\n {\n target: \"SendCommand\",\n guard: \"skipOpenApp\",\n },\n \"OpenAppDeviceAction\",\n ],\n },\n OpenAppDeviceAction: {\n invoke: {\n id: \"openAppStateMachine\",\n input: {\n appName: this.input.appName,\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 SendCommandInAppDAInternalState<\n CommandResponse,\n CommandErrorCodes\n >\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: \"SendCommand\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n SendCommand: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: this.input.requiredUserInteraction,\n step: sendCommandInAppDAStateStep.SEND_COMMAND,\n },\n }),\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: sendCommandInAppDAStateStep.SEND_COMMAND,\n },\n }),\n invoke: {\n id: \"sendCommand\",\n src: \"sendCommand\",\n input: ({ context }) => context.input.command,\n onDone: {\n target: \"SendCommandResultCheck\",\n actions: [\n assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n commandResponse: 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 SendCommandResultCheck: {\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.commandResponse\n ? Right(context._internalState.commandResponse)\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 sendCommand: (_: {\n input: Command<CommandResponse, CommandArgs, CommandErrorCodes>;\n }): Promise<CommandResult<CommandResponse, CommandErrorCodes>> =>\n internalApi.sendCommand(_.input),\n };\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,qBAC5BC,EAA2C,kBAE3CC,EAGO,4CAEPC,EAAwC,4DACxCC,EAA+B,wCAC/BC,EAAoC,yEAEpCC,EAGO,8DAGPC,EAOO,+CA4BA,MAAMT,UAKH,oBAWR,CACA,iBACEU,EAYA,CAcA,KAAM,CAAE,YAAAC,CAAY,EAAI,KAAK,oBAAoBD,CAAW,EAE5D,SAAO,SAAM,CACX,MAAO,CACL,MAAO,CAAC,EACR,QAAS,CAAC,EACV,OAAQ,CAAC,CACX,EACA,OAAQ,CACN,eAAa,eAAYC,CAAW,EACpC,oBAAqB,IAAI,sBAAoB,CAC3C,MAAO,CACL,QAAS,KAAK,MAAM,OACtB,CACF,CAAC,EAAE,iBAAiBD,CAAW,CACjC,EACA,OAAQ,CACN,YAAa,IAAM,KAAK,MAAM,YAC9B,gBAAiB,CAAC,CAAE,QAAAE,CAAQ,IAAMA,EAAQ,eAAe,QAAU,IACrE,EACA,QAAS,CACP,wBAAsB,UAAO,CAC3B,eAAiBC,IAAO,CACtB,GAAGA,EAAE,QAAQ,eACb,MAAOA,EAAE,MAAM,KACjB,EACF,CAAC,CACH,CACF,CAAC,EAAE,cAAc,CAEf,GAAI,+BACJ,QAAS,eACT,QAAS,CAAC,CAAE,MAAAC,CAAM,KACT,CACL,MAAOA,EACP,kBAAmB,CACjB,wBAAyB,0BAAwB,KACjD,KAAM,8BAA4B,QACpC,EACA,eAAgB,CACd,gBAAiB,KACjB,MAAO,IACT,CACF,GAEF,OAAQ,CACN,aAAc,CACZ,OAAQ,CACN,CACE,OAAQ,cACR,MAAO,aACT,EACA,qBACF,CACF,EACA,oBAAqB,CACnB,OAAQ,CACN,GAAI,sBACJ,MAAO,CACL,QAAS,KAAK,MAAM,OACtB,EACA,IAAK,sBACL,WAAY,CACV,WAAS,UAAO,CACd,kBAAoBD,GAClBA,EAAE,MAAM,SAAS,QAAQ,iBAC7B,CAAC,CACH,EACA,OAAQ,CACN,WAAS,UAAO,CACd,eAAiBA,GACRA,EAAE,MAAM,OAAO,OAKpB,CACA,MAAO,IAAMA,EAAE,QAAQ,eACvB,KAAOE,IAAW,CAChB,GAAGF,EAAE,QAAQ,eACb,MAAAE,CACF,EACF,CAAC,CAEL,CAAC,EACD,OAAQ,gCACV,CACF,CACF,EACA,+BAAgC,CAC9B,OAAQ,CACN,CACE,OAAQ,cACR,MAAO,iBACT,EACA,OACF,CACF,EACA,YAAa,CACX,SAAO,UAAO,CACZ,kBAAmB,CACjB,wBAAyB,KAAK,MAAM,wBACpC,KAAM,8BAA4B,YACpC,CACF,CAAC,EACD,QAAM,UAAO,CACX,kBAAmB,CACjB,wBAAyB,0BAAwB,KACjD,KAAM,8BAA4B,YACpC,CACF,CAAC,EACD,OAAQ,CACN,GAAI,cACJ,IAAK,cACL,MAAO,CAAC,CAAE,QAAAH,CAAQ,IAAMA,EAAQ,MAAM,QACtC,OAAQ,CACN,OAAQ,yBACR,QAAS,IACP,UAAO,CACL,eAAgB,CAAC,CAAE,MAAAI,EAAO,QAAAJ,CAAQ,OAC5B,0BAAuBI,EAAM,MAAM,EAC9B,CACL,GAAGJ,EAAQ,eACX,gBAAiBI,EAAM,OAAO,IAChC,EAEK,CACL,GAAGJ,EAAQ,eACX,MAAOI,EAAM,OAAO,KACtB,CAEJ,CAAC,CACH,CACF,EACA,QAAS,CACP,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,uBAAwB,CACtB,OAAQ,CACN,CACE,OAAQ,UACR,MAAO,iBACT,EACA,OACF,CACF,EACA,QAAS,CACP,KAAM,OACR,EACA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAAQ,CAAC,CAAE,QAAAJ,CAAQ,IACjBA,EAAQ,eAAe,mBACnB,SAAMA,EAAQ,eAAe,eAAe,KAC5C,QACEA,EAAQ,eAAe,OACrB,IAAI,iBAAe,yBAAyB,CAChD,CACR,CAAC,CACH,CAEA,oBAAoBK,EAA0B,CAC5C,MAAO,CACL,YAAcJ,GAGZI,EAAY,YAAYJ,EAAE,KAAK,CACnC,CACF,CACF",
6
+ "names": ["SendCommandInAppDeviceAction_exports", "__export", "SendCommandInAppDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandResult", "import_UserInteractionRequired", "import_Errors", "import_OpenAppDeviceAction", "import_XStateDeviceAction", "import_SendCommandInAppDeviceActionTypes", "internalAPI", "sendCommand", "context", "_", "input", "error", "event", "internalApi"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var y=require("purify-ts"),C=require("xstate"),k=require("../../../apdu/utils/ApduBuilder"),c=require("../../../command/model/CommandResult"),i=require("../../../device-action/__test-utils__/makeInternalApi"),l=require("../../../device-action/__test-utils__/testDeviceActionStates"),n=require("../../../device-action/model/DeviceActionState"),e=require("../../../device-action/model/UserInteractionRequired"),v=require("../../../device-action/os/Errors"),I=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),D=require("../../../../../src"),s=require("./SendCommandInAppDeviceAction");vi.mock("@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction",async r=>({...await r(),OpenAppDeviceAction:vi.fn(()=>({makeStateMachine:vi.fn()}))}));const A=r=>{I.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:()=>r?(0,y.Left)(r):(0,y.Right)(void 0)}))}))};describe("SendCommandInAppDeviceAction",()=>{const r=vi.fn(),m=()=>({sendCommand:r}),{sendCommand:S}=(0,i.makeDeviceActionInternalApiMock)(),d={paramString:"aParameter",paramNumber:1234},f={aNumber:5678,aString:"mockedResponseString"};beforeEach(()=>{vi.resetAllMocks()}),describe("without mocking extractDependencies",()=>{it("should call sendCommand on internalApi with the correct parameters",async()=>{A(),S.mockResolvedValue((0,c.CommandResultFactory)({data:void 0}));const o=new s.SendCommandInAppDeviceAction({input:{command:new p(d),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}});await new Promise((a,t)=>{o._execute((0,i.makeDeviceActionInternalApiMock)()).observable.subscribe({error:()=>t(),complete:()=>a(),next:()=>{}})}),expect(S).toHaveBeenCalledWith(new p(d))})}),describe("error cases",()=>{it("should error and output the error if the open app fails",()=>new Promise((o,a)=>{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,l.testDeviceActionStates)(new s.SendCommandInAppDeviceAction({input:{command:new p(d),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}}),t,(0,i.makeDeviceActionInternalApiMock)(),{onDone:o,onError:a})})),it("should error and output an error if the send command fails",()=>new Promise((o,a)=>{A(),r.mockResolvedValue((0,c.CommandResultFactory)({error:new D.UnknownDeviceExchangeError("Mocked error")}));const t=new s.SendCommandInAppDeviceAction({input:{command:new p(d),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}});vi.spyOn(t,"extractDependencies").mockImplementation(m);const u=[{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,l.testDeviceActionStates)(t,u,(0,i.makeDeviceActionInternalApiMock)(),{onDone:o,onError:a})}))}),describe("success cases",()=>{it("should succeed and output the command result if the send command succeeds",()=>new Promise((o,a)=>{A(),r.mockResolvedValue((0,c.CommandResultFactory)({data:f}));const t=new s.SendCommandInAppDeviceAction({input:{command:new p(d),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}});vi.spyOn(t,"extractDependencies").mockImplementation(m);const u=[{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:f}];(0,l.testDeviceActionStates)(t,u,(0,i.makeDeviceActionInternalApiMock)(),{onDone:o,onError:a})})),it("should succeed while skipping OpenApp",()=>new Promise((o,a)=>{A(),r.mockResolvedValue((0,c.CommandResultFactory)({data:f}));const t=new s.SendCommandInAppDeviceAction({input:{command:new p(d),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!0}});vi.spyOn(t,"extractDependencies").mockImplementation(m);const u=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}},{status:n.DeviceActionStatus.Completed,output:f}];(0,l.testDeviceActionStates)(t,u,(0,i.makeDeviceActionInternalApiMock)(),{onDone:o,onError:a})}))})});class p{name="testCommand";params;constructor(m){this.params=m}getApdu(){return new k.ApduBuilder({cla:0,ins:1,p1:2,p2:3}).add32BitUIntToData(this.params.paramNumber).addAsciiStringToData(this.params.paramString).build()}parseResponse(){return(0,c.CommandResultFactory)({data:{aNumber:1,aString:"aString"}})}}
1
+ "use strict";var f=require("purify-ts"),y=require("xstate"),k=require("../../../apdu/utils/ApduBuilder"),u=require("../../../command/model/CommandResult"),i=require("../../../device-action/__test-utils__/makeInternalApi"),S=require("../../../device-action/__test-utils__/testDeviceActionStates"),n=require("../../../device-action/model/DeviceActionState"),e=require("../../../device-action/model/UserInteractionRequired"),I=require("../../../device-action/os/Errors"),E=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),C=require("../../../device-action/os/OpenAppDeviceAction/types"),v=require("../../../../../src"),c=require("./SendCommandInAppDeviceAction"),m=require("./SendCommandInAppDeviceActionTypes");vi.mock("@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction",async r=>({...await r(),OpenAppDeviceAction:vi.fn(()=>({makeStateMachine:vi.fn()}))}));const l=r=>{E.OpenAppDeviceAction.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>(0,y.createMachine)({initial:"pending",states:{pending:{entry:(0,y.assign)({intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp,step:C.openAppDAStateStep.GET_DEVICE_STATUS}}),after:{0:"done"}},done:{type:"final"}},output:()=>r?(0,f.Left)(r):(0,f.Right)(void 0)}))}))};describe("SendCommandInAppDeviceAction",()=>{const r=vi.fn(),p=()=>({sendCommand:r}),{sendCommand:M}=(0,i.makeDeviceActionInternalApiMock)(),s={paramString:"aParameter",paramNumber:1234},D={aNumber:5678,aString:"mockedResponseString"};beforeEach(()=>{vi.resetAllMocks()}),describe("without mocking extractDependencies",()=>{it("should call sendCommand on internalApi with the correct parameters",async()=>{l(),M.mockResolvedValue((0,u.CommandResultFactory)({data:void 0}));const o=new c.SendCommandInAppDeviceAction({input:{command:new d(s),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}});await new Promise((a,t)=>{o._execute((0,i.makeDeviceActionInternalApiMock)()).observable.subscribe({error:()=>t(),complete:()=>a(),next:()=>{}})}),expect(M).toHaveBeenCalledWith(new d(s))})}),describe("error cases",()=>{it("should error and output the error if the open app fails",()=>new Promise((o,a)=>{l(new I.UnknownDAError("Mocked error"));const t=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None,step:m.sendCommandInAppDAStateStep.OPEN_APP}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp,step:C.openAppDAStateStep.GET_DEVICE_STATUS}},{status:n.DeviceActionStatus.Error,error:new I.UnknownDAError("Mocked error")}];(0,S.testDeviceActionStates)(new c.SendCommandInAppDeviceAction({input:{command:new d(s),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}}),t,(0,i.makeDeviceActionInternalApiMock)(),{onDone:o,onError:a})})),it("should error and output an error if the send command fails",()=>new Promise((o,a)=>{l(),r.mockResolvedValue((0,u.CommandResultFactory)({error:new v.UnknownDeviceExchangeError("Mocked error")}));const t=new c.SendCommandInAppDeviceAction({input:{command:new d(s),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}});vi.spyOn(t,"extractDependencies").mockImplementation(p);const A=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None,step:m.sendCommandInAppDAStateStep.OPEN_APP}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp,step:C.openAppDAStateStep.GET_DEVICE_STATUS}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,step:m.sendCommandInAppDAStateStep.SEND_COMMAND}},{status:n.DeviceActionStatus.Error,error:new v.UnknownDeviceExchangeError("Mocked error")}];(0,S.testDeviceActionStates)(t,A,(0,i.makeDeviceActionInternalApiMock)(),{onDone:o,onError:a})}))}),describe("success cases",()=>{it("should succeed and output the command result if the send command succeeds",()=>new Promise((o,a)=>{l(),r.mockResolvedValue((0,u.CommandResultFactory)({data:D}));const t=new c.SendCommandInAppDeviceAction({input:{command:new d(s),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}});vi.spyOn(t,"extractDependencies").mockImplementation(p);const A=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None,step:m.sendCommandInAppDAStateStep.OPEN_APP}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp,step:C.openAppDAStateStep.GET_DEVICE_STATUS}},{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,step:m.sendCommandInAppDAStateStep.SEND_COMMAND}},{status:n.DeviceActionStatus.Completed,output:D}];(0,S.testDeviceActionStates)(t,A,(0,i.makeDeviceActionInternalApiMock)(),{onDone:o,onError:a})})),it("should succeed while skipping OpenApp",()=>new Promise((o,a)=>{l(),r.mockResolvedValue((0,u.CommandResultFactory)({data:D}));const t=new c.SendCommandInAppDeviceAction({input:{command:new d(s),appName:"MyApp",requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,skipOpenApp:!0}});vi.spyOn(t,"extractDependencies").mockImplementation(p);const A=[{status:n.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress,step:m.sendCommandInAppDAStateStep.SEND_COMMAND}},{status:n.DeviceActionStatus.Completed,output:D}];(0,S.testDeviceActionStates)(t,A,(0,i.makeDeviceActionInternalApiMock)(),{onDone:o,onError:a})}))})});class d{name="testCommand";params;constructor(p){this.params=p}getApdu(){return new k.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=SendCommandInAppDeviceAction.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.ts"],
4
- "sourcesContent": ["/* eslint @typescript-eslint/consistent-type-imports:0 */\nimport { Left, Right } from \"purify-ts\";\nimport { type Mock } from \"vitest\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { type Apdu } from \"@api/apdu/model/Apdu\";\nimport { ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { type Command } from \"@api/types\";\nimport { UnknownDeviceExchangeError } from \"@root/src\";\n\nimport { SendCommandInAppDeviceAction } from \"./SendCommandInAppDeviceAction\";\nimport {\n type SendCommandInAppDAError,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n} from \"./SendCommandInAppDeviceActionTypes\";\n\nvi.mock(\n \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\",\n async (importOriginal) => {\n const original =\n await importOriginal<\n typeof import(\"../OpenAppDeviceAction/OpenAppDeviceAction\")\n >();\n\n return {\n ...original,\n OpenAppDeviceAction: vi.fn(() => ({\n makeStateMachine: vi.fn(),\n })),\n };\n },\n);\n\nconst setupOpenAppDAMock = (error?: unknown) => {\n (OpenAppDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n initial: \"pending\",\n states: {\n pending: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n }),\n after: {\n 0: \"done\",\n },\n },\n done: {\n type: \"final\",\n },\n },\n output: () => (error ? Left(error) : Right(undefined)),\n }),\n ),\n }));\n};\n\ndescribe(\"SendCommandInAppDeviceAction\", () => {\n const sendMyCommand = vi.fn();\n\n const extractDependenciesMock = () => ({\n sendCommand: sendMyCommand,\n });\n\n const { sendCommand: apiSendCommandMock } = makeDeviceActionInternalApiMock();\n\n const commandParams = {\n paramString: \"aParameter\",\n paramNumber: 1234,\n };\n const mockedCommandResponse = {\n aNumber: 5678,\n aString: \"mockedResponseString\",\n };\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"without mocking extractDependencies\", () => {\n it(\"should call sendCommand on internalApi with the correct parameters\", async () => {\n setupOpenAppDAMock();\n apiSendCommandMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\n },\n });\n await new Promise<void>((resolve, reject) => {\n deviceAction\n ._execute(makeDeviceActionInternalApiMock())\n .observable.subscribe({\n error: () => reject(),\n complete: () => resolve(),\n next: () => {},\n });\n });\n\n expect(apiSendCommandMock).toHaveBeenCalledWith(\n new TestCommand(commandParams),\n );\n });\n });\n\n describe(\"error cases\", () => {\n it(\"should error and output the error if the open app fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock(new UnknownDAError(\"Mocked error\"));\n\n const expectedStates: MyCommandSendCommandDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\n },\n }),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should error and output an error if the send command fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n sendMyCommand.mockResolvedValue(\n CommandResultFactory({\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandSendCommandDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n\n describe(\"success cases\", () => {\n it(\"should succeed and output the command result if the send command succeeds\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n sendMyCommand.mockResolvedValue(\n CommandResultFactory({ data: mockedCommandResponse }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandSendCommandDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: mockedCommandResponse,\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should succeed while skipping OpenApp\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n sendMyCommand.mockResolvedValue(\n CommandResultFactory({ data: mockedCommandResponse }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: true,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandSendCommandDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: mockedCommandResponse,\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n});\n\ntype MyCommandResponse = {\n aNumber: number;\n aString: string;\n};\n\ntype MyCommandParams = {\n paramString: string;\n paramNumber: number;\n};\n\nclass TestCommand implements Command<MyCommandResponse, MyCommandParams> {\n readonly name = \"testCommand\";\n\n params: MyCommandParams;\n constructor(params: MyCommandParams) {\n this.params = params;\n }\n getApdu(): Apdu {\n return new ApduBuilder({ cla: 0x00, ins: 0x01, p1: 0x02, p2: 0x03 })\n .add32BitUIntToData(this.params.paramNumber)\n .addAsciiStringToData(this.params.paramString)\n .build();\n }\n parseResponse() {\n return CommandResultFactory({ data: { aNumber: 1, aString: \"aString\" } });\n }\n}\n\ntype MyCommandSendCommandDAState = DeviceActionState<\n SendCommandInAppDAOutput<MyCommandResponse>,\n SendCommandInAppDAError<UnknownDAError>,\n SendCommandInAppDAIntermediateValue<\n UserInteractionRequired.None | UserInteractionRequired.VerifyAddress\n >\n>;\n"],
5
- "mappings": "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",
6
- "names": ["import_purify_ts", "import_xstate", "import_ApduBuilder", "import_CommandResult", "import_makeInternalApi", "import_testDeviceActionStates", "import_DeviceActionState", "import_UserInteractionRequired", "import_Errors", "import_OpenAppDeviceAction", "import_src", "import_SendCommandInAppDeviceAction", "importOriginal", "setupOpenAppDAMock", "error", "sendMyCommand", "extractDependenciesMock", "apiSendCommandMock", "commandParams", "mockedCommandResponse", "deviceAction", "TestCommand", "resolve", "reject", "expectedStates", "params"]
4
+ "sourcesContent": ["/* eslint @typescript-eslint/consistent-type-imports:0 */\n\nimport { Left, Right } from \"purify-ts\";\nimport { type Mock } from \"vitest\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { type Apdu } from \"@api/apdu/model/Apdu\";\nimport { ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { openAppDAStateStep } from \"@api/device-action/os/OpenAppDeviceAction/types\";\nimport { type Command } from \"@api/types\";\nimport { UnknownDeviceExchangeError } from \"@root/src\";\n\nimport { SendCommandInAppDeviceAction } from \"./SendCommandInAppDeviceAction\";\nimport {\n type SendCommandInAppDAError,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n sendCommandInAppDAStateStep,\n} from \"./SendCommandInAppDeviceActionTypes\";\n\nvi.mock(\n \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\",\n async (importOriginal) => {\n const original =\n await importOriginal<\n typeof import(\"../OpenAppDeviceAction/OpenAppDeviceAction\")\n >();\n\n return {\n ...original,\n OpenAppDeviceAction: vi.fn(() => ({\n makeStateMachine: vi.fn(),\n })),\n };\n },\n);\n\nconst setupOpenAppDAMock = (error?: unknown) => {\n (OpenAppDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n initial: \"pending\",\n states: {\n pending: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n step: openAppDAStateStep.GET_DEVICE_STATUS,\n },\n }),\n after: {\n 0: \"done\",\n },\n },\n done: {\n type: \"final\",\n },\n },\n output: () => (error ? Left(error) : Right(undefined)),\n }),\n ),\n }));\n};\n\ndescribe(\"SendCommandInAppDeviceAction\", () => {\n const sendMyCommand = vi.fn();\n\n const extractDependenciesMock = () => ({\n sendCommand: sendMyCommand,\n });\n\n const { sendCommand: apiSendCommandMock } = makeDeviceActionInternalApiMock();\n\n const commandParams = {\n paramString: \"aParameter\",\n paramNumber: 1234,\n };\n const mockedCommandResponse = {\n aNumber: 5678,\n aString: \"mockedResponseString\",\n };\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"without mocking extractDependencies\", () => {\n it(\"should call sendCommand on internalApi with the correct parameters\", async () => {\n setupOpenAppDAMock();\n apiSendCommandMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\n },\n });\n await new Promise<void>((resolve, reject) => {\n deviceAction\n ._execute(makeDeviceActionInternalApiMock())\n .observable.subscribe({\n error: () => reject(),\n complete: () => resolve(),\n next: () => {},\n });\n });\n\n expect(apiSendCommandMock).toHaveBeenCalledWith(\n new TestCommand(commandParams),\n );\n });\n });\n\n describe(\"error cases\", () => {\n it(\"should error and output the error if the open app fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock(new UnknownDAError(\"Mocked error\"));\n\n const expectedStates: MyCommandSendCommandDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: sendCommandInAppDAStateStep.OPEN_APP,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n step: openAppDAStateStep.GET_DEVICE_STATUS,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\n },\n }),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should error and output an error if the send command fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n sendMyCommand.mockResolvedValue(\n CommandResultFactory({\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandSendCommandDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: sendCommandInAppDAStateStep.OPEN_APP,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n step: openAppDAStateStep.GET_DEVICE_STATUS,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n step: sendCommandInAppDAStateStep.SEND_COMMAND,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n\n describe(\"success cases\", () => {\n it(\"should succeed and output the command result if the send command succeeds\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n sendMyCommand.mockResolvedValue(\n CommandResultFactory({ data: mockedCommandResponse }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandSendCommandDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: sendCommandInAppDAStateStep.OPEN_APP,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n step: openAppDAStateStep.GET_DEVICE_STATUS,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n step: sendCommandInAppDAStateStep.SEND_COMMAND,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: mockedCommandResponse,\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should succeed while skipping OpenApp\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n sendMyCommand.mockResolvedValue(\n CommandResultFactory({ data: mockedCommandResponse }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: true,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandSendCommandDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n step: sendCommandInAppDAStateStep.SEND_COMMAND,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: mockedCommandResponse,\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n});\n\ntype MyCommandResponse = {\n aNumber: number;\n aString: string;\n};\n\ntype MyCommandParams = {\n paramString: string;\n paramNumber: number;\n};\n\nclass TestCommand implements Command<MyCommandResponse, MyCommandParams> {\n readonly name = \"testCommand\";\n\n params: MyCommandParams;\n constructor(params: MyCommandParams) {\n this.params = params;\n }\n getApdu(): Apdu {\n return new ApduBuilder({ cla: 0x00, ins: 0x01, p1: 0x02, p2: 0x03 })\n .add32BitUIntToData(this.params.paramNumber)\n .addAsciiStringToData(this.params.paramString)\n .build();\n }\n parseResponse() {\n return CommandResultFactory({ data: { aNumber: 1, aString: \"aString\" } });\n }\n}\n\ntype MyCommandSendCommandDAState = DeviceActionState<\n SendCommandInAppDAOutput<MyCommandResponse>,\n SendCommandInAppDAError<UnknownDAError>,\n SendCommandInAppDAIntermediateValue<\n UserInteractionRequired.None | UserInteractionRequired.VerifyAddress\n >\n>;\n"],
5
+ "mappings": "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",
6
+ "names": ["import_purify_ts", "import_xstate", "import_ApduBuilder", "import_CommandResult", "import_makeInternalApi", "import_testDeviceActionStates", "import_DeviceActionState", "import_UserInteractionRequired", "import_Errors", "import_OpenAppDeviceAction", "import_types", "import_src", "import_SendCommandInAppDeviceAction", "import_SendCommandInAppDeviceActionTypes", "importOriginal", "setupOpenAppDAMock", "error", "sendMyCommand", "extractDependenciesMock", "apiSendCommandMock", "commandParams", "mockedCommandResponse", "deviceAction", "TestCommand", "resolve", "reject", "expectedStates", "params"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var m=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var t=Object.prototype.hasOwnProperty;var s=(r,e,p,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of a(e))!t.call(r,o)&&o!==p&&m(r,o,{get:()=>e[o],enumerable:!(n=d(e,o))||n.enumerable});return r};var C=r=>s(m({},"__esModule",{value:!0}),r);var A={};module.exports=C(A);
1
+ "use strict";var p=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var s=(n,e)=>{for(var r in e)p(n,r,{get:e[r],enumerable:!0})},A=(n,e,r,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d(e))!a.call(n,o)&&o!==r&&p(n,o,{get:()=>e[o],enumerable:!(m=t(e,o))||m.enumerable});return n};var C=n=>A(p({},"__esModule",{value:!0}),n);var i={};s(i,{sendCommandInAppDAStateStep:()=>I});module.exports=C(i);const I=Object.freeze({OPEN_APP:"os.sendCommandInApp.steps.openApp",SEND_COMMAND:"os.sendCommandInApp.steps.sendCommand"});0&&(module.exports={sendCommandInAppDAStateStep});
2
2
  //# sourceMappingURL=SendCommandInAppDeviceActionTypes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.ts"],
4
- "sourcesContent": ["import { type CommandErrorResult } from \"@api/command/model/CommandResult\";\nimport {\n type OpenAppDAError,\n type OpenAppDAIntermediateValue,\n} from \"@api/device-action/os/OpenAppDeviceAction/types\";\nimport { type Command } from \"@api/types\";\n\nexport type SendCommandInAppDAOutput<CommandResponse> = CommandResponse;\n\nexport type SendCommandInAppDAInput<\n CommandResponse,\n CommandArgs,\n CommandErrorCodes,\n UserInteraction,\n> = {\n readonly command: Command<CommandResponse, CommandArgs, CommandErrorCodes>;\n readonly appName: string;\n readonly skipOpenApp: boolean;\n readonly requiredUserInteraction: UserInteraction;\n};\n\nexport type SendCommandInAppDAError<CommandErrorCodes = void> =\n | OpenAppDAError\n | CommandErrorResult<CommandErrorCodes>[\"error\"];\n\nexport type SendCommandInAppDAIntermediateValue<UserInteraction> =\n | { readonly requiredUserInteraction: UserInteraction }\n | OpenAppDAIntermediateValue;\n\nexport type SendCommandInAppDAInternalState<\n CommandResponse,\n CommandErrorCodes,\n> = {\n readonly commandResponse: CommandResponse | null;\n readonly error: SendCommandInAppDAError<CommandErrorCodes> | null;\n};\n"],
5
- "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
- "names": ["SendCommandInAppDeviceActionTypes_exports", "__toCommonJS"]
4
+ "sourcesContent": ["import { type CommandErrorResult } from \"@api/command/model/CommandResult\";\nimport { type UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport {\n type OpenAppDAError,\n type OpenAppDAIntermediateValue,\n} from \"@api/device-action/os/OpenAppDeviceAction/types\";\nimport { type Command } from \"@api/types\";\n\nexport const sendCommandInAppDAStateStep = Object.freeze({\n OPEN_APP: \"os.sendCommandInApp.steps.openApp\",\n SEND_COMMAND: \"os.sendCommandInApp.steps.sendCommand\",\n} as const);\n\nexport type SendCommandInAppDAStateStep =\n (typeof sendCommandInAppDAStateStep)[keyof typeof sendCommandInAppDAStateStep];\n\nexport type SendCommandInAppDAOutput<CommandResponse> = CommandResponse;\n\nexport type SendCommandInAppDAInput<\n CommandResponse,\n CommandArgs,\n CommandErrorCodes,\n UserInteraction,\n> = {\n readonly command: Command<CommandResponse, CommandArgs, CommandErrorCodes>;\n readonly appName: string;\n readonly skipOpenApp: boolean;\n readonly requiredUserInteraction: UserInteraction;\n};\n\nexport type SendCommandInAppDAError<CommandErrorCodes = void> =\n | OpenAppDAError\n | CommandErrorResult<CommandErrorCodes>[\"error\"];\n\nexport type SendCommandInAppDARequiredInteraction =\n UserInteractionRequired.None;\n\nexport type SendCommandInAppDAIntermediateValue<UserInteraction> =\n | {\n readonly requiredUserInteraction:\n | UserInteraction\n | SendCommandInAppDARequiredInteraction;\n readonly step: SendCommandInAppDAStateStep;\n }\n | OpenAppDAIntermediateValue;\n\nexport type SendCommandInAppDAInternalState<\n CommandResponse,\n CommandErrorCodes,\n> = {\n readonly commandResponse: CommandResponse | null;\n readonly error: SendCommandInAppDAError<CommandErrorCodes> | null;\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAQO,MAAME,EAA8B,OAAO,OAAO,CACvD,SAAU,oCACV,aAAc,uCAChB,CAAU",
6
+ "names": ["SendCommandInAppDeviceActionTypes_exports", "__export", "sendCommandInAppDAStateStep", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var U=(a,e)=>{for(var o in e)p(a,o,{get:e[o],enumerable:!0})},h=(a,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of v(e))!I.call(a,r)&&r!==o&&p(a,r,{get:()=>e[r],enumerable:!(t=y(e,r))||t.enumerable});return a};var R=a=>h(p({},"__esModule",{value:!0}),a);var G={};U(G,{GetFirmwareMetadataTask:()=>x});module.exports=R(G);var f=require("../../command/Errors"),n=require("../../command/model/CommandResult"),l=require("../../command/os/GetCustomImageSizeCommand"),F=require("../../command/os/GetOsVersionCommand");class x{constructor(e){this.api=e}async run(){const e=await this.api.sendCommand(new F.GetOsVersionCommand);if(!(0,n.isSuccessCommandResult)(e))return e;const o={mcu:e.data.mcuSephVersion,bootloader:e.data.mcuBootloaderVersion,os:e.data.seVersion,metadata:e.data},t=this.api.getManagerApiService(),r=await t.getDeviceVersion(e.data).chain(i=>t.getFirmwareVersion(e.data,i).map(s=>({deviceVersion:i,currentFirmware:s})));if(r.isLeft())return(0,n.CommandResultFactory)({error:new f.InvalidGetFirmwareMetadataResponseError});const{deviceVersion:c,currentFirmware:d}=r.unsafeCoerce(),V=(await t.getLatestFirmwareVersion(d,c).chain(i=>t.getNextFirmwareVersion(i).chain(s=>t.getMcuList().map(m=>m.find(g=>g.name===o.mcu)).map(m=>m===void 0||!s.mcuVersions.includes(m.id)).map(m=>({osuFirmware:i,finalFirmware:s,mcuUpdateRequired:m}))))).caseOf({Right:i=>i,Left:i=>{}}),C={currentFirmware:d,availableUpdate:V};let u={};const w=await this.api.sendCommand(new l.GetCustomImageSizeCommand);return(0,n.isSuccessCommandResult)(w)&&(u={size:w.data}),(0,n.CommandResultFactory)({data:{deviceVersion:c,firmware:d,firmwareVersion:o,firmwareUpdateContext:C,customImage:u}})}}0&&(module.exports={GetFirmwareMetadataTask});
1
+ "use strict";var p=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var U=(a,e)=>{for(var o in e)p(a,o,{get:e[o],enumerable:!0})},h=(a,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of v(e))!I.call(a,r)&&r!==o&&p(a,r,{get:()=>e[r],enumerable:!(t=y(e,r))||t.enumerable});return a};var R=a=>h(p({},"__esModule",{value:!0}),a);var G={};U(G,{GetFirmwareMetadataTask:()=>x});module.exports=R(G);var f=require("../../command/Errors"),n=require("../../command/model/CommandResult"),l=require("../../command/os/GetBackgroundImageSizeCommand"),F=require("../../command/os/GetOsVersionCommand");class x{constructor(e){this.api=e}async run(){const e=await this.api.sendCommand(new F.GetOsVersionCommand);if(!(0,n.isSuccessCommandResult)(e))return e;const o={mcu:e.data.mcuSephVersion,bootloader:e.data.mcuBootloaderVersion,os:e.data.seVersion,metadata:e.data},t=this.api.getManagerApiService(),r=await t.getDeviceVersion(e.data).chain(i=>t.getFirmwareVersion(e.data,i).map(s=>({deviceVersion:i,currentFirmware:s})));if(r.isLeft())return(0,n.CommandResultFactory)({error:new f.InvalidGetFirmwareMetadataResponseError});const{deviceVersion:c,currentFirmware:d}=r.unsafeCoerce(),V=(await t.getLatestFirmwareVersion(d,c).chain(i=>t.getNextFirmwareVersion(i).chain(s=>t.getMcuList().map(m=>m.find(C=>C.name===o.mcu)).map(m=>m===void 0||!s.mcuVersions.includes(m.id)).map(m=>({osuFirmware:i,finalFirmware:s,mcuUpdateRequired:m}))))).caseOf({Right:i=>i,Left:i=>{}}),g={currentFirmware:d,availableUpdate:V};let u={};const w=await this.api.sendCommand(new l.GetBackgroundImageSizeCommand);return(0,n.isSuccessCommandResult)(w)&&(u={size:w.data}),(0,n.CommandResultFactory)({data:{deviceVersion:c,firmware:d,firmwareVersion:o,firmwareUpdateContext:g,customImage:u}})}}0&&(module.exports={GetFirmwareMetadataTask});
2
2
  //# sourceMappingURL=GetFirmwareMetadataTask.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/task/GetFirmwareMetadataTask.ts"],
4
- "sourcesContent": ["import { InvalidGetFirmwareMetadataResponseError } from \"@api/command/Errors\";\nimport {\n type CommandResult,\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { GetCustomImageSizeCommand } from \"@api/command/os/GetCustomImageSizeCommand\";\nimport { GetOsVersionCommand } from \"@api/command/os/GetOsVersionCommand\";\nimport type { InternalApi } from \"@api/device-action/DeviceAction\";\nimport {\n type CustomImage,\n type FirmwareUpdate,\n type FirmwareUpdateContext,\n type FirmwareVersion,\n} from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { type FinalFirmware } from \"@internal/manager-api/model/Firmware\";\n\nexport type GetFirmwareMetadataTaskResult = CommandResult<{\n deviceVersion: DeviceVersion;\n firmware: FinalFirmware;\n firmwareVersion: FirmwareVersion;\n firmwareUpdateContext: FirmwareUpdateContext;\n customImage: CustomImage;\n}>;\n\nexport class GetFirmwareMetadataTask {\n constructor(private readonly api: InternalApi) {}\n\n async run(): Promise<GetFirmwareMetadataTaskResult> {\n // Get installed firmware metadata\n const osVersion = await this.api.sendCommand(new GetOsVersionCommand());\n if (!isSuccessCommandResult(osVersion)) {\n return osVersion;\n }\n const firmwareVersion: FirmwareVersion = {\n mcu: osVersion.data.mcuSephVersion,\n bootloader: osVersion.data.mcuBootloaderVersion,\n os: osVersion.data.seVersion,\n metadata: osVersion.data,\n };\n\n // Fetch current firmware metadata from app store\n const manager = this.api.getManagerApiService();\n const result = await manager\n .getDeviceVersion(osVersion.data)\n .chain((deviceVersion) =>\n manager\n .getFirmwareVersion(osVersion.data, deviceVersion)\n .map((currentFirmware) => ({ deviceVersion, currentFirmware })),\n );\n if (result.isLeft()) {\n return CommandResultFactory({\n error: new InvalidGetFirmwareMetadataResponseError(),\n });\n }\n const { deviceVersion, currentFirmware } = result.unsafeCoerce();\n\n // Fetch latest firmware available, if any\n const maybeUpdate = await manager\n .getLatestFirmwareVersion(currentFirmware, deviceVersion)\n .chain((osuFirmware) =>\n manager.getNextFirmwareVersion(osuFirmware).chain((finalFirmware) =>\n manager\n .getMcuList()\n .map((mcus) => mcus.find((mcu) => mcu.name === firmwareVersion.mcu))\n .map(\n (mcu) =>\n mcu === undefined ||\n !finalFirmware.mcuVersions.includes(mcu.id),\n )\n .map((mcuUpdateRequired) => ({\n osuFirmware,\n finalFirmware,\n mcuUpdateRequired,\n })),\n ),\n );\n const availableUpdate: FirmwareUpdate | undefined = maybeUpdate.caseOf({\n Right: (data) => data,\n Left: (_error) => undefined,\n });\n const firmwareUpdateContext = {\n currentFirmware,\n availableUpdate,\n };\n\n // Get custom image metadata\n let customImage: CustomImage = {};\n const imageSize = await this.api.sendCommand(\n new GetCustomImageSizeCommand(),\n );\n if (isSuccessCommandResult(imageSize)) {\n customImage = { size: imageSize.data };\n }\n\n // Return firmware metadata\n return CommandResultFactory({\n data: {\n deviceVersion,\n firmware: currentFirmware,\n firmwareVersion,\n firmwareUpdateContext,\n customImage,\n },\n });\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAwD,+BACxDC,EAIO,4CACPC,EAA0C,qDAC1CC,EAAoC,+CAmB7B,MAAML,CAAwB,CACnC,YAA6BM,EAAkB,CAAlB,SAAAA,CAAmB,CAEhD,MAAM,KAA8C,CAElD,MAAMC,EAAY,MAAM,KAAK,IAAI,YAAY,IAAI,qBAAqB,EACtE,GAAI,IAAC,0BAAuBA,CAAS,EACnC,OAAOA,EAET,MAAMC,EAAmC,CACvC,IAAKD,EAAU,KAAK,eACpB,WAAYA,EAAU,KAAK,qBAC3B,GAAIA,EAAU,KAAK,UACnB,SAAUA,EAAU,IACtB,EAGME,EAAU,KAAK,IAAI,qBAAqB,EACxCC,EAAS,MAAMD,EAClB,iBAAiBF,EAAU,IAAI,EAC/B,MAAOI,GACNF,EACG,mBAAmBF,EAAU,KAAMI,CAAa,EAChD,IAAKC,IAAqB,CAAE,cAAAD,EAAe,gBAAAC,CAAgB,EAAE,CAClE,EACF,GAAIF,EAAO,OAAO,EAChB,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yCACb,CAAC,EAEH,KAAM,CAAE,cAAAC,EAAe,gBAAAC,CAAgB,EAAIF,EAAO,aAAa,EAsBzDG,GAnBc,MAAMJ,EACvB,yBAAyBG,EAAiBD,CAAa,EACvD,MAAOG,GACNL,EAAQ,uBAAuBK,CAAW,EAAE,MAAOC,GACjDN,EACG,WAAW,EACX,IAAKO,GAASA,EAAK,KAAMC,GAAQA,EAAI,OAAST,EAAgB,GAAG,CAAC,EAClE,IACES,GACCA,IAAQ,QACR,CAACF,EAAc,YAAY,SAASE,EAAI,EAAE,CAC9C,EACC,IAAKC,IAAuB,CAC3B,YAAAJ,EACA,cAAAC,EACA,kBAAAG,CACF,EAAE,CACN,CACF,GAC8D,OAAO,CACrE,MAAQC,GAASA,EACjB,KAAOC,GAAQ,EACjB,CAAC,EACKC,EAAwB,CAC5B,gBAAAT,EACA,gBAAAC,CACF,EAGA,IAAIS,EAA2B,CAAC,EAChC,MAAMC,EAAY,MAAM,KAAK,IAAI,YAC/B,IAAI,2BACN,EACA,SAAI,0BAAuBA,CAAS,IAClCD,EAAc,CAAE,KAAMC,EAAU,IAAK,MAIhC,wBAAqB,CAC1B,KAAM,CACJ,cAAAZ,EACA,SAAUC,EACV,gBAAAJ,EACA,sBAAAa,EACA,YAAAC,CACF,CACF,CAAC,CACH,CACF",
6
- "names": ["GetFirmwareMetadataTask_exports", "__export", "GetFirmwareMetadataTask", "__toCommonJS", "import_Errors", "import_CommandResult", "import_GetCustomImageSizeCommand", "import_GetOsVersionCommand", "api", "osVersion", "firmwareVersion", "manager", "result", "deviceVersion", "currentFirmware", "availableUpdate", "osuFirmware", "finalFirmware", "mcus", "mcu", "mcuUpdateRequired", "data", "_error", "firmwareUpdateContext", "customImage", "imageSize"]
4
+ "sourcesContent": ["import { InvalidGetFirmwareMetadataResponseError } from \"@api/command/Errors\";\nimport {\n type CommandResult,\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { GetBackgroundImageSizeCommand } from \"@api/command/os/GetBackgroundImageSizeCommand\";\nimport { GetOsVersionCommand } from \"@api/command/os/GetOsVersionCommand\";\nimport type { InternalApi } from \"@api/device-action/DeviceAction\";\nimport {\n type CustomImage,\n type FirmwareUpdate,\n type FirmwareUpdateContext,\n type FirmwareVersion,\n} from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { type FinalFirmware } from \"@internal/manager-api/model/Firmware\";\n\nexport type GetFirmwareMetadataTaskResult = CommandResult<{\n deviceVersion: DeviceVersion;\n firmware: FinalFirmware;\n firmwareVersion: FirmwareVersion;\n firmwareUpdateContext: FirmwareUpdateContext;\n customImage: CustomImage;\n}>;\n\nexport class GetFirmwareMetadataTask {\n constructor(private readonly api: InternalApi) {}\n\n async run(): Promise<GetFirmwareMetadataTaskResult> {\n // Get installed firmware metadata\n const osVersion = await this.api.sendCommand(new GetOsVersionCommand());\n if (!isSuccessCommandResult(osVersion)) {\n return osVersion;\n }\n const firmwareVersion: FirmwareVersion = {\n mcu: osVersion.data.mcuSephVersion,\n bootloader: osVersion.data.mcuBootloaderVersion,\n os: osVersion.data.seVersion,\n metadata: osVersion.data,\n };\n\n // Fetch current firmware metadata from app store\n const manager = this.api.getManagerApiService();\n const result = await manager\n .getDeviceVersion(osVersion.data)\n .chain((deviceVersion) =>\n manager\n .getFirmwareVersion(osVersion.data, deviceVersion)\n .map((currentFirmware) => ({ deviceVersion, currentFirmware })),\n );\n if (result.isLeft()) {\n return CommandResultFactory({\n error: new InvalidGetFirmwareMetadataResponseError(),\n });\n }\n const { deviceVersion, currentFirmware } = result.unsafeCoerce();\n\n // Fetch latest firmware available, if any\n const maybeUpdate = await manager\n .getLatestFirmwareVersion(currentFirmware, deviceVersion)\n .chain((osuFirmware) =>\n manager.getNextFirmwareVersion(osuFirmware).chain((finalFirmware) =>\n manager\n .getMcuList()\n .map((mcus) => mcus.find((mcu) => mcu.name === firmwareVersion.mcu))\n .map(\n (mcu) =>\n mcu === undefined ||\n !finalFirmware.mcuVersions.includes(mcu.id),\n )\n .map((mcuUpdateRequired) => ({\n osuFirmware,\n finalFirmware,\n mcuUpdateRequired,\n })),\n ),\n );\n const availableUpdate: FirmwareUpdate | undefined = maybeUpdate.caseOf({\n Right: (data) => data,\n Left: (_error) => undefined,\n });\n const firmwareUpdateContext = {\n currentFirmware,\n availableUpdate,\n };\n\n // Get custom image metadata\n let customImage: CustomImage = {};\n const imageSize = await this.api.sendCommand(\n new GetBackgroundImageSizeCommand(),\n );\n if (isSuccessCommandResult(imageSize)) {\n customImage = { size: imageSize.data };\n }\n\n // Return firmware metadata\n return CommandResultFactory({\n data: {\n deviceVersion,\n firmware: currentFirmware,\n firmwareVersion,\n firmwareUpdateContext,\n customImage,\n },\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAwD,+BACxDC,EAIO,4CACPC,EAA8C,yDAC9CC,EAAoC,+CAmB7B,MAAML,CAAwB,CACnC,YAA6BM,EAAkB,CAAlB,SAAAA,CAAmB,CAEhD,MAAM,KAA8C,CAElD,MAAMC,EAAY,MAAM,KAAK,IAAI,YAAY,IAAI,qBAAqB,EACtE,GAAI,IAAC,0BAAuBA,CAAS,EACnC,OAAOA,EAET,MAAMC,EAAmC,CACvC,IAAKD,EAAU,KAAK,eACpB,WAAYA,EAAU,KAAK,qBAC3B,GAAIA,EAAU,KAAK,UACnB,SAAUA,EAAU,IACtB,EAGME,EAAU,KAAK,IAAI,qBAAqB,EACxCC,EAAS,MAAMD,EAClB,iBAAiBF,EAAU,IAAI,EAC/B,MAAOI,GACNF,EACG,mBAAmBF,EAAU,KAAMI,CAAa,EAChD,IAAKC,IAAqB,CAAE,cAAAD,EAAe,gBAAAC,CAAgB,EAAE,CAClE,EACF,GAAIF,EAAO,OAAO,EAChB,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yCACb,CAAC,EAEH,KAAM,CAAE,cAAAC,EAAe,gBAAAC,CAAgB,EAAIF,EAAO,aAAa,EAsBzDG,GAnBc,MAAMJ,EACvB,yBAAyBG,EAAiBD,CAAa,EACvD,MAAOG,GACNL,EAAQ,uBAAuBK,CAAW,EAAE,MAAOC,GACjDN,EACG,WAAW,EACX,IAAKO,GAASA,EAAK,KAAMC,GAAQA,EAAI,OAAST,EAAgB,GAAG,CAAC,EAClE,IACES,GACCA,IAAQ,QACR,CAACF,EAAc,YAAY,SAASE,EAAI,EAAE,CAC9C,EACC,IAAKC,IAAuB,CAC3B,YAAAJ,EACA,cAAAC,EACA,kBAAAG,CACF,EAAE,CACN,CACF,GAC8D,OAAO,CACrE,MAAQC,GAASA,EACjB,KAAOC,GAAQ,EACjB,CAAC,EACKC,EAAwB,CAC5B,gBAAAT,EACA,gBAAAC,CACF,EAGA,IAAIS,EAA2B,CAAC,EAChC,MAAMC,EAAY,MAAM,KAAK,IAAI,YAC/B,IAAI,+BACN,EACA,SAAI,0BAAuBA,CAAS,IAClCD,EAAc,CAAE,KAAMC,EAAU,IAAK,MAIhC,wBAAqB,CAC1B,KAAM,CACJ,cAAAZ,EACA,SAAUC,EACV,gBAAAJ,EACA,sBAAAa,EACA,YAAAC,CACF,CACF,CAAC,CACH,CACF",
6
+ "names": ["GetFirmwareMetadataTask_exports", "__export", "GetFirmwareMetadataTask", "__toCommonJS", "import_Errors", "import_CommandResult", "import_GetBackgroundImageSizeCommand", "import_GetOsVersionCommand", "api", "osVersion", "firmwareVersion", "manager", "result", "deviceVersion", "currentFirmware", "availableUpdate", "osuFirmware", "finalFirmware", "mcus", "mcu", "mcuUpdateRequired", "data", "_error", "firmwareUpdateContext", "customImage", "imageSize"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var A=(a,e)=>{for(var t in e)l(a,t,{get:e[t],enumerable:!0})},D=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of v(e))!g.call(a,n)&&n!==t&&l(a,n,{get:()=>e[n],enumerable:!(r=y(e,n))||r.enumerable});return a};var E=a=>D(l({},"__esModule",{value:!0}),a);var M={};A(M,{XStateDeviceAction:()=>x});module.exports=E(M);var o=require("rxjs"),h=require("xstate"),p=require("../../device-action/model/DeviceActionState");class x{input;inspect=!1;logger;constructor(e){this.input=e.input,this.inspect=!!e.inspect,this.logger=e.logger}_execute(e){const t=this.makeStateMachine(e);return this._subscribeToStateMachine(t)}_subscribeToStateMachine(e){const t=(0,h.createActor)(e,{input:this.input}),r=new o.ReplaySubject;let n=!1;const m=i=>{const{context:u,status:s,output:b,error:I}=i;if(this.logger&&!n&&(n=!0,this.logger.debug("[XStateDeviceAction] Input",{data:{input:u.input}})),this.logger&&s==="active"){const c=typeof i.value=="string"?i.value:JSON.stringify(i.value);this.logger.debug(`[XStateDeviceAction] State: ${c}`,{data:{internalState:u._internalState}})}switch(s){case"active":r.next({status:p.DeviceActionStatus.Pending,intermediateValue:u.intermediateValue});break;case"done":b.caseOf({Left:c=>{r.next({status:p.DeviceActionStatus.Error,error:c})},Right:c=>{r.next({status:p.DeviceActionStatus.Completed,output:c})}}),r.complete();break;case"error":r.error(I),r.complete();break;case"stopped":r.next({status:p.DeviceActionStatus.Stopped}),r.complete();break;default:this._exhaustiveMatchingGuard(s)}},d=new o.Observable(i=>{const u=r.subscribe(i);return()=>{S.unsubscribe(),u.unsubscribe(),t.stop()}}),S=t.subscribe(m);return t.start(),{observable:d.pipe((0,o.share)()),cancel:()=>{t.stop(),S.unsubscribe(),m(t.getSnapshot())}}}_exhaustiveMatchingGuard(e){throw console.log("_exhaustiveMatchingGuard status",e),new Error(`Unhandled status: ${e}`)}}0&&(module.exports={XStateDeviceAction});
1
+ "use strict";var l=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var D=(a,e)=>{for(var t in e)l(a,t,{get:e[t],enumerable:!0})},E=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of v(e))!A.call(a,n)&&n!==t&&l(a,n,{get:()=>e[n],enumerable:!(r=I(e,n))||r.enumerable});return a};var f=a=>E(l({},"__esModule",{value:!0}),a);var M={};D(M,{XStateDeviceAction:()=>x});module.exports=f(M);var o=require("rxjs"),S=require("xstate"),s=require("../../device-action/model/DeviceActionState"),m=require("../../logger-publisher/utils/noopLoggerFactory");class x{input;inspect=!1;logger;loggerFactory;constructor(e){this.input=e.input,this.inspect=!!e.inspect,this.logger=e.logger,this.loggerFactory=e.loggerFactory}getLoggerFactory(e){return this.loggerFactory??e.loggerFactory??m.noopLoggerFactory}_execute(e){const t=this.makeStateMachine(e);return!this.logger&&t.id&&(this.logger=this.getLoggerFactory(e)(t.id)),this._subscribeToStateMachine(t)}_subscribeToStateMachine(e){const t=(0,S.createActor)(e,{input:this.input}),r=new o.ReplaySubject;let n=!1;const g=i=>{const{context:c,status:p,output:y,error:b}=i;if(this.logger&&!n&&(n=!0,this.logger.debug("[XStateDeviceAction] Input",{data:{input:c.input}})),this.logger&&p==="active"){const u=typeof i.value=="string"?i.value:JSON.stringify(i.value);this.logger.debug(`[XStateDeviceAction] State: ${u}`,{data:{internalState:c._internalState}})}switch(p){case"active":r.next({status:s.DeviceActionStatus.Pending,intermediateValue:c.intermediateValue});break;case"done":y.caseOf({Left:u=>{r.next({status:s.DeviceActionStatus.Error,error:u})},Right:u=>{r.next({status:s.DeviceActionStatus.Completed,output:u})}}),r.complete();break;case"error":r.error(b),r.complete();break;case"stopped":r.next({status:s.DeviceActionStatus.Stopped}),r.complete();break;default:this._exhaustiveMatchingGuard(p)}},d=new o.Observable(i=>{const c=r.subscribe(i);return()=>{h.unsubscribe(),c.unsubscribe(),t.stop()}}),h=t.subscribe(g);return t.start(),{observable:d.pipe((0,o.share)()),cancel:()=>{t.stop(),h.unsubscribe(),g(t.getSnapshot())}}}_exhaustiveMatchingGuard(e){throw console.log("_exhaustiveMatchingGuard status",e),new Error(`Unhandled status: ${e}`)}}0&&(module.exports={XStateDeviceAction});
2
2
  //# sourceMappingURL=XStateDeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/xstate-utils/XStateDeviceAction.ts"],
4
- "sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { Observable, ReplaySubject, share } from \"rxjs\";\nimport {\n createActor,\n type SnapshotFrom,\n type StateMachine,\n type StateSchema,\n} from \"xstate\";\n\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\n\nimport { type StateMachineTypes } from \"./StateMachineTypes\";\n\nexport type DeviceActionStateMachine<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> = StateMachine<\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"context\"], // context\n /**\n * The following usages `any` are OK because this is just a wrapper around the\n * state machine and we are not directly going to use these types.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any, // event\n any, // children\n any, // actor\n any, // action\n any, // guard\n any, // delay\n any, // state value\n any, // tag\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"input\"],\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"output\"],\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any,\n any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateSchema\n>;\n\n/**\n * A DeviceAction that uses an XState state machine to execute.\n * It maps the state machine snapshots to the DeviceActionState.\n * This class is abstract and should be extended to implement the state machine.\n */\nexport abstract class XStateDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> implements DeviceAction<Output, Input, Error, IntermediateValue>\n{\n readonly input: Input;\n readonly inspect: boolean = false;\n protected readonly logger?: LoggerPublisherService;\n\n /**\n *\n * @param input The input for the DeviceAction\n * @param inspect If true, the state machine will be inspected in the browser\n * @param logger Optional logger for debugging. If provided, input and internal state will be logged on state transitions.\n */\n constructor(args: {\n input: Input;\n inspect?: boolean;\n logger?: LoggerPublisherService;\n }) {\n this.input = args.input;\n this.inspect = Boolean(args.inspect);\n this.logger = args.logger;\n }\n\n protected abstract makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >;\n\n _execute(\n internalApi: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const stateMachine = this.makeStateMachine(internalApi);\n return this._subscribeToStateMachine(stateMachine);\n }\n\n protected _subscribeToStateMachine(\n stateMachine: DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n // inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n let hasLoggedInput = false;\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n\n // Log input once at the beginning\n if (this.logger && !hasLoggedInput) {\n hasLoggedInput = true;\n this.logger.debug(\"[XStateDeviceAction] Input\", {\n data: { input: context.input },\n });\n }\n\n // Log internal state on each state transition\n if (this.logger && status === \"active\") {\n const stateValue =\n typeof snapshot.value === \"string\"\n ? snapshot.value\n : JSON.stringify(snapshot.value);\n this.logger.debug(`[XStateDeviceAction] State: ${stateValue}`, {\n data: { internalState: context._internalState },\n });\n }\n\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n private _exhaustiveMatchingGuard(status: never): never {\n console.log(\"_exhaustiveMatchingGuard status\", status);\n throw new Error(`Unhandled status: ${status}`);\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAiD,gBACjDC,EAKO,kBAQPC,EAGO,sDA4DA,MAAeJ,CAOtB,CACW,MACA,QAAmB,GACT,OAQnB,YAAYK,EAIT,CACD,KAAK,MAAQA,EAAK,MAClB,KAAK,QAAU,EAAQA,EAAK,QAC5B,KAAK,OAASA,EAAK,MACrB,CAYA,SACEC,EACiE,CACjE,MAAMC,EAAe,KAAK,iBAAiBD,CAAW,EACtD,OAAO,KAAK,yBAAyBC,CAAY,CACnD,CAEU,yBACRA,EAOiE,CACjE,MAAMC,KAAQ,eAAYD,EAAc,CACtC,MAAO,KAAK,KAGd,CAAC,EAQKE,EAAU,IAAI,gBAIpB,IAAIC,EAAiB,GAErB,MAAMC,EACJC,GACG,CACH,KAAM,CAAE,QAAAC,EAAS,OAAAC,EAAQ,OAAAC,EAAQ,MAAAC,CAAM,EAAIJ,EAW3C,GARI,KAAK,QAAU,CAACF,IAClBA,EAAiB,GACjB,KAAK,OAAO,MAAM,6BAA8B,CAC9C,KAAM,CAAE,MAAOG,EAAQ,KAAM,CAC/B,CAAC,GAIC,KAAK,QAAUC,IAAW,SAAU,CACtC,MAAMG,EACJ,OAAOL,EAAS,OAAU,SACtBA,EAAS,MACT,KAAK,UAAUA,EAAS,KAAK,EACnC,KAAK,OAAO,MAAM,+BAA+BK,CAAU,GAAI,CAC7D,KAAM,CAAE,cAAeJ,EAAQ,cAAe,CAChD,CAAC,CACH,CAEA,OAAQC,EAAQ,CACd,IAAK,SACHL,EAAQ,KAAK,CACX,OAAQ,qBAAmB,QAC3B,kBAAmBI,EAAQ,iBAC7B,CAAC,EACD,MACF,IAAK,OACHE,EAAO,OAAO,CACZ,KAAOG,GAAQ,CACbT,EAAQ,KAAK,CACX,OAAQ,qBAAmB,MAC3B,MAAOS,CACT,CAAC,CACH,EACA,MAAQC,GAAW,CACjBV,EAAQ,KAAK,CACX,OAAQ,qBAAmB,UAC3B,OAAQU,CACV,CAAC,CACH,CACF,CAAC,EACDV,EAAQ,SAAS,EACjB,MACF,IAAK,QAEHA,EAAQ,MAAMO,CAAK,EACnBP,EAAQ,SAAS,EACjB,MACF,IAAK,UACHA,EAAQ,KAAK,CACX,OAAQ,qBAAmB,OAC7B,CAAC,EACDA,EAAQ,SAAS,EACjB,MACF,QACE,KAAK,yBAAyBK,CAAM,CACxC,CACF,EAEMM,EAAa,IAAI,aAEpBC,GAAe,CAChB,MAAMC,EAAsBb,EAAQ,UAAUY,CAAU,EACxD,MAAO,IAAM,CACXE,EAAkB,YAAY,EAC9BD,EAAoB,YAAY,EAChCd,EAAM,KAAK,CACb,CACF,CAAC,EAEKe,EAAoBf,EAAM,UAAUG,CAAmB,EAC7D,OAAAH,EAAM,MAAM,EAEL,CACL,WAAYY,EAAW,QAAK,SAAM,CAAC,EACnC,OAAQ,IAAM,CACZZ,EAAM,KAAK,EACXe,EAAkB,YAAY,EAC9BZ,EAAoBH,EAAM,YAAY,CAAC,CACzC,CACF,CACF,CAEQ,yBAAyBM,EAAsB,CACrD,cAAQ,IAAI,kCAAmCA,CAAM,EAC/C,IAAI,MAAM,qBAAqBA,CAAM,EAAE,CAC/C,CACF",
6
- "names": ["XStateDeviceAction_exports", "__export", "XStateDeviceAction", "__toCommonJS", "import_rxjs", "import_xstate", "import_DeviceActionState", "args", "internalApi", "stateMachine", "actor", "subject", "hasLoggedInput", "handleActorSnapshot", "snapshot", "context", "status", "output", "error", "stateValue", "err", "result", "observable", "subscriber", "subjectSubscription", "actorSubscription"]
4
+ "sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { Observable, ReplaySubject, share } from \"rxjs\";\nimport {\n createActor,\n type SnapshotFrom,\n type StateMachine,\n type StateSchema,\n} from \"xstate\";\n\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { noopLoggerFactory } from \"@api/logger-publisher/utils/noopLoggerFactory\";\n\nimport { type StateMachineTypes } from \"./StateMachineTypes\";\n\nexport type DeviceActionStateMachine<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> = StateMachine<\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"context\"], // context\n /**\n * The following usages `any` are OK because this is just a wrapper around the\n * state machine and we are not directly going to use these types.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any, // event\n any, // children\n any, // actor\n any, // action\n any, // guard\n any, // delay\n any, // state value\n any, // tag\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"input\"],\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"output\"],\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any,\n any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateSchema\n>;\n\n/**\n * A DeviceAction that uses an XState state machine to execute.\n * It maps the state machine snapshots to the DeviceActionState.\n * This class is abstract and should be extended to implement the state machine.\n */\nexport abstract class XStateDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> implements DeviceAction<Output, Input, Error, IntermediateValue>\n{\n readonly input: Input;\n readonly inspect: boolean = false;\n protected logger?: LoggerPublisherService;\n protected loggerFactory?: (tag: string) => LoggerPublisherService;\n\n /**\n *\n * @param input The input for the DeviceAction\n * @param inspect If true, the state machine will be inspected in the browser\n * @param logger Optional logger for debugging. If provided, input and internal state will be logged on state transitions.\n * @param loggerFactory Optional logger factory for creating loggers with prefixed tags. Takes precedence over logger.\n */\n constructor(args: {\n input: Input;\n inspect?: boolean;\n logger?: LoggerPublisherService;\n loggerFactory?: (tag: string) => LoggerPublisherService;\n }) {\n this.input = args.input;\n this.inspect = Boolean(args.inspect);\n this.logger = args.logger;\n this.loggerFactory = args.loggerFactory;\n }\n\n /**\n * Returns the logger factory to use for creating loggers.\n * Prefers the instance loggerFactory, then internalApi.loggerFactory,\n * and falls back to a no-op logger factory if neither is available.\n */\n protected getLoggerFactory(\n internalApi: InternalApi,\n ): (tag: string) => LoggerPublisherService {\n return this.loggerFactory ?? internalApi.loggerFactory ?? noopLoggerFactory;\n }\n\n protected abstract makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >;\n\n _execute(\n internalApi: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const stateMachine = this.makeStateMachine(internalApi);\n\n // Create logger from machine ID if not explicitly provided\n // Prefer loggerFactory (prefixed) over internalApi.loggerFactory (unprefixed)\n if (!this.logger && stateMachine.id) {\n this.logger = this.getLoggerFactory(internalApi)(stateMachine.id);\n }\n\n return this._subscribeToStateMachine(stateMachine);\n }\n\n protected _subscribeToStateMachine(\n stateMachine: DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n // inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n let hasLoggedInput = false;\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n\n // Log input once at the beginning\n if (this.logger && !hasLoggedInput) {\n hasLoggedInput = true;\n this.logger.debug(\"[XStateDeviceAction] Input\", {\n data: { input: context.input },\n });\n }\n\n // Log internal state on each state transition\n if (this.logger && status === \"active\") {\n const stateValue =\n typeof snapshot.value === \"string\"\n ? snapshot.value\n : JSON.stringify(snapshot.value);\n this.logger.debug(`[XStateDeviceAction] State: ${stateValue}`, {\n data: { internalState: context._internalState },\n });\n }\n\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n private _exhaustiveMatchingGuard(status: never): never {\n console.log(\"_exhaustiveMatchingGuard status\", status);\n throw new Error(`Unhandled status: ${status}`);\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAiD,gBACjDC,EAKO,kBAQPC,EAGO,sDAGPC,EAAkC,yDA0D3B,MAAeL,CAOtB,CACW,MACA,QAAmB,GAClB,OACA,cASV,YAAYM,EAKT,CACD,KAAK,MAAQA,EAAK,MAClB,KAAK,QAAU,EAAQA,EAAK,QAC5B,KAAK,OAASA,EAAK,OACnB,KAAK,cAAgBA,EAAK,aAC5B,CAOU,iBACRC,EACyC,CACzC,OAAO,KAAK,eAAiBA,EAAY,eAAiB,mBAC5D,CAYA,SACEA,EACiE,CACjE,MAAMC,EAAe,KAAK,iBAAiBD,CAAW,EAItD,MAAI,CAAC,KAAK,QAAUC,EAAa,KAC/B,KAAK,OAAS,KAAK,iBAAiBD,CAAW,EAAEC,EAAa,EAAE,GAG3D,KAAK,yBAAyBA,CAAY,CACnD,CAEU,yBACRA,EAOiE,CACjE,MAAMC,KAAQ,eAAYD,EAAc,CACtC,MAAO,KAAK,KAGd,CAAC,EAQKE,EAAU,IAAI,gBAIpB,IAAIC,EAAiB,GAErB,MAAMC,EACJC,GACG,CACH,KAAM,CAAE,QAAAC,EAAS,OAAAC,EAAQ,OAAAC,EAAQ,MAAAC,CAAM,EAAIJ,EAW3C,GARI,KAAK,QAAU,CAACF,IAClBA,EAAiB,GACjB,KAAK,OAAO,MAAM,6BAA8B,CAC9C,KAAM,CAAE,MAAOG,EAAQ,KAAM,CAC/B,CAAC,GAIC,KAAK,QAAUC,IAAW,SAAU,CACtC,MAAMG,EACJ,OAAOL,EAAS,OAAU,SACtBA,EAAS,MACT,KAAK,UAAUA,EAAS,KAAK,EACnC,KAAK,OAAO,MAAM,+BAA+BK,CAAU,GAAI,CAC7D,KAAM,CAAE,cAAeJ,EAAQ,cAAe,CAChD,CAAC,CACH,CAEA,OAAQC,EAAQ,CACd,IAAK,SACHL,EAAQ,KAAK,CACX,OAAQ,qBAAmB,QAC3B,kBAAmBI,EAAQ,iBAC7B,CAAC,EACD,MACF,IAAK,OACHE,EAAO,OAAO,CACZ,KAAOG,GAAQ,CACbT,EAAQ,KAAK,CACX,OAAQ,qBAAmB,MAC3B,MAAOS,CACT,CAAC,CACH,EACA,MAAQC,GAAW,CACjBV,EAAQ,KAAK,CACX,OAAQ,qBAAmB,UAC3B,OAAQU,CACV,CAAC,CACH,CACF,CAAC,EACDV,EAAQ,SAAS,EACjB,MACF,IAAK,QAEHA,EAAQ,MAAMO,CAAK,EACnBP,EAAQ,SAAS,EACjB,MACF,IAAK,UACHA,EAAQ,KAAK,CACX,OAAQ,qBAAmB,OAC7B,CAAC,EACDA,EAAQ,SAAS,EACjB,MACF,QACE,KAAK,yBAAyBK,CAAM,CACxC,CACF,EAEMM,EAAa,IAAI,aAEpBC,GAAe,CAChB,MAAMC,EAAsBb,EAAQ,UAAUY,CAAU,EACxD,MAAO,IAAM,CACXE,EAAkB,YAAY,EAC9BD,EAAoB,YAAY,EAChCd,EAAM,KAAK,CACb,CACF,CAAC,EAEKe,EAAoBf,EAAM,UAAUG,CAAmB,EAC7D,OAAAH,EAAM,MAAM,EAEL,CACL,WAAYY,EAAW,QAAK,SAAM,CAAC,EACnC,OAAQ,IAAM,CACZZ,EAAM,KAAK,EACXe,EAAkB,YAAY,EAC9BZ,EAAoBH,EAAM,YAAY,CAAC,CACzC,CACF,CACF,CAEQ,yBAAyBM,EAAsB,CACrD,cAAQ,IAAI,kCAAmCA,CAAM,EAC/C,IAAI,MAAM,qBAAqBA,CAAM,EAAE,CAC/C,CACF",
6
+ "names": ["XStateDeviceAction_exports", "__export", "XStateDeviceAction", "__toCommonJS", "import_rxjs", "import_xstate", "import_DeviceActionState", "import_noopLoggerFactory", "args", "internalApi", "stateMachine", "actor", "subject", "hasLoggedInput", "handleActorSnapshot", "snapshot", "context", "status", "output", "error", "stateValue", "err", "result", "observable", "subscriber", "subjectSubscription", "actorSubscription"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var le=Object.prototype.hasOwnProperty;var ue=(p,o)=>{for(var i in o)u(p,i,{get:o[i],enumerable:!0})},l=(p,o,i,v)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of De(o))!le.call(p,s)&&s!==i&&u(p,s,{get:()=>o[s],enumerable:!(v=Ae(o,s))||v.enumerable});return p},r=(p,o,i)=>(l(p,o,"default"),i&&l(i,o,"default"));var ve=p=>l(u({},"__esModule",{value:!0}),p);var e={};ue(e,{APDU_MAX_PAYLOAD:()=>f.APDU_MAX_PAYLOAD,Apdu:()=>S.Apdu,ApduBuilder:()=>f.ApduBuilder,ApduParser:()=>y.ApduParser,ApduResponse:()=>j.ApduResponse,AppAlreadyInstalledDAError:()=>t.AppAlreadyInstalledDAError,BatteryStatusType:()=>x.BatteryStatusType,BleDeviceInfos:()=>N.BleDeviceInfos,ByteArrayBuilder:()=>C.ByteArrayBuilder,ByteArrayParser:()=>g.ByteArrayParser,CallTaskInAppDeviceAction:()=>U.CallTaskInAppDeviceAction,CloseAppCommand:()=>L.CloseAppCommand,CommandResultFactory:()=>m.CommandResultFactory,CommandResultStatus:()=>m.CommandResultStatus,CommandUtils:()=>O.CommandUtils,ConnectedDevice:()=>fe.ConnectedDevice,ConsoleLogger:()=>ne.ConsoleLogger,DefaultLogTagFormatter:()=>ae.DefaultLogTagFormatter,DeviceActionStatus:()=>b.DeviceActionStatus,DeviceConnectionStateMachine:()=>ce.DeviceConnectionStateMachine,DeviceLockedError:()=>t.DeviceLockedError,DeviceManagementKit:()=>pe.DeviceManagementKit,DeviceManagementKitBuilder:()=>ie.DeviceManagementKitBuilder,DeviceModel:()=>n.DeviceModel,DeviceModelId:()=>n.DeviceModelId,DeviceSessionStateType:()=>z.DeviceSessionStateType,DeviceStatus:()=>T.DeviceStatus,FramerUtils:()=>te.FramerUtils,GenuineCheckDeviceAction:()=>J.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>E.GetAppAndVersionCommand,GetBatteryStatusCommand:()=>x.GetBatteryStatusCommand,GetDeviceMetadataDeviceAction:()=>F.GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction:()=>P.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>B.GetOsVersionCommand,GlobalCommandError:()=>d.GlobalCommandError,GlobalCommandErrorHandler:()=>d.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>V.GoToDashboardDeviceAction,InstallAppDeviceAction:()=>Q.InstallAppDeviceAction,InstallOrUpdateAppsDeviceAction:()=>k.InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError:()=>c.InvalidGetFirmwareMetadataResponseError,InvalidStatusWordError:()=>c.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>n.LEDGER_VENDOR_ID,ListAppsCommand:()=>G.ListAppsCommand,ListAppsDeviceAction:()=>W.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>_.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>Z.ListInstalledAppsDeviceAction,LoadCertificateCommand:()=>R.LoadCertificateCommand,LogLevel:()=>me.LogLevel,OpenAppCommand:()=>M.OpenAppCommand,OpenAppDeviceAction:()=>w.OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction:()=>H.OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError:()=>t.OutOfMemoryDAError,RefusedByUserDAError:()=>t.RefusedByUserDAError,SecureChannelError:()=>ee.SecureChannelError,SendCommandInAppDeviceAction:()=>K.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>q.StaticDeviceModelDataSource,TransportConnectedDevice:()=>xe.TransportConnectedDevice,TransportDeviceModel:()=>Y.TransportDeviceModel,UninstallAppDeviceAction:()=>$.UninstallAppDeviceAction,UnknownDAError:()=>t.UnknownDAError,UnsupportedFirmwareDAError:()=>t.UnsupportedFirmwareDAError,UserInteractionRequired:()=>h.UserInteractionRequired,WebLogsExporterLogger:()=>se.WebLogsExporterLogger,XStateDeviceAction:()=>X.XStateDeviceAction,base64StringToBuffer:()=>D.base64StringToBuffer,bufferToHexaString:()=>a.bufferToHexaString,connectedDeviceStubBuilder:()=>de.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>re.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>oe.defaultApduSenderServiceStubBuilder,formatApduReceivedLog:()=>A.formatApduReceivedLog,formatApduSentLog:()=>A.formatApduSentLog,hexaStringToBuffer:()=>a.hexaStringToBuffer,isBase64String:()=>D.isBase64String,isCommandErrorCode:()=>I.isCommandErrorCode,isHexaString:()=>a.isHexaString,isSuccessCommandResult:()=>m.isSuccessCommandResult});module.exports=ve(e);var S=require("./apdu/model/Apdu"),f=require("./apdu/utils/ApduBuilder"),y=require("./apdu/utils/ApduParser");r(e,require("./apdu/utils/AppBuilderError"),module.exports);var C=require("./apdu/utils/ByteArrayBuilder"),g=require("./apdu/utils/ByteArrayParser"),c=require("./command/Errors"),m=require("./command/model/CommandResult"),L=require("./command/os/CloseAppCommand"),E=require("./command/os/GetAppAndVersionCommand"),x=require("./command/os/GetBatteryStatusCommand"),B=require("./command/os/GetOsVersionCommand"),G=require("./command/os/ListAppsCommand"),R=require("./command/os/LoadCertificateCommand"),M=require("./command/os/OpenAppCommand"),I=require("./command/utils/CommandErrors"),O=require("./command/utils/CommandUtils"),d=require("./command/utils/GlobalCommandError"),n=require("./device/DeviceModel"),T=require("./device/DeviceStatus"),b=require("./device-action/model/DeviceActionState"),h=require("./device-action/model/UserInteractionRequired"),U=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),t=require("./device-action/os/Errors"),F=require("./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction"),P=require("./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),V=require("./device-action/os/GoToDashboard/GoToDashboardDeviceAction"),k=require("./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction"),W=require("./device-action/os/ListApps/ListAppsDeviceAction"),_=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),w=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),H=require("./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction"),K=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),X=require("./device-action/xstate-utils/XStateDeviceAction"),q=require("./device-model/data/StaticDeviceModelDataSource"),N=require("./device-model/model/BleDeviceInfos"),Y=require("./device-model/model/DeviceModel"),j=require("./device-session/ApduResponse");r(e,require("./device-session/data/FramerConst"),module.exports);var z=require("./device-session/DeviceSessionState"),J=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),Q=require("./secure-channel/device-action/InstallApp/InstallAppDeviceAction"),Z=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),$=require("./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction"),ee=require("../internal/secure-channel/model/Errors"),re=require("./device-session/service/DefaultApduReceiverService.stub"),oe=require("./device-session/service/DefaultApduSenderService.stub"),te=require("./device-session/utils/FramerUtils"),pe=require("./DeviceManagementKit"),ie=require("./DeviceManagementKitBuilder");r(e,require("./Error"),module.exports);var me=require("./logger-subscriber/model/LogLevel"),ne=require("./logger-subscriber/service/ConsoleLogger"),ae=require("./logger-subscriber/service/DefaultLogTagFormatter"),se=require("./logger-subscriber/service/WebLogsExporterLogger"),fe=require("./transport/model/ConnectedDevice"),ce=require("./transport/model/DeviceConnectionStateMachine");r(e,require("./transport/model/Errors"),module.exports);var xe=require("./transport/model/TransportConnectedDevice"),de=require("./transport/model/TransportConnectedDevice.stub");r(e,require("./types"),module.exports);var A=require("./utils/apduLogs"),D=require("./utils/Base64String"),a=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,AppAlreadyInstalledDAError,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectedDevice,ConsoleLogger,DefaultLogTagFormatter,DeviceActionStatus,DeviceConnectionStateMachine,DeviceLockedError,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceSessionStateType,DeviceStatus,FramerUtils,GenuineCheckDeviceAction,GetAppAndVersionCommand,GetBatteryStatusCommand,GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction,GetOsVersionCommand,GlobalCommandError,GlobalCommandErrorHandler,GoToDashboardDeviceAction,InstallAppDeviceAction,InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError,InvalidStatusWordError,LEDGER_VENDOR_ID,ListAppsCommand,ListAppsDeviceAction,ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction,LoadCertificateCommand,LogLevel,OpenAppCommand,OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError,RefusedByUserDAError,SecureChannelError,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UninstallAppDeviceAction,UnknownDAError,UnsupportedFirmwareDAError,UserInteractionRequired,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,formatApduReceivedLog,formatApduSentLog,hexaStringToBuffer,isBase64String,isCommandErrorCode,isHexaString,isSuccessCommandResult,...require("./apdu/utils/AppBuilderError"),...require("./device-session/data/FramerConst"),...require("./Error"),...require("./transport/model/Errors"),...require("./types")});
1
+ "use strict";var S=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Se=Object.getOwnPropertyNames;var ye=Object.prototype.hasOwnProperty;var ge=(p,t)=>{for(var a in t)S(p,a,{get:t[a],enumerable:!0})},v=(p,t,a,y)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Se(t))!ye.call(p,d)&&d!==a&&S(p,d,{get:()=>t[d],enumerable:!(y=ve(t,d))||y.enumerable});return p},o=(p,t,a)=>(v(p,t,"default"),a&&v(a,t,"default"));var Ce=p=>v(S({},"__esModule",{value:!0}),p);var e={};ge(e,{APDU_MAX_PAYLOAD:()=>x.APDU_MAX_PAYLOAD,Apdu:()=>g.Apdu,ApduBuilder:()=>x.ApduBuilder,ApduParser:()=>C.ApduParser,ApduResponse:()=>Q.ApduResponse,AppAlreadyInstalledDAError:()=>r.AppAlreadyInstalledDAError,ApplicationChecker:()=>le.ApplicationChecker,BatteryStatusType:()=>D.BatteryStatusType,BleDeviceInfos:()=>j.BleDeviceInfos,ByteArrayBuilder:()=>G.ByteArrayBuilder,ByteArrayParser:()=>L.ByteArrayParser,CallTaskInAppDeviceAction:()=>F.CallTaskInAppDeviceAction,CloseAppCommand:()=>E.CloseAppCommand,CommandResultFactory:()=>n.CommandResultFactory,CommandResultStatus:()=>n.CommandResultStatus,CommandUtils:()=>O.CommandUtils,ConnectedDevice:()=>xe.ConnectedDevice,ConsoleLogger:()=>ce.ConsoleLogger,DEFAULT_UNLOCK_TIMEOUT_MS:()=>_.DEFAULT_UNLOCK_TIMEOUT_MS,DefaultLogTagFormatter:()=>fe.DefaultLogTagFormatter,DeviceActionStatus:()=>U.DeviceActionStatus,DeviceConnectionStateMachine:()=>Ae.DeviceConnectionStateMachine,DeviceLockedError:()=>r.DeviceLockedError,DeviceManagementKit:()=>ne.DeviceManagementKit,DeviceManagementKitBuilder:()=>me.DeviceManagementKitBuilder,DeviceModel:()=>s.DeviceModel,DeviceModelId:()=>s.DeviceModelId,DeviceNotOnboardedError:()=>r.DeviceNotOnboardedError,DeviceSessionStateType:()=>Z.DeviceSessionStateType,DeviceStatus:()=>M.DeviceStatus,FramerUtils:()=>ie.FramerUtils,GLOBAL_ERRORS:()=>m.GLOBAL_ERRORS,GenuineCheckDeviceAction:()=>$.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>B.GetAppAndVersionCommand,GetBackgroundImageSizeCommand:()=>A.GetBackgroundImageSizeCommand,GetBackgroundImageSizeCommandError:()=>A.GetBackgroundImageSizeCommandError,GetBatteryStatusCommand:()=>D.GetBatteryStatusCommand,GetDeviceMetadataDeviceAction:()=>V.GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction:()=>z.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>R.GetOsVersionCommand,GlobalCommandError:()=>m.GlobalCommandError,GlobalCommandErrorHandler:()=>m.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>P.GoToDashboardDeviceAction,InstallAppDeviceAction:()=>ee.InstallAppDeviceAction,InstallOrUpdateAppsDeviceAction:()=>W.InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError:()=>i.InvalidGetFirmwareMetadataResponseError,InvalidResponseFormatError:()=>i.InvalidResponseFormatError,InvalidStatusWordError:()=>i.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>s.LEDGER_VENDOR_ID,ListAppsCommand:()=>I.ListAppsCommand,ListAppsDeviceAction:()=>w.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>H.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>oe.ListInstalledAppsDeviceAction,LoadCertificateCommand:()=>T.LoadCertificateCommand,LogLevel:()=>se.LogLevel,OpenAppCommand:()=>b.OpenAppCommand,OpenAppDeviceAction:()=>K.OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction:()=>N.OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError:()=>r.OutOfMemoryDAError,RefusedByUserDAError:()=>r.RefusedByUserDAError,SecureChannelError:()=>te.SecureChannelError,SendCommandInAppDeviceAction:()=>q.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>Y.StaticDeviceModelDataSource,TransportConnectedDevice:()=>De.TransportConnectedDevice,TransportDeviceModel:()=>J.TransportDeviceModel,UninstallAppDeviceAction:()=>re.UninstallAppDeviceAction,UnknownDAError:()=>r.UnknownDAError,UnsupportedFirmwareDAError:()=>r.UnsupportedFirmwareDAError,UserInteractionRequired:()=>k.UserInteractionRequired,WebLogsExporterLogger:()=>de.WebLogsExporterLogger,XStateDeviceAction:()=>X.XStateDeviceAction,base64StringToBuffer:()=>c.base64StringToBuffer,bufferToBase64String:()=>c.bufferToBase64String,bufferToHexaString:()=>f.bufferToHexaString,connectedDeviceStubBuilder:()=>ue.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>pe.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>ae.defaultApduSenderServiceStubBuilder,formatApduReceivedLog:()=>l.formatApduReceivedLog,formatApduSentLog:()=>l.formatApduSentLog,hexaStringToBuffer:()=>f.hexaStringToBuffer,isBase64String:()=>c.isBase64String,isCommandErrorCode:()=>h.isCommandErrorCode,isHexaString:()=>f.isHexaString,isSuccessCommandResult:()=>n.isSuccessCommandResult,noopLogger:()=>u.noopLogger,noopLoggerFactory:()=>u.noopLoggerFactory});module.exports=Ce(e);var g=require("./apdu/model/Apdu"),x=require("./apdu/utils/ApduBuilder"),C=require("./apdu/utils/ApduParser");o(e,require("./apdu/utils/AppBuilderError"),module.exports);var G=require("./apdu/utils/ByteArrayBuilder"),L=require("./apdu/utils/ByteArrayParser"),i=require("./command/Errors"),n=require("./command/model/CommandResult"),E=require("./command/os/CloseAppCommand"),B=require("./command/os/GetAppAndVersionCommand"),A=require("./command/os/GetBackgroundImageSizeCommand"),D=require("./command/os/GetBatteryStatusCommand"),R=require("./command/os/GetOsVersionCommand"),I=require("./command/os/ListAppsCommand"),T=require("./command/os/LoadCertificateCommand"),b=require("./command/os/OpenAppCommand"),h=require("./command/utils/CommandErrors"),O=require("./command/utils/CommandUtils"),m=require("./command/utils/GlobalCommandError"),s=require("./device/DeviceModel"),M=require("./device/DeviceStatus"),U=require("./device-action/model/DeviceActionState"),k=require("./device-action/model/UserInteractionRequired"),F=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),_=require("./device-action/os/Const"),r=require("./device-action/os/Errors"),V=require("./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction"),z=require("./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),P=require("./device-action/os/GoToDashboard/GoToDashboardDeviceAction"),W=require("./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction"),w=require("./device-action/os/ListApps/ListAppsDeviceAction"),H=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),K=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),N=require("./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction"),q=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),X=require("./device-action/xstate-utils/XStateDeviceAction"),Y=require("./device-model/data/StaticDeviceModelDataSource"),j=require("./device-model/model/BleDeviceInfos"),J=require("./device-model/model/DeviceModel"),Q=require("./device-session/ApduResponse");o(e,require("./device-session/data/FramerConst"),module.exports);var Z=require("./device-session/DeviceSessionState"),$=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),ee=require("./secure-channel/device-action/InstallApp/InstallAppDeviceAction"),oe=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),re=require("./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction"),te=require("../internal/secure-channel/model/Errors"),pe=require("./device-session/service/DefaultApduReceiverService.stub"),ae=require("./device-session/service/DefaultApduSenderService.stub"),ie=require("./device-session/utils/FramerUtils"),ne=require("./DeviceManagementKit"),me=require("./DeviceManagementKitBuilder");o(e,require("./Error"),module.exports);var u=require("./logger-publisher/utils/noopLoggerFactory"),se=require("./logger-subscriber/model/LogLevel"),ce=require("./logger-subscriber/service/ConsoleLogger"),fe=require("./logger-subscriber/service/DefaultLogTagFormatter"),de=require("./logger-subscriber/service/WebLogsExporterLogger"),xe=require("./transport/model/ConnectedDevice"),Ae=require("./transport/model/DeviceConnectionStateMachine");o(e,require("./transport/model/Errors"),module.exports);var De=require("./transport/model/TransportConnectedDevice"),ue=require("./transport/model/TransportConnectedDevice.stub");o(e,require("./types"),module.exports);var l=require("./utils/apduLogs"),le=require("./utils/ApplicationChecker"),c=require("./utils/Base64String"),f=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,AppAlreadyInstalledDAError,ApplicationChecker,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectedDevice,ConsoleLogger,DEFAULT_UNLOCK_TIMEOUT_MS,DefaultLogTagFormatter,DeviceActionStatus,DeviceConnectionStateMachine,DeviceLockedError,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceNotOnboardedError,DeviceSessionStateType,DeviceStatus,FramerUtils,GLOBAL_ERRORS,GenuineCheckDeviceAction,GetAppAndVersionCommand,GetBackgroundImageSizeCommand,GetBackgroundImageSizeCommandError,GetBatteryStatusCommand,GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction,GetOsVersionCommand,GlobalCommandError,GlobalCommandErrorHandler,GoToDashboardDeviceAction,InstallAppDeviceAction,InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError,InvalidResponseFormatError,InvalidStatusWordError,LEDGER_VENDOR_ID,ListAppsCommand,ListAppsDeviceAction,ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction,LoadCertificateCommand,LogLevel,OpenAppCommand,OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError,RefusedByUserDAError,SecureChannelError,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UninstallAppDeviceAction,UnknownDAError,UnsupportedFirmwareDAError,UserInteractionRequired,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToBase64String,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,formatApduReceivedLog,formatApduSentLog,hexaStringToBuffer,isBase64String,isCommandErrorCode,isHexaString,isSuccessCommandResult,noopLogger,noopLoggerFactory,...require("./apdu/utils/AppBuilderError"),...require("./device-session/data/FramerConst"),...require("./Error"),...require("./transport/model/Errors"),...require("./types")});
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/index.ts"],
4
- "sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport {\n InvalidGetFirmwareMetadataResponseError,\n InvalidStatusWordError,\n} from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport {\n AppAlreadyInstalledDAError,\n DeviceLockedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { InstallAppDeviceAction } from \"@api/secure-channel/device-action/InstallApp/InstallAppDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nexport { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\nexport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { DefaultLogTagFormatter } from \"@api/logger-subscriber/service/DefaultLogTagFormatter\";\nexport { type LogTagFormatter } from \"@api/logger-subscriber/service/LogTagFormatter\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\n DeviceConnectionStateMachine,\n type DeviceConnectionStateMachineParams,\n} from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { formatApduReceivedLog, formatApduSentLog } from \"@api/utils/apduLogs\";\nexport { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
5
- "mappings": "meAAA,IAAAA,EAAA,GAAAC,GAAAD,EAAA,8nHAAAE,GAAAF,GAEA,IAAAG,EAAqB,gCACrBC,EAA8C,uCAC9CC,EAA2B,sCAC3BC,EAAAN,EAAc,2CALd,gBAMA,IAAAO,EAAiC,4CACjCC,EAAgC,2CAChCC,EAGO,+BACPC,EAIO,4CACPC,EAAgC,2CAChCC,EAGO,mDACPC,EAKO,mDACPC,EAGO,+CACPC,EAKO,2CACPC,EAIO,kDACPC,EAGO,0CACPC,EAAmC,4CACnCC,EAA6B,2CAC7BC,EAGO,iDACPC,EAIO,mCACPC,EAA6B,oCAE7BC,EAGO,sDACPC,EAAwC,4DACxCC,EAA0C,qFAC1ChB,EAOO,wCACPiB,EAA8C,iFAC9CC,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAgD,qFAChDC,EAAqC,+DACrCC,EAAiD,uFACjDC,EAAoC,yEACpCC,EAAoD,6FACpDC,EAA6C,2FAC7CC,EAGO,8DACPC,EAA4C,8DAC5CC,EAA+B,kDAC/BhB,EAAqC,+CACrCiB,EAA6B,4CAC7BhC,EAAAN,EAAc,gDA3Fd,gBA4FA,IAAAuC,EAGO,kDACPC,EAAyC,mFACzCC,EAAuC,+EACvCC,EAA8C,6FAC9CC,EAAyC,mFACzClC,GAAmC,iDAEnCmC,GAAsD,uEACtDC,GAAoD,qEACpDC,GAA4B,iDAC5BC,GAAoC,oCACpCC,GAA2C,2CAC3C1C,EAAAN,EAAc,sBA3Gd,gBA4GA,IAAAiD,GAAyB,iDACzBC,GAA8B,wDAC9BC,GAAuC,iEAEvCC,GAAsC,gEACtCC,GAAgC,gDAChCC,GAGO,6DACPhD,EAAAN,EAAc,uCAtHd,gBAuHA,IAAAuD,GAAyC,yDACzCA,GAA2C,8DAC3CjD,EAAAN,EAAc,sBAzHd,gBA0HA,IAAAwD,EAAyD,+BACzDC,EAAqD,mCACrDC,EAIO",
6
- "names": ["api_exports", "__export", "__toCommonJS", "import_Apdu", "import_ApduBuilder", "import_ApduParser", "__reExport", "import_ByteArrayBuilder", "import_ByteArrayParser", "import_Errors", "import_CommandResult", "import_CloseAppCommand", "import_GetAppAndVersionCommand", "import_GetBatteryStatusCommand", "import_GetOsVersionCommand", "import_ListAppsCommand", "import_LoadCertificateCommand", "import_OpenAppCommand", "import_CommandErrors", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_DeviceStatus", "import_DeviceActionState", "import_UserInteractionRequired", "import_CallTaskInAppDeviceAction", "import_GetDeviceMetadataDeviceAction", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_InstallOrUpdateAppsDeviceAction", "import_ListAppsDeviceAction", "import_ListAppsWithMetadataDeviceAction", "import_OpenAppDeviceAction", "import_OpenAppWithDependenciesDeviceAction", "import_SendCommandInAppDeviceAction", "import_XStateDeviceAction", "import_StaticDeviceModelDataSource", "import_BleDeviceInfos", "import_ApduResponse", "import_DeviceSessionState", "import_GenuineCheckDeviceAction", "import_InstallAppDeviceAction", "import_ListInstalledAppsDeviceAction", "import_UninstallAppDeviceAction", "import_DefaultApduReceiverService", "import_DefaultApduSenderService", "import_FramerUtils", "import_DeviceManagementKit", "import_DeviceManagementKitBuilder", "import_LogLevel", "import_ConsoleLogger", "import_DefaultLogTagFormatter", "import_WebLogsExporterLogger", "import_ConnectedDevice", "import_DeviceConnectionStateMachine", "import_TransportConnectedDevice", "import_apduLogs", "import_Base64String", "import_HexaString"]
4
+ "sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport { type Command } from \"@api/command/Command\";\nexport {\n InvalidGetFirmwareMetadataResponseError,\n InvalidResponseFormatError,\n InvalidStatusWordError,\n} from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n GetBackgroundImageSizeCommand,\n GetBackgroundImageSizeCommandError,\n type GetBackgroundImageSizeCommandResult,\n type GetBackgroundImageSizeErrorCodes,\n type GetBackgroundImageSizeResponse,\n} from \"@api/command/os/GetBackgroundImageSizeCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GLOBAL_ERRORS,\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nexport {\n AppAlreadyInstalledDAError,\n DeviceLockedError,\n DeviceNotOnboardedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport type {\n GoToDashboardDAError,\n GoToDashboardDAInput,\n GoToDashboardDAIntermediateValue,\n GoToDashboardDAOutput,\n GoToDashboardDARequiredInteraction,\n GoToDashboardDAState,\n} from \"@api/device-action/os/GoToDashboard/types\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { InstallAppDeviceAction } from \"@api/secure-channel/device-action/InstallApp/InstallAppDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nexport { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\nexport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport {\n noopLogger,\n noopLoggerFactory,\n} from \"@api/logger-publisher/utils/noopLoggerFactory\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { DefaultLogTagFormatter } from \"@api/logger-subscriber/service/DefaultLogTagFormatter\";\nexport { type LogTagFormatter } from \"@api/logger-subscriber/service/LogTagFormatter\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\n DeviceConnectionStateMachine,\n type DeviceConnectionStateMachineParams,\n} from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { formatApduReceivedLog, formatApduSentLog } from \"@api/utils/apduLogs\";\nexport { ApplicationChecker } from \"@api/utils/ApplicationChecker\";\nexport {\n type AppConfig,\n type ApplicationResolver,\n type ResolvedApp,\n} from \"@api/utils/ApplicationResolver\";\nexport {\n base64StringToBuffer,\n bufferToBase64String,\n isBase64String,\n} from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
5
+ "mappings": "meAAA,IAAAA,EAAA,GAAAC,GAAAD,EAAA,goIAAAE,GAAAF,GAEA,IAAAG,EAAqB,gCACrBC,EAA8C,uCAC9CC,EAA2B,sCAC3BC,EAAAN,EAAc,2CALd,gBAMA,IAAAO,EAAiC,4CACjCC,EAAgC,2CAEhCC,EAIO,+BACPC,EAIO,4CACPC,EAAgC,2CAChCC,EAGO,mDACPC,EAMO,yDACPC,EAKO,mDACPC,EAGO,+CACPC,EAKO,2CACPC,EAIO,kDACPC,EAGO,0CACPC,EAAmC,4CACnCC,EAA6B,2CAC7BC,EAIO,iDACPC,EAIO,mCACPC,EAA6B,oCAE7BC,EAGO,sDACPC,EAAwC,4DACxCC,EAA0C,qFAC1CC,EAA0C,uCAC1ClB,EAQO,wCACPmB,EAA8C,iFAC9CC,EAA4C,6EAC5CC,EAA0C,yEAS1CC,EAAgD,qFAChDC,EAAqC,+DACrCC,EAAiD,uFACjDC,EAAoC,yEACpCC,EAAoD,6FACpDC,EAA6C,2FAC7CC,EAGO,8DACPC,EAA4C,8DAC5CC,EAA+B,kDAC/BjB,EAAqC,+CACrCkB,EAA6B,4CAC7BlC,EAAAN,EAAc,gDA/Gd,gBAgHA,IAAAyC,EAGO,kDACPC,EAAyC,mFACzCC,GAAuC,+EACvCC,GAA8C,6FAC9CC,GAAyC,mFACzCpC,GAAmC,iDAEnCqC,GAAsD,uEACtDC,GAAoD,qEACpDC,GAA4B,iDAC5BC,GAAoC,oCACpCC,GAA2C,2CAC3C5C,EAAAN,EAAc,sBA/Hd,gBAgIA,IAAAmD,EAGO,yDACPC,GAAyB,iDACzBC,GAA8B,wDAC9BC,GAAuC,iEAEvCC,GAAsC,gEACtCC,GAAgC,gDAChCC,GAGO,6DACPnD,EAAAN,EAAc,uCA9Id,gBA+IA,IAAA0D,GAAyC,yDACzCA,GAA2C,8DAC3CpD,EAAAN,EAAc,sBAjJd,gBAkJA,IAAA2D,EAAyD,+BACzDC,GAAmC,yCAMnCC,EAIO,mCACPC,EAIO",
6
+ "names": ["api_exports", "__export", "__toCommonJS", "import_Apdu", "import_ApduBuilder", "import_ApduParser", "__reExport", "import_ByteArrayBuilder", "import_ByteArrayParser", "import_Errors", "import_CommandResult", "import_CloseAppCommand", "import_GetAppAndVersionCommand", "import_GetBackgroundImageSizeCommand", "import_GetBatteryStatusCommand", "import_GetOsVersionCommand", "import_ListAppsCommand", "import_LoadCertificateCommand", "import_OpenAppCommand", "import_CommandErrors", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_DeviceStatus", "import_DeviceActionState", "import_UserInteractionRequired", "import_CallTaskInAppDeviceAction", "import_Const", "import_GetDeviceMetadataDeviceAction", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_InstallOrUpdateAppsDeviceAction", "import_ListAppsDeviceAction", "import_ListAppsWithMetadataDeviceAction", "import_OpenAppDeviceAction", "import_OpenAppWithDependenciesDeviceAction", "import_SendCommandInAppDeviceAction", "import_XStateDeviceAction", "import_StaticDeviceModelDataSource", "import_BleDeviceInfos", "import_ApduResponse", "import_DeviceSessionState", "import_GenuineCheckDeviceAction", "import_InstallAppDeviceAction", "import_ListInstalledAppsDeviceAction", "import_UninstallAppDeviceAction", "import_DefaultApduReceiverService", "import_DefaultApduSenderService", "import_FramerUtils", "import_DeviceManagementKit", "import_DeviceManagementKitBuilder", "import_noopLoggerFactory", "import_LogLevel", "import_ConsoleLogger", "import_DefaultLogTagFormatter", "import_WebLogsExporterLogger", "import_ConnectedDevice", "import_DeviceConnectionStateMachine", "import_TransportConnectedDevice", "import_apduLogs", "import_ApplicationChecker", "import_Base64String", "import_HexaString"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var p=(e,r)=>{for(var g in r)i(e,g,{get:r[g],enumerable:!0})},u=(e,r,g,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of n(r))!b.call(e,o)&&o!==g&&i(e,o,{get:()=>r[o],enumerable:!(s=c(r,o))||s.enumerable});return e};var L=e=>u(i({},"__esModule",{value:!0}),e);var h={};p(h,{noopLogger:()=>t,noopLoggerFactory:()=>a});module.exports=L(h);const t={subscribers:[],error:()=>{},warn:()=>{},info:()=>{},debug:()=>{}},a=e=>t;0&&(module.exports={noopLogger,noopLoggerFactory});
2
+ //# sourceMappingURL=noopLoggerFactory.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/logger-publisher/utils/noopLoggerFactory.ts"],
4
+ "sourcesContent": ["import { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\n\n/**\n * A no-op logger that silently discards all log messages.\n * Useful as a default when no logger is configured.\n */\nexport const noopLogger: LoggerPublisherService = {\n subscribers: [],\n error: () => {},\n warn: () => {},\n info: () => {},\n debug: () => {},\n};\n\n/**\n * A logger factory that always returns a no-op logger, regardless of the tag.\n * Use this as a fallback when no logger factory is provided.\n */\nexport const noopLoggerFactory = (_tag: string): LoggerPublisherService =>\n noopLogger;\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,sBAAAC,IAAA,eAAAC,EAAAJ,GAMO,MAAME,EAAqC,CAChD,YAAa,CAAC,EACd,MAAO,IAAM,CAAC,EACd,KAAM,IAAM,CAAC,EACb,KAAM,IAAM,CAAC,EACb,MAAO,IAAM,CAAC,CAChB,EAMaC,EAAqBE,GAChCH",
6
+ "names": ["noopLoggerFactory_exports", "__export", "noopLogger", "noopLoggerFactory", "__toCommonJS", "_tag"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=require("vitest"),t=require("./noopLoggerFactory");(0,o.describe)("noopLogger",()=>{(0,o.it)("should have an empty subscribers array",()=>{(0,o.expect)(t.noopLogger.subscribers).toEqual([])}),(0,o.it)("should not throw when calling error",()=>{(0,o.expect)(()=>t.noopLogger.error("test")).not.toThrow()}),(0,o.it)("should not throw when calling warn",()=>{(0,o.expect)(()=>t.noopLogger.warn("test")).not.toThrow()}),(0,o.it)("should not throw when calling info",()=>{(0,o.expect)(()=>t.noopLogger.info("test")).not.toThrow()}),(0,o.it)("should not throw when calling debug",()=>{(0,o.expect)(()=>t.noopLogger.debug("test")).not.toThrow()}),(0,o.it)("should not throw when calling methods with options",()=>{const e={data:{key:"value"}};(0,o.expect)(()=>t.noopLogger.error("test",e)).not.toThrow(),(0,o.expect)(()=>t.noopLogger.warn("test",e)).not.toThrow(),(0,o.expect)(()=>t.noopLogger.info("test",e)).not.toThrow(),(0,o.expect)(()=>t.noopLogger.debug("test",e)).not.toThrow()})});(0,o.describe)("noopLoggerFactory",()=>{(0,o.it)("should return a LoggerPublisherService regardless of tag",()=>{const e=(0,t.noopLoggerFactory)("any-tag");(0,o.expect)(e).toBeDefined(),(0,o.expect)(e.subscribers).toEqual([]),(0,o.expect)(typeof e.error).toBe("function"),(0,o.expect)(typeof e.warn).toBe("function"),(0,o.expect)(typeof e.info).toBe("function"),(0,o.expect)(typeof e.debug).toBe("function")}),(0,o.it)("should always return the same noopLogger instance",()=>{const e=(0,t.noopLoggerFactory)("tag-a"),r=(0,t.noopLoggerFactory)("tag-b");(0,o.expect)(e).toBe(r),(0,o.expect)(e).toBe(t.noopLogger)})});
2
+ //# sourceMappingURL=noopLoggerFactory.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/logger-publisher/utils/noopLoggerFactory.test.ts"],
4
+ "sourcesContent": ["import { describe, expect, it } from \"vitest\";\n\nimport { noopLogger, noopLoggerFactory } from \"./noopLoggerFactory\";\n\ndescribe(\"noopLogger\", () => {\n it(\"should have an empty subscribers array\", () => {\n expect(noopLogger.subscribers).toEqual([]);\n });\n\n it(\"should not throw when calling error\", () => {\n expect(() => noopLogger.error(\"test\")).not.toThrow();\n });\n\n it(\"should not throw when calling warn\", () => {\n expect(() => noopLogger.warn(\"test\")).not.toThrow();\n });\n\n it(\"should not throw when calling info\", () => {\n expect(() => noopLogger.info(\"test\")).not.toThrow();\n });\n\n it(\"should not throw when calling debug\", () => {\n expect(() => noopLogger.debug(\"test\")).not.toThrow();\n });\n\n it(\"should not throw when calling methods with options\", () => {\n const options = { data: { key: \"value\" } };\n expect(() => noopLogger.error(\"test\", options)).not.toThrow();\n expect(() => noopLogger.warn(\"test\", options)).not.toThrow();\n expect(() => noopLogger.info(\"test\", options)).not.toThrow();\n expect(() => noopLogger.debug(\"test\", options)).not.toThrow();\n });\n});\n\ndescribe(\"noopLoggerFactory\", () => {\n it(\"should return a LoggerPublisherService regardless of tag\", () => {\n const logger = noopLoggerFactory(\"any-tag\");\n expect(logger).toBeDefined();\n expect(logger.subscribers).toEqual([]);\n expect(typeof logger.error).toBe(\"function\");\n expect(typeof logger.warn).toBe(\"function\");\n expect(typeof logger.info).toBe(\"function\");\n expect(typeof logger.debug).toBe(\"function\");\n });\n\n it(\"should always return the same noopLogger instance\", () => {\n const logger1 = noopLoggerFactory(\"tag-a\");\n const logger2 = noopLoggerFactory(\"tag-b\");\n expect(logger1).toBe(logger2);\n expect(logger1).toBe(noopLogger);\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAAqC,kBAErCC,EAA8C,kCAE9C,YAAS,aAAc,IAAM,IAC3B,MAAG,yCAA0C,IAAM,IACjD,UAAO,aAAW,WAAW,EAAE,QAAQ,CAAC,CAAC,CAC3C,CAAC,KAED,MAAG,sCAAuC,IAAM,IAC9C,UAAO,IAAM,aAAW,MAAM,MAAM,CAAC,EAAE,IAAI,QAAQ,CACrD,CAAC,KAED,MAAG,qCAAsC,IAAM,IAC7C,UAAO,IAAM,aAAW,KAAK,MAAM,CAAC,EAAE,IAAI,QAAQ,CACpD,CAAC,KAED,MAAG,qCAAsC,IAAM,IAC7C,UAAO,IAAM,aAAW,KAAK,MAAM,CAAC,EAAE,IAAI,QAAQ,CACpD,CAAC,KAED,MAAG,sCAAuC,IAAM,IAC9C,UAAO,IAAM,aAAW,MAAM,MAAM,CAAC,EAAE,IAAI,QAAQ,CACrD,CAAC,KAED,MAAG,qDAAsD,IAAM,CAC7D,MAAMC,EAAU,CAAE,KAAM,CAAE,IAAK,OAAQ,CAAE,KACzC,UAAO,IAAM,aAAW,MAAM,OAAQA,CAAO,CAAC,EAAE,IAAI,QAAQ,KAC5D,UAAO,IAAM,aAAW,KAAK,OAAQA,CAAO,CAAC,EAAE,IAAI,QAAQ,KAC3D,UAAO,IAAM,aAAW,KAAK,OAAQA,CAAO,CAAC,EAAE,IAAI,QAAQ,KAC3D,UAAO,IAAM,aAAW,MAAM,OAAQA,CAAO,CAAC,EAAE,IAAI,QAAQ,CAC9D,CAAC,CACH,CAAC,KAED,YAAS,oBAAqB,IAAM,IAClC,MAAG,2DAA4D,IAAM,CACnE,MAAMC,KAAS,qBAAkB,SAAS,KAC1C,UAAOA,CAAM,EAAE,YAAY,KAC3B,UAAOA,EAAO,WAAW,EAAE,QAAQ,CAAC,CAAC,KACrC,UAAO,OAAOA,EAAO,KAAK,EAAE,KAAK,UAAU,KAC3C,UAAO,OAAOA,EAAO,IAAI,EAAE,KAAK,UAAU,KAC1C,UAAO,OAAOA,EAAO,IAAI,EAAE,KAAK,UAAU,KAC1C,UAAO,OAAOA,EAAO,KAAK,EAAE,KAAK,UAAU,CAC7C,CAAC,KAED,MAAG,oDAAqD,IAAM,CAC5D,MAAMC,KAAU,qBAAkB,OAAO,EACnCC,KAAU,qBAAkB,OAAO,KACzC,UAAOD,CAAO,EAAE,KAAKC,CAAO,KAC5B,UAAOD,CAAO,EAAE,KAAK,YAAU,CACjC,CAAC,CACH,CAAC",
6
+ "names": ["import_vitest", "import_noopLoggerFactory", "options", "logger", "logger1", "logger2"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var i=require("../../device-model/model/DeviceModel.stub"),o=require("../../../internal/device-session/data/DeviceSessionRefresherConst"),s=require("../../../internal/device-session/model/DeviceSession"),c=require("./WebLogsExporterLogger");describe("getJSONStringifyReplacer",()=>{it("should return a function that replaces Uint8Array correctly",()=>{const e=(0,c.getJSONStringifyReplacer)(),t=new Uint8Array([1,2,3]),r=e("key",t);expect(r).toEqual({hex:"0x010203",readableHex:"01 02 03",value:"1,2,3"})}),it("should return a function that replaces DeviceSession",()=>{const e=(0,i.deviceModelStubBuilder)(),t=(0,c.getJSONStringifyReplacer)(),r={deviceModel:(0,i.deviceModelStubBuilder)(),type:"USB",id:"mockedDeviceId",sendApdu:vi.fn(),transport:"USB"},n=new s.DeviceSession({connectedDevice:r,id:"mockedSessionId"},vi.fn(),{},{},o.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS),a=JSON.stringify(n,t),l=`{"id":"mockedSessionId","connectedDevice":{"deviceModel":${JSON.stringify(e)},"type":"USB","id":"mockedDeviceId"}}`;n.close(),expect(a).toEqual(l)}),it("should return a function that replaces circular references",()=>{const e={name:"Alice"};e.self=e;const t='{"name":"Alice","self":"[Circular]"}',r=JSON.stringify(e,(0,c.getJSONStringifyReplacer)());expect(r).toEqual(t)})});
1
+ "use strict";var i=require("../../device-model/model/DeviceModel.stub"),o=require("../../../internal/device-session/data/DeviceSessionRefresherConst"),s=require("../../../internal/device-session/model/DeviceSession.stub"),c=require("./WebLogsExporterLogger");describe("getJSONStringifyReplacer",()=>{it("should return a function that replaces Uint8Array correctly",()=>{const e=(0,c.getJSONStringifyReplacer)(),t=new Uint8Array([1,2,3]),r=e("key",t);expect(r).toEqual({hex:"0x010203",readableHex:"01 02 03",value:"1,2,3"})}),it("should return a function that replaces DeviceSession",()=>{const e=(0,i.deviceModelStubBuilder)(),t=(0,c.getJSONStringifyReplacer)(),r={deviceModel:(0,i.deviceModelStubBuilder)(),type:"USB",id:"mockedDeviceId",sendApdu:vi.fn(),transport:"USB"},n=(0,s.deviceSessionStubBuilder)({connectedDevice:r,id:"mockedSessionId"},vi.fn(),{},{},o.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS),a=JSON.stringify(n,t),l=`{"id":"mockedSessionId","connectedDevice":{"deviceModel":${JSON.stringify(e)},"type":"USB","id":"mockedDeviceId"}}`;n.close(),expect(a).toEqual(l)}),it("should return a function that replaces circular references",()=>{const e={name:"Alice"};e.self=e;const t='{"name":"Alice","self":"[Circular]"}',r=JSON.stringify(e,(0,c.getJSONStringifyReplacer)());expect(r).toEqual(t)})});
2
2
  //# sourceMappingURL=WebLogsExporterLogger.test.js.map