@ledgerhq/device-management-kit 1.0.0 → 1.1.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 (255) hide show
  1. package/README.md +114 -0
  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/command/os/GetBackgroundImageSizeCommand.js +2 -0
  6. package/lib/cjs/src/api/command/os/GetBackgroundImageSizeCommand.js.map +7 -0
  7. package/lib/cjs/src/api/command/os/GetBackgroundImageSizeCommand.test.js +2 -0
  8. package/lib/cjs/src/api/command/os/GetBackgroundImageSizeCommand.test.js.map +7 -0
  9. package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
  10. package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
  11. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  12. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  13. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
  14. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  15. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
  16. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js.map +3 -3
  17. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  18. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
  19. package/lib/cjs/src/api/index.js +1 -1
  20. package/lib/cjs/src/api/index.js.map +3 -3
  21. package/lib/cjs/src/api/logger-publisher/utils/noopLoggerFactory.js +2 -0
  22. package/lib/cjs/src/api/logger-publisher/utils/noopLoggerFactory.js.map +7 -0
  23. package/lib/cjs/src/api/logger-publisher/utils/noopLoggerFactory.test.js +2 -0
  24. package/lib/cjs/src/api/logger-publisher/utils/noopLoggerFactory.test.js.map +7 -0
  25. package/lib/cjs/src/api/logger-subscriber/model/LogSubscriberOptions.js +1 -1
  26. package/lib/cjs/src/api/logger-subscriber/model/LogSubscriberOptions.js.map +1 -1
  27. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.js +1 -1
  28. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.js.map +2 -2
  29. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js +1 -1
  30. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +2 -2
  31. package/lib/cjs/src/api/logger-subscriber/service/DefaultLogTagFormatter.js +2 -0
  32. package/lib/cjs/src/api/logger-subscriber/service/DefaultLogTagFormatter.js.map +7 -0
  33. package/lib/cjs/src/api/logger-subscriber/service/DefaultLogTagFormatter.test.js +2 -0
  34. package/lib/cjs/src/api/logger-subscriber/service/DefaultLogTagFormatter.test.js.map +7 -0
  35. package/lib/cjs/src/api/logger-subscriber/service/LogTagFormatter.js +2 -0
  36. package/lib/cjs/src/api/logger-subscriber/service/LogTagFormatter.js.map +7 -0
  37. package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
  38. package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +2 -2
  39. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  40. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  41. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  42. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
  43. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js +1 -1
  44. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +3 -3
  45. package/lib/cjs/src/api/transport/model/Errors.js +1 -1
  46. package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
  47. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  48. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  49. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  50. package/lib/cjs/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  51. package/lib/cjs/src/internal/device-session/model/DevicePinger.js +1 -1
  52. package/lib/cjs/src/internal/device-session/model/DevicePinger.js.map +2 -2
  53. package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js +1 -1
  54. package/lib/cjs/src/internal/device-session/model/DevicePinger.test.js.map +2 -2
  55. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  56. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
  57. package/lib/cjs/src/internal/device-session/model/DeviceSession.test.js +2 -0
  58. package/lib/cjs/src/internal/device-session/model/DeviceSession.test.js.map +7 -0
  59. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js +1 -1
  60. package/lib/cjs/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +2 -2
  61. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  62. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
  63. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  64. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
  65. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
  66. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
  67. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
  68. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +2 -2
  69. package/lib/cjs/src/internal/device-session/service/IntentQueueService.js +2 -0
  70. package/lib/cjs/src/internal/device-session/service/IntentQueueService.js.map +7 -0
  71. package/lib/cjs/src/internal/device-session/service/IntentQueueService.test.js +2 -0
  72. package/lib/cjs/src/internal/device-session/service/IntentQueueService.test.js.map +7 -0
  73. package/lib/cjs/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.js +2 -0
  74. package/lib/cjs/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.js.map +7 -0
  75. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  76. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  77. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  78. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  79. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.js +1 -1
  80. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.js.map +3 -3
  81. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +1 -1
  82. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js.map +3 -3
  83. package/lib/cjs/src/internal/logger-publisher/service/sanitiseData.js +2 -0
  84. package/lib/cjs/src/internal/logger-publisher/service/sanitiseData.js.map +7 -0
  85. package/lib/cjs/src/internal/logger-publisher/service/sanitiseData.test.js +2 -0
  86. package/lib/cjs/src/internal/logger-publisher/service/sanitiseData.test.js.map +7 -0
  87. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
  88. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
  89. package/lib/esm/package.json +1 -1
  90. package/lib/esm/src/api/DeviceManagementKit.js +1 -1
  91. package/lib/esm/src/api/DeviceManagementKit.js.map +2 -2
  92. package/lib/esm/src/api/command/os/GetBackgroundImageSizeCommand.js +2 -0
  93. package/lib/esm/src/api/command/os/GetBackgroundImageSizeCommand.js.map +7 -0
  94. package/lib/esm/src/api/command/os/GetBackgroundImageSizeCommand.test.js +2 -0
  95. package/lib/esm/src/api/command/os/GetBackgroundImageSizeCommand.test.js.map +7 -0
  96. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  97. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  98. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
  99. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  100. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
  101. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js.map +3 -3
  102. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  103. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
  104. package/lib/esm/src/api/index.js +1 -1
  105. package/lib/esm/src/api/index.js.map +3 -3
  106. package/lib/esm/src/api/logger-publisher/utils/noopLoggerFactory.js +2 -0
  107. package/lib/esm/src/api/logger-publisher/utils/noopLoggerFactory.js.map +7 -0
  108. package/lib/esm/src/api/logger-publisher/utils/noopLoggerFactory.test.js +2 -0
  109. package/lib/esm/src/api/logger-publisher/utils/noopLoggerFactory.test.js.map +7 -0
  110. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.js +1 -1
  111. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.js.map +2 -2
  112. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js +1 -1
  113. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +2 -2
  114. package/lib/esm/src/api/logger-subscriber/service/DefaultLogTagFormatter.js +2 -0
  115. package/lib/esm/src/api/logger-subscriber/service/DefaultLogTagFormatter.js.map +7 -0
  116. package/lib/esm/src/api/logger-subscriber/service/DefaultLogTagFormatter.test.js +2 -0
  117. package/lib/esm/src/api/logger-subscriber/service/DefaultLogTagFormatter.test.js.map +7 -0
  118. package/lib/esm/src/api/logger-subscriber/service/LogTagFormatter.js +1 -0
  119. package/lib/esm/src/api/logger-subscriber/service/LogTagFormatter.js.map +7 -0
  120. package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
  121. package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +3 -3
  122. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  123. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  124. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  125. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
  126. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js +1 -1
  127. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +3 -3
  128. package/lib/esm/src/api/transport/model/Errors.js +1 -1
  129. package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
  130. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  131. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  132. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js +1 -1
  133. package/lib/esm/src/internal/device-session/di/deviceSessionTypes.js.map +2 -2
  134. package/lib/esm/src/internal/device-session/model/DevicePinger.js +1 -1
  135. package/lib/esm/src/internal/device-session/model/DevicePinger.js.map +2 -2
  136. package/lib/esm/src/internal/device-session/model/DevicePinger.test.js +1 -1
  137. package/lib/esm/src/internal/device-session/model/DevicePinger.test.js.map +2 -2
  138. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  139. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
  140. package/lib/esm/src/internal/device-session/model/DeviceSession.test.js +2 -0
  141. package/lib/esm/src/internal/device-session/model/DeviceSession.test.js.map +7 -0
  142. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js +1 -1
  143. package/lib/esm/src/internal/device-session/model/DeviceSessionEventDispatcher.js.map +2 -2
  144. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  145. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js.map +3 -3
  146. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  147. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
  148. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
  149. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
  150. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
  151. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +2 -2
  152. package/lib/esm/src/internal/device-session/service/IntentQueueService.js +2 -0
  153. package/lib/esm/src/internal/device-session/service/IntentQueueService.js.map +7 -0
  154. package/lib/esm/src/internal/device-session/service/IntentQueueService.test.js +2 -0
  155. package/lib/esm/src/internal/device-session/service/IntentQueueService.test.js.map +7 -0
  156. package/lib/esm/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.js +2 -0
  157. package/lib/esm/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.js.map +7 -0
  158. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  159. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  160. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  161. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  162. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.js +1 -1
  163. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.js.map +3 -3
  164. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +1 -1
  165. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js.map +3 -3
  166. package/lib/esm/src/internal/logger-publisher/service/sanitiseData.js +2 -0
  167. package/lib/esm/src/internal/logger-publisher/service/sanitiseData.js.map +7 -0
  168. package/lib/esm/src/internal/logger-publisher/service/sanitiseData.test.js +2 -0
  169. package/lib/esm/src/internal/logger-publisher/service/sanitiseData.test.js.map +7 -0
  170. package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
  171. package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js.map +3 -3
  172. package/lib/types/src/api/DeviceManagementKit.d.ts +10 -0
  173. package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
  174. package/lib/types/src/api/command/os/GetBackgroundImageSizeCommand.d.ts +17 -0
  175. package/lib/types/src/api/command/os/GetBackgroundImageSizeCommand.d.ts.map +1 -0
  176. package/lib/types/src/api/command/os/GetBackgroundImageSizeCommand.test.d.ts +2 -0
  177. package/lib/types/src/api/command/os/GetBackgroundImageSizeCommand.test.d.ts.map +1 -0
  178. package/lib/types/src/api/device-action/DeviceAction.d.ts +2 -1
  179. package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
  180. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  181. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +4 -1
  182. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
  183. package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts +13 -0
  184. package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts.map +1 -1
  185. package/lib/types/src/api/index.d.ts +9 -2
  186. package/lib/types/src/api/index.d.ts.map +1 -1
  187. package/lib/types/src/api/logger-publisher/utils/noopLoggerFactory.d.ts +12 -0
  188. package/lib/types/src/api/logger-publisher/utils/noopLoggerFactory.d.ts.map +1 -0
  189. package/lib/types/src/api/logger-publisher/utils/noopLoggerFactory.test.d.ts +2 -0
  190. package/lib/types/src/api/logger-publisher/utils/noopLoggerFactory.test.d.ts.map +1 -0
  191. package/lib/types/src/api/logger-subscriber/model/LogSubscriberOptions.d.ts +1 -0
  192. package/lib/types/src/api/logger-subscriber/model/LogSubscriberOptions.d.ts.map +1 -1
  193. package/lib/types/src/api/logger-subscriber/service/DefaultLogTagFormatter.d.ts +10 -0
  194. package/lib/types/src/api/logger-subscriber/service/DefaultLogTagFormatter.d.ts.map +1 -0
  195. package/lib/types/src/api/logger-subscriber/service/DefaultLogTagFormatter.test.d.ts +2 -0
  196. package/lib/types/src/api/logger-subscriber/service/DefaultLogTagFormatter.test.d.ts.map +1 -0
  197. package/lib/types/src/api/logger-subscriber/service/LogTagFormatter.d.ts +9 -0
  198. package/lib/types/src/api/logger-subscriber/service/LogTagFormatter.d.ts.map +1 -0
  199. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -1
  200. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +1 -0
  201. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -1
  202. package/lib/types/src/api/transport/model/Errors.d.ts +5 -0
  203. package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
  204. package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
  205. package/lib/types/src/internal/device-session/di/deviceSessionTypes.d.ts +1 -0
  206. package/lib/types/src/internal/device-session/di/deviceSessionTypes.d.ts.map +1 -1
  207. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +13 -2
  208. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  209. package/lib/types/src/internal/device-session/model/DeviceSession.test.d.ts +2 -0
  210. package/lib/types/src/internal/device-session/model/DeviceSession.test.d.ts.map +1 -0
  211. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts +3 -1
  212. package/lib/types/src/internal/device-session/model/DeviceSessionEventDispatcher.d.ts.map +1 -1
  213. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts +0 -1
  214. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts.map +1 -1
  215. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts +1 -0
  216. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts.map +1 -1
  217. package/lib/types/src/internal/device-session/service/IntentQueueService.d.ts +101 -0
  218. package/lib/types/src/internal/device-session/service/IntentQueueService.d.ts.map +1 -0
  219. package/lib/types/src/internal/device-session/service/IntentQueueService.test.d.ts +2 -0
  220. package/lib/types/src/internal/device-session/service/IntentQueueService.test.d.ts.map +1 -0
  221. package/lib/types/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.d.ts +19 -0
  222. package/lib/types/src/internal/device-session/use-case/UnsafeBypassIntentQueueUseCase.d.ts.map +1 -0
  223. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts.map +1 -1
  224. package/lib/types/src/internal/logger-publisher/service/DefaultLoggerPublisherService.d.ts +5 -2
  225. package/lib/types/src/internal/logger-publisher/service/DefaultLoggerPublisherService.d.ts.map +1 -1
  226. package/lib/types/src/internal/logger-publisher/service/sanitiseData.d.ts +6 -0
  227. package/lib/types/src/internal/logger-publisher/service/sanitiseData.d.ts.map +1 -0
  228. package/lib/types/src/internal/logger-publisher/service/sanitiseData.test.d.ts +2 -0
  229. package/lib/types/src/internal/logger-publisher/service/sanitiseData.test.d.ts.map +1 -0
  230. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  231. package/package.json +4 -4
  232. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js +0 -2
  233. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js.map +0 -7
  234. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js +0 -2
  235. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js.map +0 -7
  236. package/lib/cjs/src/internal/device-session/service/MutexService.js +0 -2
  237. package/lib/cjs/src/internal/device-session/service/MutexService.js.map +0 -7
  238. package/lib/cjs/src/internal/device-session/service/MutexService.test.js +0 -2
  239. package/lib/cjs/src/internal/device-session/service/MutexService.test.js.map +0 -7
  240. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js +0 -2
  241. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js.map +0 -7
  242. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js +0 -2
  243. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js.map +0 -7
  244. package/lib/esm/src/internal/device-session/service/MutexService.js +0 -2
  245. package/lib/esm/src/internal/device-session/service/MutexService.js.map +0 -7
  246. package/lib/esm/src/internal/device-session/service/MutexService.test.js +0 -2
  247. package/lib/esm/src/internal/device-session/service/MutexService.test.js.map +0 -7
  248. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts +0 -17
  249. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts.map +0 -1
  250. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts +0 -2
  251. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts.map +0 -1
  252. package/lib/types/src/internal/device-session/service/MutexService.d.ts +0 -6
  253. package/lib/types/src/internal/device-session/service/MutexService.d.ts.map +0 -1
  254. package/lib/types/src/internal/device-session/service/MutexService.test.d.ts +0 -2
  255. package/lib/types/src/internal/device-session/service/MutexService.test.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- import{Left as k,Maybe as m,Right as S}from"purify-ts";import{TransportMock as C}from"../../../api/transport/model/__mocks__/TransportMock";import{UnknownDeviceError as f}from"../../../api/transport/model/Errors";import{connectedDeviceStubBuilder as w}from"../../../api/transport/model/TransportConnectedDevice.stub";import{DefaultDeviceSessionService as I}from"../../device-session/service/DefaultDeviceSessionService";import{DefaultLoggerPublisherService as M}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as T}from"../../manager-api/data/AxiosManagerApiDataSource";import{DefaultManagerApiService as h}from"../../manager-api/service/DefaultManagerApiService";import{DefaultSecureChannelDataSource as A}from"../../secure-channel/data/DefaultSecureChannelDataSource";import{DefaultSecureChannelService as b}from"../../secure-channel/service/DefaultSecureChannelService";import{DefaultTransportService as O}from"../../transport/service/DefaultTransportService";import{ConnectUseCase as p}from"./ConnectUseCase";vi.mock("uuid",()=>({v4:vi.fn().mockReturnValue("fakeSessionId")}));vi.mock("@internal/manager-api/data/AxiosManagerApiDataSource");vi.mock("@internal/transport/service/DefaultTransportService");let o,n,i,e,s,l,d,c;const x="fakeSessionId",D="fakeSessionIdConnectedDevice";describe("ConnectUseCase",()=>{const v={id:"",deviceModel:{},transport:"USB",name:"TEST"},u=w({id:"1"}),g={id:"1",sessionId:D,modelId:"model-id",name:"device-name",type:"MOCK",transport:"USB"},y="logger-tag";beforeAll(()=>{i=new M([],y),o=new C,e=new I(()=>i),l=new T({}),s=new h(l),d=new A({}),c=new b(d),n=new O}),afterEach(()=>{for(const t of e.getDeviceSessions())e.removeDeviceSession(t.id)}),afterAll(()=>{vi.restoreAllMocks()}),test("If connect use case encounter an error, return it",async()=>{vi.spyOn(o,"connect").mockResolvedValue(k(new f)),vi.spyOn(n,"getTransport").mockReturnValue(m.of(o));const t=new p(n,e,()=>i,s,c);await expect(t.execute({device:v})).rejects.toBeInstanceOf(f)}),test("If connect is in success, return a deviceSession id",async()=>{vi.spyOn(o,"connect").mockResolvedValue(S(u)),vi.spyOn(n,"getTransport").mockReturnValue(m.of(o)),vi.spyOn(e,"addDeviceSession").mockImplementation(a=>(a.setDeviceSessionState({}),e));const r=await new p(n,e,()=>i,s,c).execute({device:v});expect(r).toBe(x),e.removeDeviceSession(r)}),test("If connect is in success after a reconnect, return the same deviceSession id",async()=>{vi.spyOn(o,"connect").mockResolvedValue(S(u)),vi.spyOn(n,"getTransport").mockReturnValue(m.of(o)),vi.spyOn(e,"addDeviceSession").mockImplementation(a=>(a.setDeviceSessionState({}),e));const r=await new p(n,e,()=>i,s,c).execute({device:g});expect(r).toBe(D),e.removeDeviceSession(r)})});
1
+ import{Left as k,Maybe as d,Right as S}from"purify-ts";import{TransportNotSupportedError as g,UnknownDeviceError as C}from"../../../api/transport/model/Errors";import{connectedDeviceStubBuilder as h}from"../../../api/transport/model/TransportConnectedDevice.stub";import{DefaultLoggerPublisherService as y}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{ConnectUseCase as v}from"./ConnectUseCase";vi.mock("uuid",()=>({v4:vi.fn().mockReturnValue("fakeSessionId")}));let o,e,s,n,r,a;const f="fakeSessionId",m="fakeSessionIdConnectedDevice";describe("ConnectUseCase",()=>{const c={id:"device-id",deviceModel:{},transport:"USB",name:"TEST"},p=h({id:"1"}),u={...p,sessionId:m,modelId:"model-id",name:"device-name",type:"MOCK"},D="logger-tag";beforeEach(()=>{s=new y([],D),o={connect:vi.fn()},e={getTransport:vi.fn()},n={addDeviceSession:vi.fn(),removeDeviceSession:vi.fn(),getDeviceSessionByDeviceId:vi.fn()},r={},a={}}),afterAll(()=>{vi.restoreAllMocks()}),test("should throw an error when transport connection fails",async()=>{const t=new C;vi.mocked(e.getTransport).mockReturnValue(d.of(o)),vi.mocked(o.connect).mockResolvedValue(k(t));const i=new v(e,n,()=>s,r,a);await expect(i.execute({device:c})).rejects.toBe(t),expect(e.getTransport).toHaveBeenCalledWith("USB"),expect(o.connect).toHaveBeenCalledWith({deviceId:c.id,onDisconnect:expect.any(Function)})}),test("should successfully connect and return a deviceSession id",async()=>{vi.mocked(e.getTransport).mockReturnValue(d.of(o)),vi.mocked(o.connect).mockResolvedValue(S(p)),vi.mocked(n.addDeviceSession).mockImplementation(l=>(vi.spyOn(l,"initialiseSession").mockResolvedValue(void 0),n));const i=await new v(e,n,()=>s,r,a).execute({device:c});expect(i).toBe(f),expect(e.getTransport).toHaveBeenCalledWith("USB"),expect(o.connect).toHaveBeenCalledWith({deviceId:c.id,onDisconnect:expect.any(Function)}),expect(n.addDeviceSession).toHaveBeenCalledWith(expect.objectContaining({id:f}))}),test("should reconnect with existing sessionId when connecting to a ConnectedDevice",async()=>{vi.mocked(e.getTransport).mockReturnValue(d.of(o)),vi.mocked(o.connect).mockResolvedValue(S(p)),vi.mocked(n.addDeviceSession).mockImplementation(l=>(vi.spyOn(l,"initialiseSession").mockResolvedValue(void 0),n));const i=await new v(e,n,()=>s,r,a).execute({device:u});expect(i).toBe(m),expect(e.getTransport).toHaveBeenCalledWith("USB"),expect(o.connect).toHaveBeenCalledWith({deviceId:u.id,onDisconnect:expect.any(Function)}),expect(n.addDeviceSession).toHaveBeenCalledWith(expect.objectContaining({id:m}))}),test("should throw an error when transport is not supported",async()=>{vi.mocked(e.getTransport).mockReturnValue(d.empty());const t=new v(e,n,()=>s,r,a);await expect(t.execute({device:c})).rejects.toBeInstanceOf(g),expect(e.getTransport).toHaveBeenCalledWith("USB")})});
2
2
  //# sourceMappingURL=ConnectUseCase.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/discovery/use-case/ConnectUseCase.test.ts"],
4
- "sourcesContent": ["import { Left, Maybe, Right } from \"purify-ts\";\n\nimport { type DeviceModel, type DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type ConnectionType } from \"@api/discovery/ConnectionType\";\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { TransportMock } from \"@api/transport/model/__mocks__/TransportMock\";\nimport { type ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nimport { type DiscoveredDevice } from \"@api/transport/model/DiscoveredDevice\";\nimport { UnknownDeviceError } from \"@api/transport/model/Errors\";\nimport { type Transport } from \"@api/transport/model/Transport\";\nimport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nimport { DefaultDeviceSessionService } from \"@internal/device-session/service/DefaultDeviceSessionService\";\nimport { type DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport { AxiosManagerApiDataSource } from \"@internal/manager-api/data/AxiosManagerApiDataSource\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { type SecureChannelDataSource } from \"@internal/secure-channel/data/SecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\nimport { DefaultTransportService } from \"@internal/transport/service/DefaultTransportService\";\nimport { type TransportService } from \"@internal/transport/service/TransportService\";\n\nimport { ConnectUseCase } from \"./ConnectUseCase\";\n\nvi.mock(\"uuid\", () => ({\n v4: vi.fn().mockReturnValue(\"fakeSessionId\"),\n}));\n\nvi.mock(\"@internal/manager-api/data/AxiosManagerApiDataSource\");\nvi.mock(\"@internal/transport/service/DefaultTransportService\");\n\n// TODO test several transports\n// let transports: WebUsbHidTransport[];\nlet transport: Transport;\nlet transportService: TransportService;\nlet logger: LoggerPublisherService;\nlet sessionService: DeviceSessionService;\nlet managerApi: ManagerApiService;\nlet managerApiDataSource: ManagerApiDataSource;\nlet secureChannelDataSource: SecureChannelDataSource;\nlet secureChannel: SecureChannelService;\nconst fakeSessionId = \"fakeSessionId\";\nconst fakeSessionIdConnectedDevice = \"fakeSessionIdConnectedDevice\";\n\ndescribe(\"ConnectUseCase\", () => {\n const stubDiscoveredDevice: DiscoveredDevice = {\n id: \"\",\n deviceModel: {} as DeviceModel,\n transport: \"USB\",\n name: \"TEST\",\n };\n const stubTransportConnectedDevice = connectedDeviceStubBuilder({ id: \"1\" });\n const stubConnectedDevice = {\n id: \"1\",\n sessionId: fakeSessionIdConnectedDevice,\n modelId: \"model-id\" as unknown as DeviceModelId,\n name: \"device-name\",\n type: \"MOCK\" as unknown as ConnectionType,\n transport: \"USB\",\n } as unknown as ConnectedDevice;\n const tag = \"logger-tag\";\n\n beforeAll(() => {\n logger = new DefaultLoggerPublisherService([], tag);\n transport = new TransportMock();\n sessionService = new DefaultDeviceSessionService(() => logger);\n managerApiDataSource = new AxiosManagerApiDataSource({} as DmkConfig);\n managerApi = new DefaultManagerApiService(managerApiDataSource);\n secureChannelDataSource = new DefaultSecureChannelDataSource(\n {} as DmkConfig,\n );\n secureChannel = new DefaultSecureChannelService(secureChannelDataSource);\n // @ts-expect-error mock\n transportService = new DefaultTransportService();\n });\n\n afterEach(() => {\n for (const session of sessionService.getDeviceSessions()) {\n sessionService.removeDeviceSession(session.id);\n }\n });\n\n afterAll(() => {\n vi.restoreAllMocks();\n });\n\n test(\"If connect use case encounter an error, return it\", async () => {\n vi.spyOn(transport, \"connect\").mockResolvedValue(\n Left(new UnknownDeviceError()),\n );\n\n vi.spyOn(transportService, \"getTransport\").mockReturnValue(\n Maybe.of(transport),\n );\n\n const usecase = new ConnectUseCase(\n transportService,\n sessionService,\n () => logger,\n managerApi,\n secureChannel,\n );\n\n await expect(\n usecase.execute({ device: stubDiscoveredDevice }),\n ).rejects.toBeInstanceOf(UnknownDeviceError);\n });\n\n test(\"If connect is in success, return a deviceSession id\", async () => {\n vi.spyOn(transport, \"connect\").mockResolvedValue(\n Right(stubTransportConnectedDevice),\n );\n vi.spyOn(transportService, \"getTransport\").mockReturnValue(\n Maybe.of(transport),\n );\n vi.spyOn(sessionService, \"addDeviceSession\").mockImplementation(\n (deviceSession) => {\n deviceSession.setDeviceSessionState({} as DeviceSessionState);\n return sessionService;\n },\n );\n\n const usecase = new ConnectUseCase(\n transportService,\n sessionService,\n () => logger,\n managerApi,\n secureChannel,\n );\n\n const sessionId = await usecase.execute({\n device: stubDiscoveredDevice,\n });\n expect(sessionId).toBe(fakeSessionId);\n sessionService.removeDeviceSession(sessionId);\n });\n\n test(\"If connect is in success after a reconnect, return the same deviceSession id\", async () => {\n vi.spyOn(transport, \"connect\").mockResolvedValue(\n Right(stubTransportConnectedDevice),\n );\n vi.spyOn(transportService, \"getTransport\").mockReturnValue(\n Maybe.of(transport),\n );\n vi.spyOn(sessionService, \"addDeviceSession\").mockImplementation(\n (deviceSession) => {\n deviceSession.setDeviceSessionState({} as DeviceSessionState);\n return sessionService;\n },\n );\n\n const usecase = new ConnectUseCase(\n transportService,\n sessionService,\n () => logger,\n managerApi,\n secureChannel,\n );\n\n const sessionId = await usecase.execute({\n device: stubConnectedDevice,\n });\n expect(sessionId).toBe(fakeSessionIdConnectedDevice); // same session id as the connected device\n sessionService.removeDeviceSession(sessionId);\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,EAAO,SAAAC,MAAa,YAOnC,OAAS,iBAAAC,MAAqB,+CAG9B,OAAS,sBAAAC,MAA0B,8BAEnC,OAAS,8BAAAC,MAAkC,qDAC3C,OAAS,+BAAAC,MAAmC,+DAE5C,OAAS,iCAAAC,MAAqC,mEAC9C,OAAS,6BAAAC,MAAiC,uDAE1C,OAAS,4BAAAC,MAAgC,yDAEzC,OAAS,kCAAAC,MAAsC,+DAE/C,OAAS,+BAAAC,MAAmC,+DAE5C,OAAS,2BAAAC,MAA+B,sDAGxC,OAAS,kBAAAC,MAAsB,mBAE/B,GAAG,KAAK,OAAQ,KAAO,CACrB,GAAI,GAAG,GAAG,EAAE,gBAAgB,eAAe,CAC7C,EAAE,EAEF,GAAG,KAAK,sDAAsD,EAC9D,GAAG,KAAK,qDAAqD,EAI7D,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACJ,MAAMC,EAAgB,gBAChBC,EAA+B,+BAErC,SAAS,iBAAkB,IAAM,CAC/B,MAAMC,EAAyC,CAC7C,GAAI,GACJ,YAAa,CAAC,EACd,UAAW,MACX,KAAM,MACR,EACMC,EAA+BpB,EAA2B,CAAE,GAAI,GAAI,CAAC,EACrEqB,EAAsB,CAC1B,GAAI,IACJ,UAAWH,EACX,QAAS,WACT,KAAM,cACN,KAAM,OACN,UAAW,KACb,EACMI,EAAM,aAEZ,UAAU,IAAM,CACdX,EAAS,IAAIT,EAA8B,CAAC,EAAGoB,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SAAY,CAC/F,GAAG,MAAMjB,EAAW,SAAS,EAAE,kBAC7BZ,EAAMuB,CAA4B,CACpC,EACA,GAAG,MAAMV,EAAkB,cAAc,EAAE,gBACzCd,EAAM,GAAGa,CAAS,CACpB,EACA,GAAG,MAAMG,EAAgB,kBAAkB,EAAE,mBAC1Ca,IACCA,EAAc,sBAAsB,CAAC,CAAuB,EACrDb,EAEX,EAUA,MAAMc,EAAY,MARF,IAAIlB,EAClBE,EACAE,EACA,IAAMD,EACNE,EACAG,CACF,EAEgC,QAAQ,CACtC,OAAQK,CACV,CAAC,EACD,OAAOK,CAAS,EAAE,KAAKR,CAA4B,EACnDN,EAAe,oBAAoBc,CAAS,CAC9C,CAAC,CACH,CAAC",
6
- "names": ["Left", "Maybe", "Right", "TransportMock", "UnknownDeviceError", "connectedDeviceStubBuilder", "DefaultDeviceSessionService", "DefaultLoggerPublisherService", "AxiosManagerApiDataSource", "DefaultManagerApiService", "DefaultSecureChannelDataSource", "DefaultSecureChannelService", "DefaultTransportService", "ConnectUseCase", "transport", "transportService", "logger", "sessionService", "managerApi", "managerApiDataSource", "secureChannelDataSource", "secureChannel", "fakeSessionId", "fakeSessionIdConnectedDevice", "stubDiscoveredDevice", "stubTransportConnectedDevice", "stubConnectedDevice", "tag", "session", "usecase", "deviceSession", "sessionId"]
4
+ "sourcesContent": ["import { Left, Maybe, Right } from \"purify-ts\";\n\nimport { type DeviceModel, type DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type ConnectionType } from \"@api/discovery/ConnectionType\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nimport { type DiscoveredDevice } from \"@api/transport/model/DiscoveredDevice\";\nimport {\n TransportNotSupportedError,\n UnknownDeviceError,\n} from \"@api/transport/model/Errors\";\nimport { type Transport } from \"@api/transport/model/Transport\";\nimport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nimport { type DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\nimport { type TransportService } from \"@internal/transport/service/TransportService\";\n\nimport { ConnectUseCase } from \"./ConnectUseCase\";\n\nvi.mock(\"uuid\", () => ({\n v4: vi.fn().mockReturnValue(\"fakeSessionId\"),\n}));\n\nlet transport: Transport;\nlet transportService: TransportService;\nlet logger: LoggerPublisherService;\nlet sessionService: DeviceSessionService;\nlet managerApi: ManagerApiService;\nlet secureChannel: SecureChannelService;\nconst fakeSessionId = \"fakeSessionId\";\nconst fakeSessionIdConnectedDevice = \"fakeSessionIdConnectedDevice\";\n\ndescribe(\"ConnectUseCase\", () => {\n const stubDiscoveredDevice: DiscoveredDevice = {\n id: \"device-id\",\n deviceModel: {} as DeviceModel,\n transport: \"USB\",\n name: \"TEST\",\n };\n const stubTransportConnectedDevice = connectedDeviceStubBuilder({ id: \"1\" });\n const stubConnectedDevice: ConnectedDevice = {\n ...stubTransportConnectedDevice,\n sessionId: fakeSessionIdConnectedDevice,\n modelId: \"model-id\" as DeviceModelId,\n name: \"device-name\",\n type: \"MOCK\" as ConnectionType,\n };\n const tag = \"logger-tag\";\n\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService([], tag);\n\n // Mock Transport\n transport = {\n connect: vi.fn(),\n } as unknown as Transport;\n\n // Mock TransportService\n transportService = {\n getTransport: vi.fn(),\n } as unknown as TransportService;\n\n // Mock DeviceSessionService\n sessionService = {\n addDeviceSession: vi.fn(),\n removeDeviceSession: vi.fn(),\n getDeviceSessionByDeviceId: vi.fn(),\n } as unknown as DeviceSessionService;\n\n // Mock ManagerApiService\n managerApi = {} as ManagerApiService;\n\n // Mock SecureChannelService\n secureChannel = {} as SecureChannelService;\n });\n\n afterAll(() => {\n vi.restoreAllMocks();\n });\n\n test(\"should throw an error when transport connection fails\", async () => {\n // given\n const connectionError = new UnknownDeviceError();\n vi.mocked(transportService.getTransport).mockReturnValue(\n Maybe.of(transport),\n );\n vi.mocked(transport.connect).mockResolvedValue(Left(connectionError));\n\n const usecase = new ConnectUseCase(\n transportService,\n sessionService,\n () => logger,\n managerApi,\n secureChannel,\n );\n\n // when/then\n await expect(\n usecase.execute({ device: stubDiscoveredDevice }),\n ).rejects.toBe(connectionError);\n\n expect(transportService.getTransport).toHaveBeenCalledWith(\"USB\");\n expect(transport.connect).toHaveBeenCalledWith({\n deviceId: stubDiscoveredDevice.id,\n onDisconnect: expect.any(Function),\n });\n });\n\n test(\"should successfully connect and return a deviceSession id\", async () => {\n // given\n vi.mocked(transportService.getTransport).mockReturnValue(\n Maybe.of(transport),\n );\n vi.mocked(transport.connect).mockResolvedValue(\n Right(stubTransportConnectedDevice),\n );\n\n // Spy on addDeviceSession to capture the created session and mock its behavior\n vi.mocked(sessionService.addDeviceSession).mockImplementation(\n (deviceSession) => {\n // Mock the initialiseSession to avoid real initialization\n vi.spyOn(deviceSession, \"initialiseSession\").mockResolvedValue(\n undefined,\n );\n return sessionService;\n },\n );\n\n const usecase = new ConnectUseCase(\n transportService,\n sessionService,\n () => logger,\n managerApi,\n secureChannel,\n );\n\n // when\n const sessionId = await usecase.execute({\n device: stubDiscoveredDevice,\n });\n\n // then\n expect(sessionId).toBe(fakeSessionId);\n expect(transportService.getTransport).toHaveBeenCalledWith(\"USB\");\n expect(transport.connect).toHaveBeenCalledWith({\n deviceId: stubDiscoveredDevice.id,\n onDisconnect: expect.any(Function),\n });\n expect(sessionService.addDeviceSession).toHaveBeenCalledWith(\n expect.objectContaining({\n id: fakeSessionId,\n }),\n );\n });\n\n test(\"should reconnect with existing sessionId when connecting to a ConnectedDevice\", async () => {\n // given\n vi.mocked(transportService.getTransport).mockReturnValue(\n Maybe.of(transport),\n );\n vi.mocked(transport.connect).mockResolvedValue(\n Right(stubTransportConnectedDevice),\n );\n\n // Spy on addDeviceSession to capture the created session and mock its behavior\n vi.mocked(sessionService.addDeviceSession).mockImplementation(\n (deviceSession) => {\n // Mock the initialiseSession to avoid real initialization\n vi.spyOn(deviceSession, \"initialiseSession\").mockResolvedValue(\n undefined,\n );\n return sessionService;\n },\n );\n\n const usecase = new ConnectUseCase(\n transportService,\n sessionService,\n () => logger,\n managerApi,\n secureChannel,\n );\n\n // when\n const sessionId = await usecase.execute({\n device: stubConnectedDevice,\n });\n\n // then\n expect(sessionId).toBe(fakeSessionIdConnectedDevice);\n expect(transportService.getTransport).toHaveBeenCalledWith(\"USB\");\n expect(transport.connect).toHaveBeenCalledWith({\n deviceId: stubConnectedDevice.id,\n onDisconnect: expect.any(Function),\n });\n expect(sessionService.addDeviceSession).toHaveBeenCalledWith(\n expect.objectContaining({\n id: fakeSessionIdConnectedDevice,\n }),\n );\n });\n\n test(\"should throw an error when transport is not supported\", async () => {\n // given\n vi.mocked(transportService.getTransport).mockReturnValue(Maybe.empty());\n\n const usecase = new ConnectUseCase(\n transportService,\n sessionService,\n () => logger,\n managerApi,\n secureChannel,\n );\n\n // when/then\n await expect(\n usecase.execute({ device: stubDiscoveredDevice }),\n ).rejects.toBeInstanceOf(TransportNotSupportedError);\n\n expect(transportService.getTransport).toHaveBeenCalledWith(\"USB\");\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,EAAO,SAAAC,MAAa,YAOnC,OACE,8BAAAC,EACA,sBAAAC,MACK,8BAEP,OAAS,8BAAAC,MAAkC,qDAE3C,OAAS,iCAAAC,MAAqC,mEAK9C,OAAS,kBAAAC,MAAsB,mBAE/B,GAAG,KAAK,OAAQ,KAAO,CACrB,GAAI,GAAG,GAAG,EAAE,gBAAgB,eAAe,CAC7C,EAAE,EAEF,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACJ,MAAMC,EAAgB,gBAChBC,EAA+B,+BAErC,SAAS,iBAAkB,IAAM,CAC/B,M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GAAG,OAAON,EAAiB,YAAY,EAAE,gBAAgBR,EAAM,MAAM,CAAC,EAEtE,MAAMoB,EAAU,IAAId,EAClBE,EACAE,EACA,IAAMD,EACNE,EACAC,CACF,EAGA,MAAM,OACJQ,EAAQ,QAAQ,CAAE,OAAQL,CAAqB,CAAC,CAClD,EAAE,QAAQ,eAAeb,CAA0B,EAEnD,OAAOM,EAAiB,YAAY,EAAE,qBAAqB,KAAK,CAClE,CAAC,CACH,CAAC",
6
+ "names": ["Left", "Maybe", "Right", "TransportNotSupportedError", "UnknownDeviceError", "connectedDeviceStubBuilder", "DefaultLoggerPublisherService", "ConnectUseCase", "transport", "transportService", "logger", "sessionService", "managerApi", "secureChannel", "fakeSessionId", "fakeSessionIdConnectedDevice", "stubDiscoveredDevice", "stubTransportConnectedDevice", "stubConnectedDevice", "tag", "connectionError", "usecase", "deviceSession", "sessionId"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=(b,r,i,s)=>{for(var o=s>1?void 0:s?m(r,i):r,t=b.length-1,n;t>=0;t--)(n=b[t])&&(o=(s?n(r,i,o):n(o))||o);return s&&o&&c(r,i,o),o};import{injectable as h}from"inversify";import{LogLevel as g}from"../../../api/logger-subscriber/model/LogLevel";let e=class{subscribers;tag;constructor(r,i){this.subscribers=r,this.tag=i}_log(r,i,s){this.subscribers.forEach(o=>{const t={timestamp:Date.now(),tag:this.tag,...s};o.log(r,i,t)})}info(r,i){this._log(g.Info,r,i)}warn(r,i){this._log(g.Warning,r,i)}debug(r,i){this._log(g.Debug,r,i)}error(r,i){this._log(g.Error,r,i)}};e=p([h()],e);export{e as DefaultLoggerPublisherService};
1
+ var L=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var n=(m,r,t,o)=>{for(var i=o>1?void 0:o?c(r,t):r,s=m.length-1,g;s>=0;s--)(g=m[s])&&(i=(o?g(r,t,i):g(i))||i);return o&&i&&L(r,t,i),i};import{injectable as h}from"inversify";import{LogLevel as e}from"../../../api/logger-subscriber/model/LogLevel";import{DefaultLogTagFormatter as u}from"../../../api/logger-subscriber/service/DefaultLogTagFormatter";import{sanitiseData as l}from"../../logger-publisher/service/sanitiseData";let a=class{subscribers;tag;tagFormatter;constructor(r,t,o=new u){this.subscribers=r,this.tag=t,this.tagFormatter=o}_log(r,t,o){const i=o?.data?l(o.data):void 0,s=o?.tag??this.tag,g=this.tagFormatter.format(s);this.subscribers.forEach(b=>{const p={timestamp:o?.timestamp??Date.now(),tag:g,data:i};b.log(r,t,p)})}info(r,t){this._log(e.Info,r,t)}warn(r,t){this._log(e.Warning,r,t)}debug(r,t){this._log(e.Debug,r,t)}error(r,t){this._log(e.Error,r,t)}};a=n([h()],a);export{a as DefaultLoggerPublisherService};
2
2
  //# sourceMappingURL=DefaultLoggerPublisherService.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/logger-publisher/service/DefaultLoggerPublisherService.ts"],
4
- "sourcesContent": ["import { injectable } from \"inversify\";\n\nimport { LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nimport { LogSubscriberOptions } from \"@api/logger-subscriber/model/LogSubscriberOptions\";\nimport { LoggerSubscriberService } from \"@api/logger-subscriber/service/LoggerSubscriberService\";\nimport { LogPublisherOptions } from \"@internal/logger-publisher/model/LogPublisherOptions\";\n\n@injectable()\nexport class DefaultLoggerPublisherService implements LoggerPublisherService {\n subscribers: LoggerSubscriberService[];\n tag: string;\n\n constructor(subscribers: LoggerSubscriberService[], tag: string) {\n this.subscribers = subscribers;\n this.tag = tag;\n }\n\n _log(level: LogLevel, message: string, options?: LogPublisherOptions): void {\n this.subscribers.forEach((subscriber) => {\n const subscriberOptions: LogSubscriberOptions = {\n timestamp: Date.now(),\n tag: this.tag,\n ...options,\n };\n subscriber.log(level, message, subscriberOptions);\n });\n }\n\n info(message: string, options?: LogPublisherOptions): void {\n this._log(LogLevel.Info, message, options);\n }\n\n warn(message: string, options?: LogPublisherOptions): void {\n this._log(LogLevel.Warning, message, options);\n }\n\n debug(message: string, options?: LogPublisherOptions): void {\n this._log(LogLevel.Debug, message, options);\n }\n\n error(message: string, options?: LogPublisherOptions): void {\n this._log(LogLevel.Error, message, options);\n }\n}\n"],
5
- "mappings": "wMAAA,OAAS,cAAAA,MAAkB,YAG3B,OAAS,YAAAC,MAAgB,wCAMlB,IAAMC,EAAN,KAAsE,CAC3E,YACA,IAEA,YAAYC,EAAwCC,EAAa,CAC/D,KAAK,YAAcD,EACnB,KAAK,IAAMC,CACb,CAEA,KAAKC,EAAiBC,EAAiBC,EAAqC,CAC1E,KAAK,YAAY,QAASC,GAAe,CACvC,MAAMC,EAA0C,CAC9C,UAAW,KAAK,IAAI,EACpB,IAAK,KAAK,IACV,GAAGF,CACL,EACAC,EAAW,IAAIH,EAAOC,EAASG,CAAiB,CAClD,CAAC,CACH,CAEA,KAAKH,EAAiBC,EAAqC,CACzD,KAAK,KAAKG,EAAS,KAAMJ,EAASC,CAAO,CAC3C,CAEA,KAAKD,EAAiBC,EAAqC,CACzD,KAAK,KAAKG,EAAS,QAASJ,EAASC,CAAO,CAC9C,CAEA,MAAMD,EAAiBC,EAAqC,CAC1D,KAAK,KAAKG,EAAS,MAAOJ,EAASC,CAAO,CAC5C,CAEA,MAAMD,EAAiBC,EAAqC,CAC1D,KAAK,KAAKG,EAAS,MAAOJ,EAASC,CAAO,CAC5C,CACF,EAnCaL,EAANS,EAAA,CADNC,EAAW,GACCV",
6
- "names": ["injectable", "LogLevel", "DefaultLoggerPublisherService", "subscribers", "tag", "level", "message", "options", "subscriber", "subscriberOptions", "LogLevel", "__decorateClass", "injectable"]
4
+ "sourcesContent": ["import { injectable } from \"inversify\";\n\nimport { LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nimport {\n type LogSubscriberOptions,\n type LogTag,\n} from \"@api/logger-subscriber/model/LogSubscriberOptions\";\nimport { DefaultLogTagFormatter } from \"@api/logger-subscriber/service/DefaultLogTagFormatter\";\nimport { LoggerSubscriberService } from \"@api/logger-subscriber/service/LoggerSubscriberService\";\nimport { type LogTagFormatter } from \"@api/logger-subscriber/service/LogTagFormatter\";\nimport { LogPublisherOptions } from \"@internal/logger-publisher/model/LogPublisherOptions\";\nimport { sanitiseData } from \"@internal/logger-publisher/service/sanitiseData\";\n\n@injectable()\nexport class DefaultLoggerPublisherService implements LoggerPublisherService {\n subscribers: LoggerSubscriberService[];\n tag: LogTag;\n private readonly tagFormatter: LogTagFormatter;\n\n constructor(\n subscribers: LoggerSubscriberService[],\n tag: LogTag,\n tagFormatter: LogTagFormatter = new DefaultLogTagFormatter(),\n ) {\n this.subscribers = subscribers;\n this.tag = tag;\n this.tagFormatter = tagFormatter;\n }\n\n _log(level: LogLevel, message: string, options?: LogPublisherOptions): void {\n const sanitisedData = options?.data\n ? sanitiseData(options.data)\n : undefined;\n\n // Format the tag from options if provided, otherwise use the instance tag\n const tagToFormat = options?.tag ?? this.tag;\n const formattedTag = this.tagFormatter.format(tagToFormat);\n\n this.subscribers.forEach((subscriber) => {\n const subscriberOptions: LogSubscriberOptions = {\n timestamp: options?.timestamp ?? Date.now(),\n tag: formattedTag,\n data: sanitisedData,\n };\n subscriber.log(level, message, subscriberOptions);\n });\n }\n\n info(message: string, options?: LogPublisherOptions): void {\n this._log(LogLevel.Info, message, options);\n }\n\n warn(message: string, options?: LogPublisherOptions): void {\n this._log(LogLevel.Warning, message, options);\n }\n\n debug(message: string, options?: LogPublisherOptions): void {\n this._log(LogLevel.Debug, message, options);\n }\n\n error(message: string, options?: LogPublisherOptions): void {\n this._log(LogLevel.Error, message, options);\n }\n}\n"],
5
+ "mappings": "wMAAA,OAAS,cAAAA,MAAkB,YAG3B,OAAS,YAAAC,MAAgB,wCAKzB,OAAS,0BAAAC,MAA8B,wDAIvC,OAAS,gBAAAC,MAAoB,kDAGtB,IAAMC,EAAN,KAAsE,CAC3E,YACA,IACiB,aAEjB,YACEC,EACAC,EACAC,EAAgC,IAAIC,EACpC,CACA,KAAK,YAAcH,EACnB,KAAK,IAAMC,EACX,KAAK,aAAeC,CACtB,CAEA,KAAKE,EAAiBC,EAAiBC,EAAqC,CAC1E,MAAMC,EAAgBD,GAAS,KAC3BE,EAAaF,EAAQ,IAAI,EACzB,OAGEG,EAAcH,GAAS,KAAO,KAAK,IACnCI,EAAe,KAAK,aAAa,OAAOD,CAAW,EAEzD,KAAK,YAAY,QAASE,GAAe,CACvC,MAAMC,EAA0C,CAC9C,UAAWN,GAAS,WAAa,KAAK,IAAI,EAC1C,IAAKI,EACL,KAAMH,CACR,EACAI,EAAW,IAAIP,EAAOC,EAASO,CAAiB,CAClD,CAAC,CACH,CAEA,KAAKP,EAAiBC,EAAqC,CACzD,KAAK,KAAKO,EAAS,KAAMR,EAASC,CAAO,CAC3C,CAEA,KAAKD,EAAiBC,EAAqC,CACzD,KAAK,KAAKO,EAAS,QAASR,EAASC,CAAO,CAC9C,CAEA,MAAMD,EAAiBC,EAAqC,CAC1D,KAAK,KAAKO,EAAS,MAAOR,EAASC,CAAO,CAC5C,CAEA,MAAMD,EAAiBC,EAAqC,CAC1D,KAAK,KAAKO,EAAS,MAAOR,EAASC,CAAO,CAC5C,CACF,EAjDaP,EAANe,EAAA,CADNC,EAAW,GACChB",
6
+ "names": ["injectable", "LogLevel", "DefaultLogTagFormatter", "sanitiseData", "DefaultLoggerPublisherService", "subscribers", "tag", "tagFormatter", "DefaultLogTagFormatter", "level", "message", "options", "sanitisedData", "sanitiseData", "tagToFormat", "formattedTag", "subscriber", "subscriberOptions", "LogLevel", "__decorateClass", "injectable"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{LogLevel as l}from"../../../api/logger-subscriber/model/LogLevel";import{ConsoleLogger as c}from"../../../api/logger-subscriber/service/ConsoleLogger";import{DefaultLoggerPublisherService as a}from"./DefaultLoggerPublisherService";vi.mock("@api/logger-subscriber/service/ConsoleLogger");vi.useFakeTimers().setSystemTime(new Date("2024-01-01"));let o,s;const e="message",n="logger-tag",t={data:{key:"value"}},r={tag:n,timestamp:Date.now(),...t};describe("LoggerPublisherService",()=>{beforeEach(()=>{vi.clearAllMocks(),s=new c,o=new a([s],n)}),it("should call subscriber.log with the correct log object",()=>{o.info(e,t),expect(s.log).toHaveBeenCalledWith(l.Info,e,r)}),it("should call subscriber.log with the correct log object when a tag is provided",()=>{const i="new-tag";o.info(e,{...t,tag:i}),expect(s.log).toHaveBeenCalledWith(l.Info,e,{...r,tag:i})}),it("should call subscriber.log with the correct log object when a timestamp is provided",()=>{o.info(e,{...t,timestamp:1}),expect(s.log).toHaveBeenCalledWith(l.Info,e,{...r,timestamp:1})}),it("should call _log with the correct LogLevel",()=>{const i=vi.spyOn(o,"_log").mockImplementation(vi.fn());o.info(e,t),expect(i).toHaveBeenCalledWith(l.Info,e,t)}),it("should have the correct LogLevel",()=>{const i=vi.spyOn(o,"_log").mockImplementation(vi.fn());o.debug(e,t),expect(i).toHaveBeenCalledWith(l.Debug,e,t)}),it("should have the correct LogLevel",()=>{const i=vi.spyOn(o,"_log").mockImplementation(vi.fn());o.warn(e,t),expect(i).toHaveBeenCalledWith(l.Warning,e,t)}),it("should have the correct LogLevel",()=>{const i=vi.spyOn(o,"_log").mockImplementation(vi.fn());o.error(e,t),expect(i).toHaveBeenCalledWith(l.Error,e,t)})});
1
+ import{LogLevel as l}from"../../../api/logger-subscriber/model/LogLevel";import{ConsoleLogger as a}from"../../../api/logger-subscriber/service/ConsoleLogger";import{DefaultLoggerPublisherService as c}from"./DefaultLoggerPublisherService";vi.mock("@api/logger-subscriber/service/ConsoleLogger");vi.useFakeTimers().setSystemTime(new Date("2024-01-01"));let o,s;const e="message",r="logger-tag",g=`[${r}]`,t={data:{key:"value"}},n={tag:g,timestamp:Date.now(),...t};describe("LoggerPublisherService",()=>{beforeEach(()=>{vi.clearAllMocks(),s=new a,o=new c([s],r)}),it("should call subscriber.log with the correct log object",()=>{o.info(e,t),expect(s.log).toHaveBeenCalledWith(l.Info,e,n)}),it("should call subscriber.log with the correct log object when a tag is provided in options",()=>{const i="new-tag";o.info(e,{...t,tag:i}),expect(s.log).toHaveBeenCalledWith(l.Info,e,{...n,tag:`[${i}]`})}),it("should call subscriber.log with the correct log object when a timestamp is provided",()=>{o.info(e,{...t,timestamp:1}),expect(s.log).toHaveBeenCalledWith(l.Info,e,{...n,timestamp:1})}),it("should call _log with the correct LogLevel",()=>{const i=vi.spyOn(o,"_log").mockImplementation(vi.fn());o.info(e,t),expect(i).toHaveBeenCalledWith(l.Info,e,t)}),it("should have the correct LogLevel",()=>{const i=vi.spyOn(o,"_log").mockImplementation(vi.fn());o.debug(e,t),expect(i).toHaveBeenCalledWith(l.Debug,e,t)}),it("should have the correct LogLevel",()=>{const i=vi.spyOn(o,"_log").mockImplementation(vi.fn());o.warn(e,t),expect(i).toHaveBeenCalledWith(l.Warning,e,t)}),it("should have the correct LogLevel",()=>{const i=vi.spyOn(o,"_log").mockImplementation(vi.fn());o.error(e,t),expect(i).toHaveBeenCalledWith(l.Error,e,t)})});
2
2
  //# sourceMappingURL=DefaultLoggerPublisherService.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.ts"],
4
- "sourcesContent": ["import { type Mocked } from \"vitest\";\n\nimport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nimport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\n\nimport { DefaultLoggerPublisherService } from \"./DefaultLoggerPublisherService\";\n\nvi.mock(\"@api/logger-subscriber/service/ConsoleLogger\");\nvi.useFakeTimers().setSystemTime(new Date(\"2024-01-01\"));\n\nlet service: DefaultLoggerPublisherService;\nlet subscriber: Mocked<ConsoleLogger>;\nconst message = \"message\";\nconst tag = \"logger-tag\";\nconst options = { data: { key: \"value\" } };\nconst generatedOptions = { tag, timestamp: Date.now(), ...options };\n\ndescribe(\"LoggerPublisherService\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n subscriber = new ConsoleLogger() as Mocked<ConsoleLogger>;\n service = new DefaultLoggerPublisherService([subscriber], tag);\n });\n\n it(\"should call subscriber.log with the correct log object\", () => {\n service.info(message, options);\n expect(subscriber.log).toHaveBeenCalledWith(\n LogLevel.Info,\n message,\n generatedOptions,\n );\n });\n\n it(\"should call subscriber.log with the correct log object when a tag is provided\", () => {\n const newTag = \"new-tag\";\n service.info(message, { ...options, tag: newTag });\n expect(subscriber.log).toHaveBeenCalledWith(LogLevel.Info, message, {\n ...generatedOptions,\n tag: newTag,\n });\n });\n\n it(\"should call subscriber.log with the correct log object when a timestamp is provided\", () => {\n const newTimestamp = 1;\n service.info(message, { ...options, timestamp: newTimestamp });\n expect(subscriber.log).toHaveBeenCalledWith(LogLevel.Info, message, {\n ...generatedOptions,\n timestamp: newTimestamp,\n });\n });\n\n it(\"should call _log with the correct LogLevel\", () => {\n const spy = vi.spyOn(service, \"_log\").mockImplementation(vi.fn());\n\n service.info(message, options);\n expect(spy).toHaveBeenCalledWith(LogLevel.Info, message, options);\n });\n\n it(\"should have the correct LogLevel\", () => {\n const spy = vi.spyOn(service, \"_log\").mockImplementation(vi.fn());\n\n service.debug(message, options);\n expect(spy).toHaveBeenCalledWith(LogLevel.Debug, message, options);\n });\n\n it(\"should have the correct LogLevel\", () => {\n const spy = vi.spyOn(service, \"_log\").mockImplementation(vi.fn());\n\n service.warn(message, options);\n expect(spy).toHaveBeenCalledWith(LogLevel.Warning, message, options);\n });\n\n it(\"should have the correct LogLevel\", () => {\n const spy = vi.spyOn(service, \"_log\").mockImplementation(vi.fn());\n\n service.error(message, options);\n expect(spy).toHaveBeenCalledWith(LogLevel.Error, message, options);\n });\n});\n"],
5
- "mappings": "AAEA,OAAS,YAAAA,MAAgB,wCACzB,OAAS,iBAAAC,MAAq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AMG,EAAM,GAAG,MAAMP,EAAS,MAAM,EAAE,mBAAmB,GAAG,GAAG,CAAC,EAEhEA,EAAQ,MAAME,EAASE,CAAO,EAC9B,OAAOG,CAAG,EAAE,qBAAqBV,EAAS,MAAOK,EAASE,CAAO,CACnE,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,MAAMG,EAAM,GAAG,MAAMP,EAAS,MAAM,EAAE,mBAAmB,GAAG,GAAG,CAAC,EAEhEA,EAAQ,KAAKE,EAASE,CAAO,EAC7B,OAAOG,CAAG,EAAE,qBAAqBV,EAAS,QAASK,EAASE,CAAO,CACrE,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,MAAMG,EAAM,GAAG,MAAMP,EAAS,MAAM,EAAE,mBAAmB,GAAG,GAAG,CAAC,EAEhEA,EAAQ,MAAME,EAASE,CAAO,EAC9B,OAAOG,CAAG,EAAE,qBAAqBV,EAAS,MAAOK,EAASE,CAAO,CACnE,CAAC,CACH,CAAC",
6
- "names": ["LogLevel", "ConsoleLogger", "DefaultLoggerPublisherService", "service", "subscriber", "message", "tag", "options", "generatedOptions", "newTag", "spy"]
4
+ "sourcesContent": ["import { type Mocked } from \"vitest\";\n\nimport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nimport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\n\nimport { DefaultLoggerPublisherService } from \"./DefaultLoggerPublisherService\";\n\nvi.mock(\"@api/logger-subscriber/service/ConsoleLogger\");\nvi.useFakeTimers().setSystemTime(new Date(\"2024-01-01\"));\n\nlet service: DefaultLoggerPublisherService;\nlet subscriber: Mocked<ConsoleLogger>;\nconst message = \"message\";\nconst tag = \"logger-tag\";\nconst formattedTag = `[${tag}]`;\nconst options = { data: { key: \"value\" } };\nconst generatedOptions = {\n tag: formattedTag,\n timestamp: Date.now(),\n ...options,\n};\n\ndescribe(\"LoggerPublisherService\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n subscriber = new ConsoleLogger() as Mocked<ConsoleLogger>;\n service = new DefaultLoggerPublisherService([subscriber], tag);\n });\n\n it(\"should call subscriber.log with the correct log object\", () => {\n service.info(message, options);\n expect(subscriber.log).toHaveBeenCalledWith(\n LogLevel.Info,\n message,\n generatedOptions,\n );\n });\n\n it(\"should call subscriber.log with the correct log object when a tag is provided in options\", () => {\n const newTag = \"new-tag\";\n service.info(message, { ...options, tag: newTag });\n // Note: options.tag overrides and is formatted\n expect(subscriber.log).toHaveBeenCalledWith(LogLevel.Info, message, {\n ...generatedOptions,\n tag: `[${newTag}]`,\n });\n });\n\n it(\"should call subscriber.log with the correct log object when a timestamp is provided\", () => {\n const newTimestamp = 1;\n service.info(message, { ...options, timestamp: newTimestamp });\n expect(subscriber.log).toHaveBeenCalledWith(LogLevel.Info, message, {\n ...generatedOptions,\n timestamp: newTimestamp,\n });\n });\n\n it(\"should call _log with the correct LogLevel\", () => {\n const spy = vi.spyOn(service, \"_log\").mockImplementation(vi.fn());\n\n service.info(message, options);\n expect(spy).toHaveBeenCalledWith(LogLevel.Info, message, options);\n });\n\n it(\"should have the correct LogLevel\", () => {\n const spy = vi.spyOn(service, \"_log\").mockImplementation(vi.fn());\n\n service.debug(message, options);\n expect(spy).toHaveBeenCalledWith(LogLevel.Debug, message, options);\n });\n\n it(\"should have the correct LogLevel\", () => {\n const spy = vi.spyOn(service, \"_log\").mockImplementation(vi.fn());\n\n service.warn(message, options);\n expect(spy).toHaveBeenCalledWith(LogLevel.Warning, message, options);\n });\n\n it(\"should have the correct LogLevel\", () => {\n const spy = vi.spyOn(service, \"_log\").mockImplementation(vi.fn());\n\n service.error(message, options);\n expect(spy).toHaveBeenCalledWith(LogLevel.Error, message, options);\n });\n});\n"],
5
+ "mappings": "AAEA,OAAS,YAAAA,MAAgB,wCACzB,OAAS,iBAAAC,MAAqB,+CAE9B,OAAS,iCAAAC,MAAqC,kCAE9C,GAAG,KAAK,8CAA8C,EACtD,GAAG,cAAc,EAAE,cAAc,IAAI,KAAK,YAAY,C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hEA,EAAQ,MAAME,EAASG,CAAO,EAC9B,OAAOG,CAAG,EAAE,qBAAqBX,EAAS,MAAOK,EAASG,CAAO,CACnE,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,MAAMG,EAAM,GAAG,MAAMR,EAAS,MAAM,EAAE,mBAAmB,GAAG,GAAG,CAAC,EAEhEA,EAAQ,KAAKE,EAASG,CAAO,EAC7B,OAAOG,CAAG,EAAE,qBAAqBX,EAAS,QAASK,EAASG,CAAO,CACrE,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,MAAMG,EAAM,GAAG,MAAMR,EAAS,MAAM,EAAE,mBAAmB,GAAG,GAAG,CAAC,EAEhEA,EAAQ,MAAME,EAASG,CAAO,EAC9B,OAAOG,CAAG,EAAE,qBAAqBX,EAAS,MAAOK,EAASG,CAAO,CACnE,CAAC,CACH,CAAC",
6
+ "names": ["LogLevel", "ConsoleLogger", "DefaultLoggerPublisherService", "service", "subscriber", "message", "tag", "formattedTag", "options", "generatedOptions", "newTag", "spy"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ function c(n,r){if(typeof n=="bigint")return n.toString();if(Array.isArray(n))return r.has(n)?"[Circular]":(r.add(n),n.map(t=>c(t,r)));if(n!==null&&typeof n=="object"){if(r.has(n))return"[Circular]";r.add(n);const t={};for(const[o,i]of Object.entries(n))t[o]=c(i,r);return t}return n}function e(n){const r=new WeakSet;r.add(n);const t={};for(const[o,i]of Object.entries(n))t[o]=c(i,r);return t}export{e as sanitiseData};
2
+ //# sourceMappingURL=sanitiseData.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/internal/logger-publisher/service/sanitiseData.ts"],
4
+ "sourcesContent": ["function sanitiseValue(value: unknown, seen: WeakSet<object>): unknown {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n if (Array.isArray(value)) {\n if (seen.has(value)) {\n return \"[Circular]\";\n }\n seen.add(value);\n return value.map((v) => sanitiseValue(v, seen));\n }\n if (value !== null && typeof value === \"object\") {\n if (seen.has(value)) {\n return \"[Circular]\";\n }\n seen.add(value);\n const sanitised: Record<string, unknown> = {};\n for (const [key, val] of Object.entries(value)) {\n sanitised[key] = sanitiseValue(val, seen);\n }\n return sanitised;\n }\n return value;\n}\n\n/**\n * Recursively sanitises data for JSON serialisation by converting BigInt values\n * to strings and handling circular references.\n */\nexport function sanitiseData(\n data: Record<string, unknown>,\n): Record<string, unknown> {\n const seen = new WeakSet<object>();\n seen.add(data);\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(data)) {\n result[key] = sanitiseValue(value, seen);\n }\n return result;\n}\n"],
5
+ "mappings": "AAAA,SAASA,EAAcC,EAAgBC,EAAgC,CACrE,GAAI,OAAOD,GAAU,SACnB,OAAOA,EAAM,SAAS,EAExB,GAAI,MAAM,QAAQA,CAAK,EACrB,OAAIC,EAAK,IAAID,CAAK,EACT,cAETC,EAAK,IAAID,CAAK,EACPA,EAAM,IAAKE,GAAMH,EAAcG,EAAGD,CAAI,CAAC,GAEhD,GAAID,IAAU,MAAQ,OAAOA,GAAU,SAAU,CAC/C,GAAIC,EAAK,IAAID,CAAK,EAChB,MAAO,aAETC,EAAK,IAAID,CAAK,EACd,MAAMG,EAAqC,CAAC,EAC5C,SAAW,CAACC,EAAKC,CAAG,IAAK,OAAO,QAAQL,CAAK,EAC3CG,EAAUC,CAAG,EAAIL,EAAcM,EAAKJ,CAAI,EAE1C,OAAOE,CACT,CACA,OAAOH,CACT,CAMO,SAASM,EACdC,EACyB,CACzB,MAAMN,EAAO,IAAI,QACjBA,EAAK,IAAIM,CAAI,EACb,MAAMC,EAAkC,CAAC,EACzC,SAAW,CAACJ,EAAKJ,CAAK,IAAK,OAAO,QAAQO,CAAI,EAC5CC,EAAOJ,CAAG,EAAIL,EAAcC,EAAOC,CAAI,EAEzC,OAAOO,CACT",
6
+ "names": ["sanitiseValue", "value", "seen", "v", "sanitised", "key", "val", "sanitiseData", "data", "result"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{describe as o,expect as e,it as u}from"vitest";import{sanitiseData as s}from"./sanitiseData";o("sanitiseData",()=>{u("should convert BigInt values to strings",()=>{const n=s({value:123456789012345678901234567890n});e(n).toEqual({value:"123456789012345678901234567890"}),e(typeof n.value).toBe("string")}),u("should handle primitive values unchanged",()=>{const n=s({str:"hello",num:42,bool:!0,nil:null,undef:void 0});e(n).toEqual({str:"hello",num:42,bool:!0,nil:null,undef:void 0})}),u("should recursively sanitise arrays",()=>{const t={items:[BigInt(1),"text",BigInt(2)]},n=s(t);e(n).toEqual({items:["1","text","2"]})}),u("should recursively sanitise nested arrays",()=>{const t={nested:[[BigInt(1)],[BigInt(2),[BigInt(3)]]]},n=s(t);e(n).toEqual({nested:[["1"],["2",["3"]]]})}),u("should recursively sanitise objects",()=>{const n=s({amount:1000000000000000000n,name:"test",count:5});e(n).toEqual({amount:"1000000000000000000",name:"test",count:5})}),u("should recursively sanitise nested objects",()=>{const n=s({transaction:{value:100n,gasLimit:21000n,nested:{maxFeePerGas:50000000000n}},metadata:"info"});e(n).toEqual({transaction:{value:"100",gasLimit:"21000",nested:{maxFeePerGas:"50000000000"}},metadata:"info"})}),u("should handle mixed arrays and objects",()=>{const n=s({items:[{value:1n},{value:2n}],total:3n});e(n).toEqual({items:[{value:"1"},{value:"2"}],total:"3"})}),u("should handle empty objects and arrays",()=>{e(s({})).toEqual({}),e(s({arr:[]})).toEqual({arr:[]})}),u("should produce JSON-serialisable output",()=>{const n=s({bigValue:9007199254740991n,nested:{anotherBig:123n}});e(()=>JSON.stringify(n)).not.toThrow(),e(JSON.stringify(n)).toBe('{"bigValue":"9007199254740991","nested":{"anotherBig":"123"}}')}),u("should handle circular reference in object",()=>{const t={name:"test"};t.self=t;const n=s(t);e(n).toEqual({name:"test",self:"[Circular]"}),e(()=>JSON.stringify(n)).not.toThrow()}),u("should handle circular reference in nested object",()=>{const t={level1:{level2:{}}};t.level1.level2=t;const n=s(t);e(n).toEqual({level1:{level2:"[Circular]"}})}),u("should handle circular reference in array",()=>{const t=[1,2];t.push(t);const i=s({items:t});e(i).toEqual({items:[1,2,"[Circular]"]})}),u("should handle same object referenced multiple times (not circular)",()=>{const t={value:42n},i=s({a:t,b:t});e(i).toEqual({a:{value:"42"},b:"[Circular]"})}),u("should handle deeply nested circular reference",()=>{const t={a:{b:{c:{d:{}}}}};t.a.b.c=t;const n=s(t);e(n).toEqual({a:{b:{c:"[Circular]"}}}),e(()=>JSON.stringify(n)).not.toThrow()})});
2
+ //# sourceMappingURL=sanitiseData.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/internal/logger-publisher/service/sanitiseData.test.ts"],
4
+ "sourcesContent": ["import { describe, expect, it } from \"vitest\";\n\nimport { sanitiseData } from \"./sanitiseData\";\n\ndescribe(\"sanitiseData\", () => {\n it(\"should convert BigInt values to strings\", () => {\n const input = { value: BigInt(123456789012345678901234567890n) };\n const result = sanitiseData(input);\n expect(result).toEqual({ value: \"123456789012345678901234567890\" });\n expect(typeof result[\"value\"]).toBe(\"string\");\n });\n\n it(\"should handle primitive values unchanged\", () => {\n const input = {\n str: \"hello\",\n num: 42,\n bool: true,\n nil: null,\n undef: undefined,\n };\n const result = sanitiseData(input);\n expect(result).toEqual({\n str: \"hello\",\n num: 42,\n bool: true,\n nil: null,\n undef: undefined,\n });\n });\n\n it(\"should recursively sanitise arrays\", () => {\n const input = { items: [BigInt(1), \"text\", BigInt(2)] };\n const result = sanitiseData(input);\n expect(result).toEqual({ items: [\"1\", \"text\", \"2\"] });\n });\n\n it(\"should recursively sanitise nested arrays\", () => {\n const input = { nested: [[BigInt(1)], [BigInt(2), [BigInt(3)]]] };\n const result = sanitiseData(input);\n expect(result).toEqual({ nested: [[\"1\"], [\"2\", [\"3\"]]] });\n });\n\n it(\"should recursively sanitise objects\", () => {\n const input = {\n amount: BigInt(1000000000000000000n),\n name: \"test\",\n count: 5,\n };\n const result = sanitiseData(input);\n expect(result).toEqual({\n amount: \"1000000000000000000\",\n name: \"test\",\n count: 5,\n });\n });\n\n it(\"should recursively sanitise nested objects\", () => {\n const input = {\n transaction: {\n value: BigInt(100n),\n gasLimit: BigInt(21000n),\n nested: {\n maxFeePerGas: BigInt(50000000000n),\n },\n },\n metadata: \"info\",\n };\n const result = sanitiseData(input);\n expect(result).toEqual({\n transaction: {\n value: \"100\",\n gasLimit: \"21000\",\n nested: {\n maxFeePerGas: \"50000000000\",\n },\n },\n metadata: \"info\",\n });\n });\n\n it(\"should handle mixed arrays and objects\", () => {\n const input = {\n items: [{ value: BigInt(1n) }, { value: BigInt(2n) }],\n total: BigInt(3n),\n };\n const result = sanitiseData(input);\n expect(result).toEqual({\n items: [{ value: \"1\" }, { value: \"2\" }],\n total: \"3\",\n });\n });\n\n it(\"should handle empty objects and arrays\", () => {\n expect(sanitiseData({})).toEqual({});\n expect(sanitiseData({ arr: [] })).toEqual({ arr: [] });\n });\n\n it(\"should produce JSON-serialisable output\", () => {\n const input = {\n bigValue: BigInt(9007199254740991n),\n nested: {\n anotherBig: BigInt(123n),\n },\n };\n const result = sanitiseData(input);\n expect(() => JSON.stringify(result)).not.toThrow();\n expect(JSON.stringify(result)).toBe(\n '{\"bigValue\":\"9007199254740991\",\"nested\":{\"anotherBig\":\"123\"}}',\n );\n });\n\n it(\"should handle circular reference in object\", () => {\n const input: Record<string, unknown> = { name: \"test\" };\n input[\"self\"] = input;\n const result = sanitiseData(input);\n expect(result).toEqual({ name: \"test\", self: \"[Circular]\" });\n expect(() => JSON.stringify(result)).not.toThrow();\n });\n\n it(\"should handle circular reference in nested object\", () => {\n const input: Record<string, unknown> = {\n level1: {\n level2: {},\n },\n };\n (input[\"level1\"] as Record<string, unknown>)[\"level2\"] = input;\n const result = sanitiseData(input);\n expect(result).toEqual({\n level1: {\n level2: \"[Circular]\",\n },\n });\n });\n\n it(\"should handle circular reference in array\", () => {\n const arr: unknown[] = [1, 2];\n arr.push(arr);\n const input = { items: arr };\n const result = sanitiseData(input);\n expect(result).toEqual({ items: [1, 2, \"[Circular]\"] });\n });\n\n it(\"should handle same object referenced multiple times (not circular)\", () => {\n const shared = { value: BigInt(42n) };\n const input = { a: shared, b: shared };\n const result = sanitiseData(input);\n // Second reference to same object is detected as circular\n expect(result).toEqual({ a: { value: \"42\" }, b: \"[Circular]\" });\n });\n\n it(\"should handle deeply nested circular reference\", () => {\n const input: Record<string, unknown> = {\n a: {\n b: {\n c: {\n d: {},\n },\n },\n },\n };\n ((input[\"a\"] as Record<string, unknown>)[\"b\"] as Record<string, unknown>)[\n \"c\"\n ] = input;\n const result = sanitiseData(input);\n expect(result).toEqual({\n a: {\n b: {\n c: \"[Circular]\",\n },\n },\n });\n expect(() => JSON.stringify(result)).not.toThrow();\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,YAAAA,EAAU,UAAAC,EAAQ,MAAAC,MAAU,SAErC,OAAS,gBAAAC,MAAoB,iBAE7BH,EAAS,eAAgB,IAAM,CAC7BE,EAAG,0CAA2C,IAAM,CAElD,MAAME,EAASD,EADD,CAAE,MAAc,+BAAiC,CAC9B,EACjCF,EAAOG,CAAM,EAAE,QAAQ,CAAE,MAAO,gCAAiC,CAAC,EAClEH,EAAO,OAAOG,EAAO,KAAQ,EAAE,KAAK,QAAQ,CAC9C,CAAC,EAEDF,EAAG,2CAA4C,IAAM,CAQnD,MAAME,EAASD,EAPD,CACZ,IAAK,QACL,IAAK,GACL,KAAM,GACN,IAAK,KACL,MAAO,MACT,CACiC,EACjCF,EAAOG,CAAM,EAAE,QAAQ,CACrB,IAAK,QACL,IAAK,GACL,KAAM,GACN,IAAK,KACL,MAAO,MACT,CAAC,CACH,CAAC,EAEDF,EAAG,qCAAsC,IAAM,CAC7C,MAAMG,EAAQ,CAAE,MAAO,CAAC,OAAO,CAAC,EAAG,OAAQ,OAAO,CAAC,CAAC,CAAE,EAChDD,EAASD,EAAaE,CAAK,EACjCJ,EAAOG,CAAM,EAAE,QAAQ,CAAE,M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QAAQ,CAAE,EAAG,CAAE,MAAO,IAAK,EAAG,EAAG,YAAa,CAAC,CAChE,CAAC,EAEDF,EAAG,iDAAkD,IAAM,CACzD,MAAMG,EAAiC,CACrC,EAAG,CACD,EAAG,CACD,EAAG,CACD,EAAG,CAAC,CACN,CACF,CACF,CACF,EACEA,EAAM,EAAiC,EACvC,EACEA,EACJ,MAAMD,EAASD,EAAaE,CAAK,EACjCJ,EAAOG,CAAM,EAAE,QAAQ,CACrB,EAAG,CACD,EAAG,CACD,EAAG,YACL,CACF,CACF,CAAC,EACDH,EAAO,IAAM,KAAK,UAAUG,CAAM,CAAC,EAAE,IAAI,QAAQ,CACnD,CAAC,CACH,CAAC",
6
+ "names": ["describe", "expect", "it", "sanitiseData", "result", "input", "arr", "shared"]
7
+ }
@@ -1,2 +1,2 @@
1
- import{Left as l}from"purify-ts";import{connectedDeviceStubBuilder as v}from"../../../api/transport/model/TransportConnectedDevice.stub";import{DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS as u}from"../../device-session/data/DeviceSessionRefresherConst";import{deviceSessionStubBuilder as p}from"../../device-session/model/DeviceSession.stub";import{DeviceSessionNotFound as D,ReceiverApduError as S}from"../../device-session/model/Errors";import{DefaultDeviceSessionService as g}from"../../device-session/service/DefaultDeviceSessionService";import{DefaultLoggerPublisherService as x}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as A}from"../../manager-api/data/AxiosManagerApiDataSource";import{DefaultManagerApiService as C}from"../../manager-api/service/DefaultManagerApiService";import{DefaultSecureChannelDataSource as h}from"../../secure-channel/data/DefaultSecureChannelDataSource";import{DefaultSecureChannelService as w}from"../../secure-channel/service/DefaultSecureChannelService";import{SendApduUseCase as i}from"../../send/use-case/SendApduUseCase";vi.mock("@internal/manager-api/data/AxiosManagerApiDataSource");let e,o,m,s,d,a;const t="fakeSessionId";describe("SendApduUseCase",()=>{beforeEach(()=>{e=new x([],"send-apdu-use-case"),o=new g(()=>e),m=new A({}),s=new C(m),d=new h({}),a=new w(d)}),it("should send an APDU to a connected device",async()=>{const r=p({},()=>e,s,a,u);o.addDeviceSession(r);const c=await new i(o,()=>e).execute({sessionId:t,apdu:new Uint8Array([0,1,2,3])});r.close(),expect(r.connectedDevice.sendApdu).toHaveBeenCalledTimes(1),expect(c).toBeDefined()}),it("should throw an error if the deviceSession is not found",async()=>{const n=new i(o,()=>e).execute({sessionId:t,apdu:new Uint8Array([0,1,2,3])});await expect(n).rejects.toBeInstanceOf(D)}),it("should throw an error if the apdu receiver failed",async()=>{const r=v({sendApdu:vi.fn(async()=>Promise.resolve(l(new S)))}),n=p({connectedDevice:r},()=>e,s,a,u);o.addDeviceSession(n);const f=new i(o,()=>e).execute({sessionId:t,apdu:new Uint8Array([0,1,2,3])});n.close(),await expect(f).rejects.toBeInstanceOf(S)})});
1
+ import{Left as u,Right as d}from"purify-ts";import{ApduResponse as v}from"../../../api/device-session/ApduResponse";import{DeviceSessionNotFound as p,ReceiverApduError as l}from"../../device-session/model/Errors";import{DefaultLoggerPublisherService as m}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{SendApduUseCase as a}from"../../send/use-case/SendApduUseCase";let t,e,o;const i="fakeSessionId";describe("SendApduUseCase",()=>{beforeEach(()=>{t=new m([],"send-apdu-use-case"),o={sendApdu:vi.fn()},e={getDeviceSessionById:vi.fn()}}),it("should send an APDU to a connected device",async()=>{const s=new Uint8Array([0,1,2,3]),n=new v({statusCode:new Uint8Array([144,0]),data:new Uint8Array([])});vi.mocked(e.getDeviceSessionById).mockReturnValue(d(o)),vi.mocked(o.sendApdu).mockResolvedValue(d(n));const c=await new a(e,()=>t).execute({sessionId:i,apdu:s});expect(e.getDeviceSessionById).toHaveBeenCalledWith(i),expect(o.sendApdu).toHaveBeenCalledWith(s,{abortTimeout:void 0,triggersDisconnection:void 0}),expect(c).toBe(n)}),it("should throw an error if the deviceSession is not found",async()=>{const s=new p;vi.mocked(e.getDeviceSessionById).mockReturnValue(u(s));const r=new a(e,()=>t).execute({sessionId:i,apdu:new Uint8Array([0,1,2,3])});await expect(r).rejects.toBe(s),expect(e.getDeviceSessionById).toHaveBeenCalledWith(i)}),it("should throw an error if the apdu receiver failed",async()=>{const s=new Uint8Array([0,1,2,3]),n=new l;vi.mocked(e.getDeviceSessionById).mockReturnValue(d(o)),vi.mocked(o.sendApdu).mockResolvedValue(u(n));const c=new a(e,()=>t).execute({sessionId:i,apdu:s});await expect(c).rejects.toBe(n),expect(e.getDeviceSessionById).toHaveBeenCalledWith(i),expect(o.sendApdu).toHaveBeenCalledWith(s,{abortTimeout:void 0,triggersDisconnection:void 0})})});
2
2
  //# sourceMappingURL=SendApduUseCase.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/send/use-case/SendApduUseCase.test.ts"],
4
- "sourcesContent": ["import { Left } from \"purify-ts\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport {\n DeviceSessionNotFound,\n ReceiverApduError,\n} from \"@internal/device-session/model/Errors\";\nimport { DefaultDeviceSessionService } from \"@internal/device-session/service/DefaultDeviceSessionService\";\nimport { type DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport { AxiosManagerApiDataSource } from \"@internal/manager-api/data/AxiosManagerApiDataSource\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { type SecureChannelDataSource } from \"@internal/secure-channel/data/SecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\nimport { SendApduUseCase } from \"@internal/send/use-case/SendApduUseCase\";\n\nvi.mock(\"@internal/manager-api/data/AxiosManagerApiDataSource\");\n\nlet logger: LoggerPublisherService;\nlet sessionService: DeviceSessionService;\nlet managerApiDataSource: ManagerApiDataSource;\nlet managerApi: ManagerApiService;\nlet secureChannelDataSource: SecureChannelDataSource;\nlet secureChannel: SecureChannelService;\nconst fakeSessionId = \"fakeSessionId\";\n\ndescribe(\"SendApduUseCase\", () => {\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService([], \"send-apdu-use-case\");\n sessionService = new DefaultDeviceSessionService(() => logger);\n managerApiDataSource = new AxiosManagerApiDataSource({} as DmkConfig);\n managerApi = new DefaultManagerApiService(managerApiDataSource);\n secureChannelDataSource = new DefaultSecureChannelDataSource(\n {} as DmkConfig,\n );\n secureChannel = new DefaultSecureChannelService(secureChannelDataSource);\n });\n\n it(\"should send an APDU to a connected device\", async () => {\n // given\n const deviceSession = deviceSessionStubBuilder(\n {},\n () => logger,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n sessionService.addDeviceSession(deviceSession);\n const useCase = new SendApduUseCase(sessionService, () => logger);\n\n // when\n const response = await useCase.execute({\n sessionId: fakeSessionId,\n apdu: new Uint8Array([0x00, 0x01, 0x02, 0x03]),\n });\n\n deviceSession.close();\n // then\n expect(deviceSession.connectedDevice.sendApdu).toHaveBeenCalledTimes(1);\n expect(response).toBeDefined();\n });\n\n it(\"should throw an error if the deviceSession is not found\", async () => {\n // given\n const useCase = new SendApduUseCase(sessionService, () => logger);\n\n // when\n const response = useCase.execute({\n sessionId: fakeSessionId,\n apdu: new Uint8Array([0x00, 0x01, 0x02, 0x03]),\n });\n\n // then\n await expect(response).rejects.toBeInstanceOf(DeviceSessionNotFound);\n });\n\n it(\"should throw an error if the apdu receiver failed\", async () => {\n // given\n const connectedDevice = connectedDeviceStubBuilder({\n sendApdu: vi.fn(async () =>\n Promise.resolve(Left(new ReceiverApduError())),\n ),\n });\n const deviceSession = deviceSessionStubBuilder(\n { connectedDevice },\n () => logger,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n sessionService.addDeviceSession(deviceSession);\n const useCase = new SendApduUseCase(sessionService, () => logger);\n\n // when\n const response = useCase.execute({\n sessionId: fakeSessionId,\n apdu: new Uint8Array([0x00, 0x01, 0x02, 0x03]),\n });\n\n deviceSession.close();\n\n // then\n await expect(response).rejects.toBeInstanceOf(ReceiverApduError);\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,QAAAA,MAAY,YAIrB,OAAS,8BAAAC,MAAkC,qDAC3C,OAAS,4CAAAC,MAAgD,4DACzD,OAAS,4BAAAC,MAAgC,oDACzC,OACE,yBAAAC,EACA,qBAAAC,MACK,wCACP,OAAS,+BAAAC,MAAmC,+DAE5C,OAAS,iCAAAC,MAAqC,mEAC9C,OAAS,6BAAAC,MAAiC,uDAE1C,OAAS,4BAAAC,MAAgC,yDAEzC,OAAS,kCAAAC,MAAsC,+DAE/C,OAAS,+BAAAC,MAAmC,+DAE5C,OAAS,mBAAAC,MAAuB,0CAEhC,GAAG,KAAK,sDAAsD,EAE9D,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACJ,MAAMC,EAAgB,gBAEtB,SAAS,kBAAmB,IAAM,CAChC,WAAW,IAAM,CACfN,EAAS,IAAIN,EAA8B,CAAC,EAAG,oBAAoB,EACnEO,EAAiB,IAAIR,EAA4B,IAAMO,CAAM,EAC7DE,EAAuB,IAAIP,EAA0B,CAAC,CAAc,EACpEQ,EAAa,IAAI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AAQ,eAAehB,CAAiB,CACjE,CAAC,CACH,CAAC",
6
- "names": ["Left", "connectedDeviceStubBuilder", "DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS", "deviceSessionStubBuilder", "DeviceSessionNotFound", "ReceiverApduError", "DefaultDeviceSessionService", "DefaultLoggerPublisherService", "AxiosManagerApiDataSource", "DefaultManagerApiService", "DefaultSecureChannelDataSource", "DefaultSecureChannelService", "SendApduUseCase", "logger", "sessionService", "managerApiDataSource", "managerApi", "secureChannelDataSource", "secureChannel", "fakeSessionId", "deviceSession", "response", "connectedDevice"]
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type DeviceSession } from \"@internal/device-session/model/DeviceSession\";\nimport {\n DeviceSessionNotFound,\n ReceiverApduError,\n} from \"@internal/device-session/model/Errors\";\nimport { type DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport { SendApduUseCase } from \"@internal/send/use-case/SendApduUseCase\";\n\nlet logger: LoggerPublisherService;\nlet sessionService: DeviceSessionService;\nlet mockDeviceSession: DeviceSession;\nconst fakeSessionId = \"fakeSessionId\";\n\ndescribe(\"SendApduUseCase\", () => {\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService([], \"send-apdu-use-case\");\n\n // Mock DeviceSession with sendApdu method\n mockDeviceSession = {\n sendApdu: vi.fn(),\n } as unknown as DeviceSession;\n\n // Mock DeviceSessionService\n sessionService = {\n getDeviceSessionById: vi.fn(),\n } as unknown as DeviceSessionService;\n });\n\n it(\"should send an APDU to a connected device\", async () => {\n // given\n const apdu = new Uint8Array([0x00, 0x01, 0x02, 0x03]);\n const expectedResponse = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: new Uint8Array([]),\n });\n\n vi.mocked(sessionService.getDeviceSessionById).mockReturnValue(\n Right(mockDeviceSession),\n );\n vi.mocked(mockDeviceSession.sendApdu).mockResolvedValue(\n Right(expectedResponse),\n );\n\n const useCase = new SendApduUseCase(sessionService, () => logger);\n\n // when\n const response = await useCase.execute({\n sessionId: fakeSessionId,\n apdu,\n });\n\n // then\n expect(sessionService.getDeviceSessionById).toHaveBeenCalledWith(\n fakeSessionId,\n );\n expect(mockDeviceSession.sendApdu).toHaveBeenCalledWith(apdu, {\n abortTimeout: undefined,\n triggersDisconnection: undefined,\n });\n expect(response).toBe(expectedResponse);\n });\n\n it(\"should throw an error if the deviceSession is not found\", async () => {\n // given\n const notFoundError = new DeviceSessionNotFound();\n vi.mocked(sessionService.getDeviceSessionById).mockReturnValue(\n Left(notFoundError),\n );\n\n const useCase = new SendApduUseCase(sessionService, () => logger);\n\n // when\n const response = useCase.execute({\n sessionId: fakeSessionId,\n apdu: new Uint8Array([0x00, 0x01, 0x02, 0x03]),\n });\n\n // then\n await expect(response).rejects.toBe(notFoundError);\n expect(sessionService.getDeviceSessionById).toHaveBeenCalledWith(\n fakeSessionId,\n );\n });\n\n it(\"should throw an error if the apdu receiver failed\", async () => {\n // given\n const apdu = new Uint8Array([0x00, 0x01, 0x02, 0x03]);\n const receiverError = new ReceiverApduError();\n\n vi.mocked(sessionService.getDeviceSessionById).mockReturnValue(\n Right(mockDeviceSession),\n );\n vi.mocked(mockDeviceSession.sendApdu).mockResolvedValue(\n Left(receiverError),\n );\n\n const useCase = new SendApduUseCase(sessionService, () => logger);\n\n // when\n const response = useCase.execute({\n sessionId: fakeSessionId,\n apdu,\n });\n\n // then\n await expect(response).rejects.toBe(receiverError);\n expect(sessionService.getDeviceSessionById).toHaveBeenCalledWith(\n fakeSessionId,\n );\n expect(mockDeviceSession.sendApdu).toHaveBeenCalledWith(apdu, {\n abortTimeout: undefined,\n triggersDisconnection: undefined,\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAA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B,UAAWG,EACX,KAAM,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,CAC/C,CAAC,EAGD,MAAM,OAAOG,CAAQ,EAAE,QAAQ,KAAKC,CAAa,EACjD,OAAON,EAAe,oBAAoB,EAAE,qBAC1CE,CACF,CACF,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,MAAMC,EAAO,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EAC9CI,EAAgB,IAAIX,EAE1B,GAAG,OAAOI,EAAe,oBAAoB,EAAE,gBAC7CP,EAAMQ,CAAiB,CACzB,EACA,GAAG,OAAOA,EAAkB,QAAQ,EAAE,kBACpCT,EAAKe,CAAa,CACpB,EAKA,MAAMF,EAHU,IAAIP,EAAgBE,EAAgB,IAAMD,CAAM,EAGvC,QAAQ,CAC/B,UAAWG,EACX,KAAAC,CACF,CAAC,EAGD,MAAM,OAAOE,CAAQ,EAAE,QAAQ,KAAKE,CAAa,EACjD,OAAOP,EAAe,oBAAoB,EAAE,qBAC1CE,CACF,EACA,OAAOD,EAAkB,QAAQ,EAAE,qBAAqBE,EAAM,CAC5D,aAAc,OACd,sBAAuB,MACzB,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["Left", "Right", "ApduResponse", "DeviceSessionNotFound", "ReceiverApduError", "DefaultLoggerPublisherService", "SendApduUseCase", "logger", "sessionService", "mockDeviceSession", "fakeSessionId", "apdu", "expectedResponse", "response", "notFoundError", "receiverError"]
7
7
  }
@@ -8,6 +8,7 @@ import { type DeviceSessionState } from "./device-session/DeviceSessionState";
8
8
  import { type DeviceSessionId } from "./device-session/types";
9
9
  import { type ConnectedDevice } from "./transport/model/ConnectedDevice";
10
10
  import { type ConnectUseCaseArgs, type DisconnectUseCaseArgs, type DiscoveredDevice, type GetConnectedDeviceUseCaseArgs, type LoggerPublisherService, type SendApduUseCaseArgs, type StartDiscoveringUseCaseArgs } from "./types";
11
+ import { type UnsafeBypassIntentQueueUseCaseArgs } from "../internal/device-session/use-case/UnsafeBypassIntentQueueUseCase";
11
12
  import { type ListenToAvailableDevicesUseCaseArgs } from "../internal/discovery/use-case/ListenToAvailableDevicesUseCase";
12
13
  import { type ReconnectUseCaseArgs } from "../internal/discovery/use-case/ReconnectUseCase";
13
14
  import { type DeviceActionIntermediateValue, type ExecuteDeviceActionReturnType } from "./device-action/DeviceAction";
@@ -133,6 +134,15 @@ export declare class DeviceManagementKit {
133
134
  sessionId: DeviceSessionId;
134
135
  blockerId: string;
135
136
  }): () => void;
137
+ /**
138
+ * UNSAFE: Bypasses the intent queue for a device session.
139
+ * This allows all intents (sendApdu, sendCommand, executeDeviceAction) to execute
140
+ * directly without being queued. Use with extreme caution as this can lead to
141
+ * race conditions and concurrent execution issues.
142
+ *
143
+ * @param {UnsafeBypassIntentQueueUseCaseArgs} args - The device session ID and bypass flag.
144
+ */
145
+ _unsafeBypassIntentQueue(args: UnsafeBypassIntentQueueUseCaseArgs): void;
136
146
  /**
137
147
  * Sets the provider for the manager API.
138
148
  *
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceManagementKit.d.ts","sourceRoot":"","sources":["../../../../src/api/DeviceManagementKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAGvC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,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CAAC;QAC3B,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,MAAM,IAAI;IAQd;;;;;;;OAOG;IACH,wBAAwB,CAAC,IAAI,EAAE,kCAAkC,GAAG,IAAI;IAOxE;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMnC;;OAEG;IACH,WAAW,IAAI,MAAM;IAMrB;;OAEG;IACH,sBAAsB,IAAI,OAAO;IAOjC;;OAEG;IACH,gBAAgB,IAAI,OAAO,CAAC,sBAAsB,CAAC;CAGpD"}
@@ -0,0 +1,17 @@
1
+ import { type Apdu } from "../../apdu/model/Apdu";
2
+ import { type Command } from "../../command/Command";
3
+ import { type CommandResult } from "../../command/model/CommandResult";
4
+ import { type ApduResponse } from "../../device-session/ApduResponse";
5
+ import { type CommandErrorArgs, DeviceExchangeError } from "../../Error";
6
+ export type GetBackgroundImageSizeResponse = number;
7
+ export type GetBackgroundImageSizeErrorCodes = "662e" | "662f";
8
+ export type GetBackgroundImageSizeCommandResult = CommandResult<GetBackgroundImageSizeResponse, GetBackgroundImageSizeErrorCodes>;
9
+ export declare class GetBackgroundImageSizeCommandError extends DeviceExchangeError<GetBackgroundImageSizeErrorCodes> {
10
+ constructor({ message, errorCode, }: CommandErrorArgs<GetBackgroundImageSizeErrorCodes>);
11
+ }
12
+ export declare class GetBackgroundImageSizeCommand implements Command<GetBackgroundImageSizeResponse, void, GetBackgroundImageSizeErrorCodes> {
13
+ readonly name = "getBackgroundImageSize";
14
+ getApdu(): Apdu;
15
+ parseResponse(apduResponse: ApduResponse): GetBackgroundImageSizeCommandResult;
16
+ }
17
+ //# sourceMappingURL=GetBackgroundImageSizeCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetBackgroundImageSizeCommand.d.ts","sourceRoot":"","sources":["../../../../../../src/api/command/os/GetBackgroundImageSizeCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,kCAAkC,CAAC;AAO1C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAExE,MAAM,MAAM,8BAA8B,GAAG,MAAM,CAAC;AAEpD,MAAM,MAAM,gCAAgC,GAAG,MAAM,GAAG,MAAM,CAAC;AAO/D,MAAM,MAAM,mCAAmC,GAAG,aAAa,CAC7D,8BAA8B,EAC9B,gCAAgC,CACjC,CAAC;AAEF,qBAAa,kCAAmC,SAAQ,mBAAmB,CAAC,gCAAgC,CAAC;gBAC/F,EACV,OAAO,EACP,SAAS,GACV,EAAE,gBAAgB,CAAC,gCAAgC,CAAC;CAGtD;AAED,qBAAa,6BACX,YACE,OAAO,CACL,8BAA8B,EAC9B,IAAI,EACJ,gCAAgC,CACjC;IAEH,QAAQ,CAAC,IAAI,4BAA4B;IAEzC,OAAO,IAAI,IAAI;IAUf,aAAa,CACX,YAAY,EAAE,YAAY,GACzB,mCAAmC;CA6BvC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=GetBackgroundImageSizeCommand.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetBackgroundImageSizeCommand.test.d.ts","sourceRoot":"","sources":["../../../../../../src/api/command/os/GetBackgroundImageSizeCommand.test.ts"],"names":[],"mappings":""}
@@ -6,6 +6,7 @@ import { type TransportDeviceModel } from "../device-model/model/DeviceModel";
6
6
  import { type ApduResponse } from "../device-session/ApduResponse";
7
7
  import { type DeviceSessionState } from "../device-session/DeviceSessionState";
8
8
  import { type DmkError } from "../Error";
9
+ import { type LoggerPublisherService } from "../logger-publisher/service/LoggerPublisherService";
9
10
  import { type ManagerApiService } from "../../internal/manager-api/service/ManagerApiService";
10
11
  import { type SecureChannelService } from "../../internal/secure-channel/service/SecureChannelService";
11
12
  import { type DeviceActionState } from "./model/DeviceActionState";
@@ -16,9 +17,9 @@ export type InternalApi = {
16
17
  readonly getDeviceSessionState: () => DeviceSessionState;
17
18
  readonly getDeviceSessionStateObservable: () => Observable<DeviceSessionState>;
18
19
  readonly setDeviceSessionState: (state: DeviceSessionState) => DeviceSessionState;
19
- readonly disableRefresher: (blockerId: string) => () => void;
20
20
  readonly getManagerApiService: () => ManagerApiService;
21
21
  readonly getSecureChannelService: () => SecureChannelService;
22
+ readonly loggerFactory?: (tag: string) => LoggerPublisherService;
22
23
  };
23
24
  export type DeviceActionIntermediateValue = {
24
25
  readonly requiredUserInteraction: string;
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceAction.d.ts","sourceRoot":"","sources":["../../../../../src/api/device-action/DeviceAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,uDAAuD,CAAC;AAElG,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,QAAQ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appings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAYnE,wBAAgB,+BAA+B,IAAI,MAAM,CAAC,WAAW,CAAC,CAYrE"}
1
+ {"version":3,"file":"makeInternalApi.d.ts","sourceRoot":"","sources":["../../../../../../src/api/device-action/__test-utils__/makeInternalApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAenE,wBAAgB,+BAA+B,IAAI,MAAM,CAAC,WAAW,CAAC,CAYrE"}
@@ -15,6 +15,9 @@ export declare enum UserInteractionRequired {
15
15
  SignDelegationAuthorization = "sign-delegation-authorization",
16
16
  Web3ChecksOptIn = "web3-checks-opt-in",
17
17
  VerifySafeAddress = "verify-safe-address",
18
- RegisterWallet = "register-wallet"
18
+ RegisterWallet = "register-wallet",
19
+ ConfirmLoadImage = "confirm-load-image",
20
+ ConfirmCommitImage = "confirm-commit-image",
21
+ ConfirmRemoveImage = "confirm-remove-image"
19
22
  }
20
23
  //# sourceMappingURL=UserInteractionRequired.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserInteractionRequired.d.ts","sourceRoot":"","sources":["../../../../../../src/api/device-action/model/UserInteractionRequired.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,IAAI,SAAS;IACb,YAAY,kBAAkB;IAC9B,qBAAqB,4BAA4B;IACjD,cAAc,qBAAqB;IACnC,eAAe,qBAAqB;IACpC,aAAa,oBAAoB;IACjC,aAAa,oBAAoB;IACjC,aAAa,mBAAmB;IAChC,mBAAmB,0BAA0B;IAC7C,2BAA2B,kCAAkC;IAC7D,eAAe,uBAAuB;IACtC,iBAAiB,wBAAwB;IACzC,cAAc,oBAAoB;CACnC"}
1
+ {"version":3,"file":"UserInteractionRequired.d.ts","sourceRoot":"","sources":["../../../../../../src/api/device-action/model/UserInteractionRequired.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,IAAI,SAAS;IACb,YAAY,kBAAkB;IAC9B,qBAAqB,4BAA4B;IACjD,cAAc,qBAAqB;IACnC,eAAe,qBAAqB;IACpC,aAAa,oBAAoB;IACjC,aAAa,oBAAoB;IACjC,aAAa,mBAAmB;IAChC,mBAAmB,0BAA0B;IAC7C,2BAA2B,kCAAkC;IAC7D,eAAe,uBAAuB;IACtC,iBAAiB,wBAAwB;IACzC,cAAc,oBAAoB;IAClC,gBAAgB,uBAAuB;IACvC,kBAAkB,yBAAyB;IAC3C,kBAAkB,yBAAyB;CAC5C"}
@@ -1,6 +1,7 @@
1
1
  import { type StateMachine, type StateSchema } from "xstate";
2
2
  import { type DeviceAction, type DeviceActionIntermediateValue, type ExecuteDeviceActionReturnType, type InternalApi } from "../../device-action/DeviceAction";
3
3
  import { type DmkError } from "../../Error";
4
+ import { type LoggerPublisherService } from "../../logger-publisher/service/LoggerPublisherService";
4
5
  import { type StateMachineTypes } from "./StateMachineTypes";
5
6
  export type DeviceActionStateMachine<Output, Input, Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, InternalState> = StateMachine<StateMachineTypes<Output, Input, Error, IntermediateValue, InternalState>["context"], // context
6
7
  /**
@@ -24,15 +25,27 @@ StateMachineTypes<Output, Input, Error, IntermediateValue, InternalState>["input
24
25
  export declare abstract class XStateDeviceAction<Output, Input, Error extends DmkError, IntermediateValue extends DeviceActionIntermediateValue, InternalState> implements DeviceAction<Output, Input, Error, IntermediateValue> {
25
26
  readonly input: Input;
26
27
  readonly inspect: boolean;
28
+ protected logger?: LoggerPublisherService;
29
+ protected loggerFactory?: (tag: string) => LoggerPublisherService;
27
30
  /**
28
31
  *
29
32
  * @param input The input for the DeviceAction
30
33
  * @param inspect If true, the state machine will be inspected in the browser
34
+ * @param logger Optional logger for debugging. If provided, input and internal state will be logged on state transitions.
35
+ * @param loggerFactory Optional logger factory for creating loggers with prefixed tags. Takes precedence over logger.
31
36
  */
32
37
  constructor(args: {
33
38
  input: Input;
34
39
  inspect?: boolean;
40
+ logger?: LoggerPublisherService;
41
+ loggerFactory?: (tag: string) => LoggerPublisherService;
35
42
  });
43
+ /**
44
+ * Returns the logger factory to use for creating loggers.
45
+ * Prefers the instance loggerFactory, then internalApi.loggerFactory,
46
+ * and falls back to a no-op logger factory if neither is available.
47
+ */
48
+ protected getLoggerFactory(internalApi: InternalApi): (tag: string) => LoggerPublisherService;
36
49
  protected abstract makeStateMachine(internalAPI: InternalApi): DeviceActionStateMachine<Output, Input, Error, IntermediateValue, InternalState>;
37
50
  _execute(internalApi: InternalApi): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue>;
38
51
  protected _subscribeToStateMachine(stateMachine: DeviceActionStateMachine<Output, Input, Error, IntermediateValue, InternalState>): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue>;
@@ -1 +1 @@
1
- {"version":3,"file":"XStateDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../src/api/device-action/xstate-utils/XStateDeviceAction.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EAClC,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,MAAM,wBAAwB,CAClC,MAAM,EACN,KAAK,EACL,KAAK,SAAS,QAAQ,EACtB,iBAAiB,SAAS,6BAA6B,EACvD,aAAa,IACX,YAAY,CACd,iBAAiB,CACf,MAAM,EACN,KAAK,EACL,KAAK,EACL,iBAAiB,E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ACd,GACA,6BAA6B,CAAC,MAAM,EAAE,KAAK,EAAE,iBAAiB,CAAC;IAqFlE,OAAO,CAAC,wBAAwB;CAIjC"}
1
+ {"version":3,"file":"XStateDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../src/api/device-action/xstate-utils/XStateDeviceAction.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EAClC,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAGnG,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,MAAM,wBAAwB,CAClC,MAAM,EACN,KAAK,EACL,KAAK,SAAS,QAAQ,EACtB,iBAAiB,SAAS,6BAA6B,EACvD,aAAa,IACX,YAAY,CACd,iBAAiB,CACf,MAAM,EACN,KAAK,EACL,KAAK,EACL,iBAAiB,EACjB,aAAa,CACd,CAAC,SAAS,CAAC,EAAE,UAAU;AACxB;;;GAGG;AAEH,GAAG,EAAE,QAAQ;AACb,GAAG,EAAE,WAAW;AAChB,GAAG,EAAE,QAAQ;AACb,GAAG,EAAE,SAAS;AACd,GAAG,EAAE,QAAQ;AACb,GAAG,EAAE,QAAQ;AACb,GAAG,EAAE,cAAc;AACnB,GAAG,EAAE,MAAM;AAEX,iBAAiB,CACf,MAAM,EACN,KAAK,EACL,KAAK,EACL,iBAAiB,EACjB,aAAa,CACd,CAAC,OAAO,CAAC,EACV,iBAAiB,CACf,MAAM,EACN,KAAK,EACL,KAAK,EACL,iBAAiB,EACjB,aAAa,CACd,CAAC,QAAQ,CAAC,EAEX,GAAG,EACH,GAAG,EAEH,WAA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duParser } from "./apdu/utils/ApduParser";
4
4
  export * from "./apdu/utils/AppBuilderError";
5
5
  export { ByteArrayBuilder } from "./apdu/utils/ByteArrayBuilder";
6
6
  export { ByteArrayParser } from "./apdu/utils/ByteArrayParser";
7
+ export { type Command } from "./command/Command";
7
8
  export { InvalidGetFirmwareMetadataResponseError, InvalidStatusWordError, } from "./command/Errors";
8
9
  export { CommandResultFactory, CommandResultStatus, isSuccessCommandResult, } from "./command/model/CommandResult";
9
10
  export { CloseAppCommand } from "./command/os/CloseAppCommand";
10
11
  export { GetAppAndVersionCommand, type GetAppAndVersionResponse, } from "./command/os/GetAppAndVersionCommand";
12
+ export { GetBackgroundImageSizeCommand, GetBackgroundImageSizeCommandError, type GetBackgroundImageSizeCommandResult, type GetBackgroundImageSizeErrorCodes, type GetBackgroundImageSizeResponse, } from "./command/os/GetBackgroundImageSizeCommand";
11
13
  export { BatteryStatusType, type GetBatteryStatusArgs, GetBatteryStatusCommand, type GetBatteryStatusResponse, } from "./command/os/GetBatteryStatusCommand";
12
14
  export { GetOsVersionCommand, type GetOsVersionResponse, } from "./command/os/GetOsVersionCommand";
13
15
  export { type ListAppsArgs, ListAppsCommand, type ListAppsErrorCodes, type ListAppsResponse, } from "./command/os/ListAppsCommand";
@@ -15,17 +17,19 @@ export { type LoadCertificateArgs, LoadCertificateCommand, type LoadCertificateE
15
17
  export { type OpenAppArgs, OpenAppCommand, } from "./command/os/OpenAppCommand";
16
18
  export { isCommandErrorCode } from "./command/utils/CommandErrors";
17
19
  export { CommandUtils } from "./command/utils/CommandUtils";
18
- export { GlobalCommandError, GlobalCommandErrorHandler, } from "./command/utils/GlobalCommandError";
20
+ export { GLOBAL_ERRORS, GlobalCommandError, GlobalCommandErrorHandler, } from "./command/utils/GlobalCommandError";
19
21
  export { DeviceModel, DeviceModelId, LEDGER_VENDOR_ID, } from "./device/DeviceModel";
20
22
  export { DeviceStatus } from "./device/DeviceStatus";
21
23
  export { type InternalApi } from "./device-action/DeviceAction";
22
24
  export { type DeviceActionState, DeviceActionStatus, } from "./device-action/model/DeviceActionState";
23
25
  export { UserInteractionRequired } from "./device-action/model/UserInteractionRequired";
24
26
  export { CallTaskInAppDeviceAction } from "./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction";
25
- export { AppAlreadyInstalledDAError, DeviceLockedError, OutOfMemoryDAError, RefusedByUserDAError, UnknownDAError, UnsupportedFirmwareDAError, } from "./device-action/os/Errors";
27
+ export { DEFAULT_UNLOCK_TIMEOUT_MS } from "./device-action/os/Const";
28
+ export { AppAlreadyInstalledDAError, DeviceLockedError, DeviceNotOnboardedError, OutOfMemoryDAError, RefusedByUserDAError, UnknownDAError, UnsupportedFirmwareDAError, } from "./device-action/os/Errors";
26
29
  export { GetDeviceMetadataDeviceAction } from "./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction";
27
30
  export { GetDeviceStatusDeviceAction } from "./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction";
28
31
  export { GoToDashboardDeviceAction } from "./device-action/os/GoToDashboard/GoToDashboardDeviceAction";
32
+ export type { GoToDashboardDAError, GoToDashboardDAInput, GoToDashboardDAIntermediateValue, GoToDashboardDAOutput, GoToDashboardDARequiredInteraction, GoToDashboardDAState, } from "./device-action/os/GoToDashboard/types";
29
33
  export { InstallOrUpdateAppsDeviceAction } from "./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction";
30
34
  export { ListAppsDeviceAction } from "./device-action/os/ListApps/ListAppsDeviceAction";
31
35
  export { ListAppsWithMetadataDeviceAction } from "./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction";
@@ -50,8 +54,11 @@ export { FramerUtils } from "./device-session/utils/FramerUtils";
50
54
  export { DeviceManagementKit } from "./DeviceManagementKit";
51
55
  export { DeviceManagementKitBuilder } from "./DeviceManagementKitBuilder";
52
56
  export * from "./Error";
57
+ export { noopLogger, noopLoggerFactory, } from "./logger-publisher/utils/noopLoggerFactory";
53
58
  export { LogLevel } from "./logger-subscriber/model/LogLevel";
54
59
  export { ConsoleLogger } from "./logger-subscriber/service/ConsoleLogger";
60
+ export { DefaultLogTagFormatter } from "./logger-subscriber/service/DefaultLogTagFormatter";
61
+ export { type LogTagFormatter } from "./logger-subscriber/service/LogTagFormatter";
55
62
  export { WebLogsExporterLogger } from "./logger-subscriber/service/WebLogsExporterLogger";
56
63
  export { ConnectedDevice } from "./transport/model/ConnectedDevice";
57
64
  export { DeviceConnectionStateMachine, type DeviceConnectionStateMachineParams, } from "./transport/model/DeviceConnectionStateMachine";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EACL,uCAAuC,EACvC,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EACL,uBAAuB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,mBAAmB,EACnB,KAAK,oBAAoB,GAC1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,KAAK,YAAY,EACjB,eAAe,EACf,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