@ledgerhq/device-management-kit 0.6.5 → 0.8.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 (759) hide show
  1. package/README.md +40 -3
  2. package/lib/cjs/package.json +22 -23
  3. package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
  4. package/lib/cjs/src/api/DeviceManagementKit.js.map +3 -3
  5. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  6. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +3 -3
  7. package/lib/cjs/src/api/DeviceManagementKitBuilder.js +1 -1
  8. package/lib/cjs/src/api/DeviceManagementKitBuilder.js.map +2 -2
  9. package/lib/cjs/src/api/DmkConfig.js +1 -1
  10. package/lib/cjs/src/api/DmkConfig.js.map +1 -1
  11. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
  12. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
  13. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
  14. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
  15. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js +1 -1
  16. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
  17. package/lib/cjs/src/api/command/di/commandModule.js +1 -1
  18. package/lib/cjs/src/api/command/di/commandModule.js.map +3 -3
  19. package/lib/cjs/src/api/command/di/commandModule.test.js +1 -1
  20. package/lib/cjs/src/api/command/di/commandModule.test.js.map +2 -2
  21. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js +2 -0
  22. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js.map +7 -0
  23. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js +2 -0
  24. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js.map +7 -0
  25. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js +1 -1
  26. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  27. package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js +1 -1
  28. package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
  29. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.js +2 -0
  30. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.js.map +7 -0
  31. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.test.js +2 -0
  32. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.test.js.map +7 -0
  33. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  34. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  35. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js +1 -1
  36. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js.map +3 -3
  37. package/lib/cjs/src/api/command/utils/CommandUtils.js +1 -1
  38. package/lib/cjs/src/api/command/utils/CommandUtils.js.map +3 -3
  39. package/lib/cjs/src/api/command/utils/CommandUtils.test.js +1 -1
  40. package/lib/cjs/src/api/command/utils/CommandUtils.test.js.map +3 -3
  41. package/lib/cjs/src/api/command/utils/GlobalCommandError.js +1 -1
  42. package/lib/cjs/src/api/command/utils/GlobalCommandError.js.map +2 -2
  43. package/lib/cjs/src/api/device/DeviceModel.js +1 -1
  44. package/lib/cjs/src/api/device/DeviceModel.js.map +2 -2
  45. package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
  46. package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
  47. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  48. package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  49. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  50. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  51. package/lib/cjs/src/api/device-action/di/deviceActionModule.js +1 -1
  52. package/lib/cjs/src/api/device-action/di/deviceActionModule.js.map +3 -3
  53. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js +1 -1
  54. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  55. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
  56. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  57. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  58. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
  59. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  60. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  61. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -1
  62. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +1 -1
  63. package/lib/cjs/src/api/device-action/os/Errors.js +1 -1
  64. package/lib/cjs/src/api/device-action/os/Errors.js.map +3 -3
  65. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +2 -0
  66. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +7 -0
  67. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +2 -0
  68. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +7 -0
  69. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js +2 -0
  70. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +7 -0
  71. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  72. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
  73. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  74. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
  75. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
  76. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
  77. package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js +1 -1
  78. package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js.map +1 -1
  79. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
  80. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
  81. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
  82. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
  83. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +2 -0
  84. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
  85. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
  86. package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +2 -2
  87. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  88. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
  89. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  90. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
  91. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -1
  92. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js.map +1 -1
  93. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
  94. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
  95. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
  96. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
  97. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js +2 -0
  98. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
  99. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  100. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
  101. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  102. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  103. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js +1 -1
  104. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +1 -1
  105. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
  106. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
  107. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
  108. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
  109. package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.js +2 -0
  110. package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.js.map +7 -0
  111. package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.test.js +2 -0
  112. package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.test.js.map +7 -0
  113. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js +2 -0
  114. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js.map +7 -0
  115. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js +2 -0
  116. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +7 -0
  117. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
  118. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
  119. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
  120. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
  121. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  122. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
  123. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.js +1 -1
  124. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.js.map +2 -2
  125. package/lib/cjs/src/api/device-model/model/DeviceModel.js +1 -1
  126. package/lib/cjs/src/api/device-model/model/DeviceModel.js.map +2 -2
  127. package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js +1 -1
  128. package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
  129. package/lib/cjs/src/api/device-session/DeviceSessionState.js +1 -1
  130. package/lib/cjs/src/api/device-session/DeviceSessionState.js.map +2 -2
  131. package/lib/cjs/src/api/index.js +1 -1
  132. package/lib/cjs/src/api/index.js.map +3 -3
  133. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
  134. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  135. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +1 -1
  136. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
  137. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +3 -3
  138. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js +1 -1
  139. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +1 -1
  140. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
  141. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
  142. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
  143. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
  144. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
  145. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +3 -3
  146. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js +1 -1
  147. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +1 -1
  148. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  149. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  150. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
  151. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
  152. package/lib/cjs/src/api/secure-channel/task/types.js +1 -1
  153. package/lib/cjs/src/api/secure-channel/task/types.js.map +2 -2
  154. package/lib/cjs/src/api/secure-channel/utils.js +1 -1
  155. package/lib/cjs/src/api/secure-channel/utils.js.map +3 -3
  156. package/lib/cjs/src/api/secure-channel/utils.test.js +1 -1
  157. package/lib/cjs/src/api/secure-channel/utils.test.js.map +3 -3
  158. package/lib/cjs/src/api/transport/model/DeviceApduSender.js +2 -0
  159. package/lib/cjs/src/api/transport/model/DeviceApduSender.js.map +7 -0
  160. package/lib/cjs/src/api/transport/model/DeviceConnection.js +1 -1
  161. package/lib/cjs/src/api/transport/model/DeviceConnection.js.map +1 -1
  162. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +2 -0
  163. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +7 -0
  164. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js +2 -0
  165. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
  166. package/lib/cjs/src/api/transport/model/DiscoveredDevice.js.map +1 -1
  167. package/lib/cjs/src/api/transport/model/Errors.js +1 -1
  168. package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
  169. package/lib/cjs/src/api/transport/model/Transport.js.map +1 -1
  170. package/lib/cjs/src/api/types.js +1 -1
  171. package/lib/cjs/src/api/types.js.map +1 -1
  172. package/lib/cjs/src/api/utils/AppName.js +2 -0
  173. package/lib/cjs/src/api/utils/AppName.js.map +7 -0
  174. package/lib/cjs/src/api/utils/AppName.test.js +2 -0
  175. package/lib/cjs/src/api/utils/AppName.test.js.map +7 -0
  176. package/lib/cjs/src/di.js +1 -1
  177. package/lib/cjs/src/di.js.map +2 -2
  178. package/lib/cjs/src/internal/config/di/configModule.js +1 -1
  179. package/lib/cjs/src/internal/config/di/configModule.js.map +3 -3
  180. package/lib/cjs/src/internal/config/di/configModule.test.js +1 -1
  181. package/lib/cjs/src/internal/config/di/configModule.test.js.map +2 -2
  182. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js +1 -1
  183. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  184. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  185. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  186. package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js +1 -1
  187. package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js.map +3 -3
  188. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  189. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  190. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  191. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  192. package/lib/cjs/src/internal/device-session/model/DevicePinger.js +1 -1
  193. package/lib/cjs/src/internal/device-session/model/DevicePinger.js.map +3 -3
  194. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  195. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
  196. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
  197. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
  198. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
  199. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +3 -3
  200. package/lib/cjs/src/internal/device-session/model/Frame.js +1 -1
  201. package/lib/cjs/src/internal/device-session/model/Frame.js.map +3 -3
  202. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  203. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  204. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  205. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  206. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.js +1 -1
  207. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.js.map +3 -3
  208. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
  209. package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
  210. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  211. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  212. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  213. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  214. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  215. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +2 -2
  216. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +1 -1
  217. package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +2 -2
  218. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js +1 -1
  219. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +2 -2
  220. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
  221. package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +2 -2
  222. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
  223. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +3 -3
  224. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  225. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  226. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js +1 -1
  227. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  228. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  229. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  230. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  231. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  232. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  233. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  234. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
  235. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
  236. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js +1 -1
  237. package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  238. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  239. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  240. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
  241. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  242. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  243. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  244. package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js +1 -1
  245. package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js.map +2 -2
  246. package/lib/cjs/src/internal/manager-api/model/Application.js +1 -1
  247. package/lib/cjs/src/internal/manager-api/model/Application.js.map +1 -1
  248. package/lib/cjs/src/internal/manager-api/model/Const.js +1 -1
  249. package/lib/cjs/src/internal/manager-api/model/Const.js.map +3 -3
  250. package/lib/cjs/src/internal/manager-api/model/Firmware.js +1 -1
  251. package/lib/cjs/src/internal/manager-api/model/Firmware.js.map +1 -1
  252. package/lib/cjs/src/internal/manager-api/model/Language.js +2 -0
  253. package/lib/cjs/src/internal/manager-api/model/Language.js.map +7 -0
  254. package/lib/cjs/src/internal/manager-api/model/Params.js +1 -1
  255. package/lib/cjs/src/internal/manager-api/model/Params.js.map +1 -1
  256. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  257. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  258. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  259. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  260. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
  261. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
  262. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js +2 -0
  263. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js.map +7 -0
  264. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js +2 -0
  265. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +7 -0
  266. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  267. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  268. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  269. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  270. package/lib/cjs/src/internal/secure-channel/model/Errors.js +1 -1
  271. package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +3 -3
  272. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
  273. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
  274. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +1 -1
  275. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +3 -3
  276. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js +1 -1
  277. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js.map +1 -1
  278. package/lib/cjs/src/internal/send/di/sendModule.js +1 -1
  279. package/lib/cjs/src/internal/send/di/sendModule.js.map +3 -3
  280. package/lib/cjs/src/internal/send/di/sendModule.test.js +1 -1
  281. package/lib/cjs/src/internal/send/di/sendModule.test.js.map +2 -2
  282. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js +1 -1
  283. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
  284. package/lib/cjs/src/internal/transport/di/transportModule.js +1 -1
  285. package/lib/cjs/src/internal/transport/di/transportModule.js.map +3 -3
  286. package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
  287. package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
  288. package/lib/cjs/src/internal/transport/service/DefaultTransportService.js +1 -1
  289. package/lib/cjs/src/internal/transport/service/DefaultTransportService.js.map +3 -3
  290. package/lib/cjs/src/internal/transport/service/TransportService.js +1 -1
  291. package/lib/cjs/src/internal/transport/service/TransportService.js.map +1 -1
  292. package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
  293. package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
  294. package/lib/esm/package.json +22 -23
  295. package/lib/esm/src/api/DeviceManagementKit.js +1 -1
  296. package/lib/esm/src/api/DeviceManagementKit.js.map +3 -3
  297. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  298. package/lib/esm/src/api/DeviceManagementKit.test.js.map +3 -3
  299. package/lib/esm/src/api/DeviceManagementKitBuilder.js +1 -1
  300. package/lib/esm/src/api/DeviceManagementKitBuilder.js.map +3 -3
  301. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
  302. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
  303. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
  304. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
  305. package/lib/esm/src/api/apdu/utils/ByteArrayParser.js +1 -1
  306. package/lib/esm/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
  307. package/lib/esm/src/api/command/di/commandModule.js +1 -1
  308. package/lib/esm/src/api/command/di/commandModule.js.map +3 -3
  309. package/lib/esm/src/api/command/di/commandModule.test.js +1 -1
  310. package/lib/esm/src/api/command/di/commandModule.test.js.map +2 -2
  311. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js +2 -0
  312. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js.map +7 -0
  313. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js +2 -0
  314. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js.map +7 -0
  315. package/lib/esm/src/api/command/os/GetOsVersionCommand.js +1 -1
  316. package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +3 -3
  317. package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js +1 -1
  318. package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
  319. package/lib/esm/src/api/command/os/ListLanguagePackCommand.js +2 -0
  320. package/lib/esm/src/api/command/os/ListLanguagePackCommand.js.map +7 -0
  321. package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js +2 -0
  322. package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js.map +7 -0
  323. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  324. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  325. package/lib/esm/src/api/command/use-case/SendCommandUseCase.js +1 -1
  326. package/lib/esm/src/api/command/use-case/SendCommandUseCase.js.map +3 -3
  327. package/lib/esm/src/api/command/utils/CommandUtils.js +1 -1
  328. package/lib/esm/src/api/command/utils/CommandUtils.js.map +3 -3
  329. package/lib/esm/src/api/command/utils/CommandUtils.test.js +1 -1
  330. package/lib/esm/src/api/command/utils/CommandUtils.test.js.map +3 -3
  331. package/lib/esm/src/api/command/utils/GlobalCommandError.js +1 -1
  332. package/lib/esm/src/api/command/utils/GlobalCommandError.js.map +2 -2
  333. package/lib/esm/src/api/device/DeviceModel.js +1 -1
  334. package/lib/esm/src/api/device/DeviceModel.js.map +2 -2
  335. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
  336. package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
  337. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  338. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  339. package/lib/esm/src/api/device-action/di/deviceActionModule.js +1 -1
  340. package/lib/esm/src/api/device-action/di/deviceActionModule.js.map +3 -3
  341. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js +1 -1
  342. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  343. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
  344. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  345. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  346. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
  347. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  348. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  349. package/lib/esm/src/api/device-action/os/Errors.js +1 -1
  350. package/lib/esm/src/api/device-action/os/Errors.js.map +3 -3
  351. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +2 -0
  352. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +7 -0
  353. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +2 -0
  354. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +7 -0
  355. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js +1 -0
  356. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js.map +7 -0
  357. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  358. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
  359. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  360. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
  361. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
  362. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
  363. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
  364. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
  365. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
  366. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
  367. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -0
  368. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
  369. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
  370. package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +2 -2
  371. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  372. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
  373. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  374. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  375. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
  376. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
  377. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
  378. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
  379. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -0
  380. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
  381. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  382. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
  383. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  384. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  385. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
  386. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
  387. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
  388. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
  389. package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.js +2 -0
  390. package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.js.map +7 -0
  391. package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.test.js +2 -0
  392. package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.test.js.map +7 -0
  393. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js +2 -0
  394. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js.map +7 -0
  395. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js +2 -0
  396. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +7 -0
  397. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
  398. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
  399. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
  400. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
  401. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  402. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
  403. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.js +1 -1
  404. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.js.map +2 -2
  405. package/lib/esm/src/api/device-model/model/DeviceModel.js +1 -1
  406. package/lib/esm/src/api/device-model/model/DeviceModel.js.map +2 -2
  407. package/lib/esm/src/api/device-model/model/DeviceModel.stub.js +1 -1
  408. package/lib/esm/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
  409. package/lib/esm/src/api/device-session/DeviceSessionState.js +1 -1
  410. package/lib/esm/src/api/device-session/DeviceSessionState.js.map +2 -2
  411. package/lib/esm/src/api/index.js +1 -1
  412. package/lib/esm/src/api/index.js.map +3 -3
  413. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
  414. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  415. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
  416. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +3 -3
  417. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
  418. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
  419. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
  420. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
  421. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
  422. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +3 -3
  423. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  424. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  425. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
  426. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
  427. package/lib/esm/src/api/secure-channel/task/types.js +1 -1
  428. package/lib/esm/src/api/secure-channel/task/types.js.map +2 -2
  429. package/lib/esm/src/api/secure-channel/utils.js +1 -1
  430. package/lib/esm/src/api/secure-channel/utils.js.map +3 -3
  431. package/lib/esm/src/api/secure-channel/utils.test.js +1 -1
  432. package/lib/esm/src/api/secure-channel/utils.test.js.map +3 -3
  433. package/lib/esm/src/api/transport/model/DeviceApduSender.js +1 -0
  434. package/lib/esm/src/api/transport/model/DeviceApduSender.js.map +7 -0
  435. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +2 -0
  436. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +7 -0
  437. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js +2 -0
  438. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
  439. package/lib/esm/src/api/transport/model/Errors.js +1 -1
  440. package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
  441. package/lib/esm/src/api/utils/AppName.js +2 -0
  442. package/lib/esm/src/api/utils/AppName.js.map +7 -0
  443. package/lib/esm/src/api/utils/AppName.test.js +2 -0
  444. package/lib/esm/src/api/utils/AppName.test.js.map +7 -0
  445. package/lib/esm/src/di.js +1 -1
  446. package/lib/esm/src/di.js.map +3 -3
  447. package/lib/esm/src/internal/config/di/configModule.js +1 -1
  448. package/lib/esm/src/internal/config/di/configModule.js.map +3 -3
  449. package/lib/esm/src/internal/config/di/configModule.test.js +1 -1
  450. package/lib/esm/src/internal/config/di/configModule.test.js.map +2 -2
  451. package/lib/esm/src/internal/device-model/di/deviceModelModule.js +1 -1
  452. package/lib/esm/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  453. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  454. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  455. package/lib/esm/src/internal/device-session/data/ApduResponseConst.js +1 -1
  456. package/lib/esm/src/internal/device-session/data/ApduResponseConst.js.map +3 -3
  457. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  458. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  459. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  460. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  461. package/lib/esm/src/internal/device-session/model/DevicePinger.js +1 -1
  462. package/lib/esm/src/internal/device-session/model/DevicePinger.js.map +3 -3
  463. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  464. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
  465. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
  466. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
  467. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
  468. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +3 -3
  469. package/lib/esm/src/internal/device-session/model/Frame.js +1 -1
  470. package/lib/esm/src/internal/device-session/model/Frame.js.map +3 -3
  471. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  472. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  473. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  474. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  475. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.js +1 -1
  476. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.js.map +3 -3
  477. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
  478. package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
  479. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  480. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  481. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  482. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  483. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
  484. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +2 -2
  485. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +1 -1
  486. package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +2 -2
  487. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js +1 -1
  488. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +2 -2
  489. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
  490. package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +2 -2
  491. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
  492. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +3 -3
  493. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  494. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  495. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js +1 -1
  496. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  497. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  498. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  499. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  500. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  501. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  502. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  503. package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js +1 -1
  504. package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
  505. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  506. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  507. package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
  508. package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  509. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  510. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  511. package/lib/esm/src/internal/manager-api/di/managerApiTypes.js +1 -1
  512. package/lib/esm/src/internal/manager-api/di/managerApiTypes.js.map +2 -2
  513. package/lib/esm/src/internal/manager-api/model/Application.js +1 -1
  514. package/lib/esm/src/internal/manager-api/model/Application.js.map +1 -1
  515. package/lib/esm/src/internal/manager-api/model/Const.js +1 -1
  516. package/lib/esm/src/internal/manager-api/model/Const.js.map +3 -3
  517. package/lib/esm/src/internal/manager-api/model/Language.js +1 -0
  518. package/lib/esm/src/internal/manager-api/model/Language.js.map +7 -0
  519. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  520. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  521. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  522. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  523. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js +2 -0
  524. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js.map +7 -0
  525. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js +2 -0
  526. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +7 -0
  527. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  528. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  529. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  530. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  531. package/lib/esm/src/internal/secure-channel/model/Errors.js +1 -1
  532. package/lib/esm/src/internal/secure-channel/model/Errors.js.map +3 -3
  533. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
  534. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +1 -1
  535. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +3 -3
  536. package/lib/esm/src/internal/send/di/sendModule.js +1 -1
  537. package/lib/esm/src/internal/send/di/sendModule.js.map +3 -3
  538. package/lib/esm/src/internal/send/di/sendModule.test.js +1 -1
  539. package/lib/esm/src/internal/send/di/sendModule.test.js.map +2 -2
  540. package/lib/esm/src/internal/send/use-case/SendApduUseCase.js +1 -1
  541. package/lib/esm/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
  542. package/lib/esm/src/internal/transport/di/transportModule.js +1 -1
  543. package/lib/esm/src/internal/transport/di/transportModule.js.map +3 -3
  544. package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
  545. package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
  546. package/lib/esm/src/internal/transport/service/DefaultTransportService.js +1 -1
  547. package/lib/esm/src/internal/transport/service/DefaultTransportService.js.map +3 -3
  548. package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
  549. package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
  550. package/lib/types/src/api/DeviceManagementKit.d.ts +11 -1
  551. package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
  552. package/lib/types/src/api/DeviceManagementKitBuilder.d.ts.map +1 -1
  553. package/lib/types/src/api/DmkConfig.d.ts +2 -0
  554. package/lib/types/src/api/DmkConfig.d.ts.map +1 -1
  555. package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts.map +1 -1
  556. package/lib/types/src/api/apdu/utils/ApduParser.d.ts.map +1 -1
  557. package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts +28 -0
  558. package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts.map +1 -1
  559. package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts +1 -0
  560. package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts.map +1 -1
  561. package/lib/types/src/api/command/di/commandModule.d.ts.map +1 -1
  562. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts +16 -0
  563. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts.map +1 -0
  564. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts +2 -0
  565. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts.map +1 -0
  566. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +30 -2
  567. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
  568. package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts +24 -0
  569. package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts.map +1 -0
  570. package/lib/types/src/api/command/os/ListLanguagePackCommand.test.d.ts +2 -0
  571. package/lib/types/src/api/command/os/ListLanguagePackCommand.test.d.ts.map +1 -0
  572. package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
  573. package/lib/types/src/api/command/use-case/SendCommandUseCase.d.ts +5 -1
  574. package/lib/types/src/api/command/use-case/SendCommandUseCase.d.ts.map +1 -1
  575. package/lib/types/src/api/command/utils/CommandErrors.d.ts.map +1 -1
  576. package/lib/types/src/api/command/utils/CommandUtils.d.ts +4 -0
  577. package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
  578. package/lib/types/src/api/command/utils/GlobalCommandError.d.ts +1 -1
  579. package/lib/types/src/api/command/utils/GlobalCommandError.d.ts.map +1 -1
  580. package/lib/types/src/api/device/DeviceModel.d.ts +2 -1
  581. package/lib/types/src/api/device/DeviceModel.d.ts.map +1 -1
  582. package/lib/types/src/api/device-action/DeviceAction.d.ts +3 -1
  583. package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
  584. package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
  585. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts +5 -0
  586. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
  587. package/lib/types/src/api/device-action/di/deviceActionModule.d.ts.map +1 -1
  588. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +1 -0
  589. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
  590. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -1
  591. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +1 -1
  592. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -1
  593. package/lib/types/src/api/device-action/os/Errors.d.ts +20 -0
  594. package/lib/types/src/api/device-action/os/Errors.d.ts.map +1 -1
  595. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts +58 -0
  596. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map +1 -0
  597. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.d.ts +2 -0
  598. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.d.ts.map +1 -0
  599. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +28 -0
  600. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -0
  601. package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
  602. package/lib/types/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.d.ts.map +1 -1
  603. package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts +3 -4
  604. package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts.map +1 -1
  605. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts +40 -0
  606. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -0
  607. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts +2 -0
  608. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts.map +1 -0
  609. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +65 -0
  610. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -0
  611. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts.map +1 -1
  612. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts +0 -1
  613. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
  614. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts +15 -0
  615. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -0
  616. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts +2 -0
  617. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts.map +1 -0
  618. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +24 -0
  619. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -0
  620. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.d.ts.map +1 -1
  621. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts +1 -1
  622. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
  623. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts +30 -0
  624. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -0
  625. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts +2 -0
  626. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts.map +1 -0
  627. package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.d.ts +31 -0
  628. package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.d.ts.map +1 -0
  629. package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.test.d.ts +2 -0
  630. package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.test.d.ts.map +1 -0
  631. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts +18 -0
  632. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts.map +1 -0
  633. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.test.d.ts +2 -0
  634. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.test.d.ts.map +1 -0
  635. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts +21 -0
  636. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts.map +1 -0
  637. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts +2 -0
  638. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts.map +1 -0
  639. package/lib/types/src/api/device-model/data/StaticDeviceModelDataSource.d.ts.map +1 -1
  640. package/lib/types/src/api/device-model/model/DeviceModel.d.ts +2 -0
  641. package/lib/types/src/api/device-model/model/DeviceModel.d.ts.map +1 -1
  642. package/lib/types/src/api/device-model/model/DeviceModel.stub.d.ts.map +1 -1
  643. package/lib/types/src/api/device-session/DeviceSessionState.d.ts +93 -0
  644. package/lib/types/src/api/device-session/DeviceSessionState.d.ts.map +1 -1
  645. package/lib/types/src/api/device-session/service/DefaultApduReceiverService.stub.d.ts.map +1 -1
  646. package/lib/types/src/api/device-session/service/DefaultApduSenderService.stub.d.ts.map +1 -1
  647. package/lib/types/src/api/index.d.ts +6 -1
  648. package/lib/types/src/api/index.d.ts.map +1 -1
  649. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -1
  650. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +2 -1
  651. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -1
  652. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -1
  653. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts +2 -1
  654. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts.map +1 -1
  655. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -1
  656. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts +2 -1
  657. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts.map +1 -1
  658. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts.map +1 -1
  659. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts +2 -1
  660. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -1
  661. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +5 -2
  662. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -1
  663. package/lib/types/src/api/secure-channel/task/types.d.ts +6 -1
  664. package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -1
  665. package/lib/types/src/api/secure-channel/utils.d.ts +0 -11
  666. package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -1
  667. package/lib/types/src/api/transport/model/DeviceApduSender.d.ts +17 -0
  668. package/lib/types/src/api/transport/model/DeviceApduSender.d.ts.map +1 -0
  669. package/lib/types/src/api/transport/model/DeviceConnection.d.ts +2 -1
  670. package/lib/types/src/api/transport/model/DeviceConnection.d.ts.map +1 -1
  671. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +63 -0
  672. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -0
  673. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts +2 -0
  674. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts.map +1 -0
  675. package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts +1 -1
  676. package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts.map +1 -1
  677. package/lib/types/src/api/transport/model/Errors.d.ts +27 -3
  678. package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
  679. package/lib/types/src/api/transport/model/Transport.d.ts +1 -1
  680. package/lib/types/src/api/transport/model/Transport.d.ts.map +1 -1
  681. package/lib/types/src/api/types.d.ts +6 -2
  682. package/lib/types/src/api/types.d.ts.map +1 -1
  683. package/lib/types/src/api/utils/AppName.d.ts +2 -0
  684. package/lib/types/src/api/utils/AppName.d.ts.map +1 -0
  685. package/lib/types/src/api/utils/AppName.test.d.ts +2 -0
  686. package/lib/types/src/api/utils/AppName.test.d.ts.map +1 -0
  687. package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
  688. package/lib/types/src/di.d.ts.map +1 -1
  689. package/lib/types/src/internal/config/di/configModule.d.ts.map +1 -1
  690. package/lib/types/src/internal/device-model/di/deviceModelModule.d.ts.map +1 -1
  691. package/lib/types/src/internal/device-session/data/ApduResponseConst.d.ts +1 -0
  692. package/lib/types/src/internal/device-session/data/ApduResponseConst.d.ts.map +1 -1
  693. package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
  694. package/lib/types/src/internal/device-session/model/DevicePinger.d.ts +1 -1
  695. package/lib/types/src/internal/device-session/model/DevicePinger.d.ts.map +1 -1
  696. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +3 -1
  697. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  698. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
  699. package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts.map +1 -1
  700. package/lib/types/src/internal/device-session/model/Frame.d.ts.map +1 -1
  701. package/lib/types/src/internal/device-session/use-case/CloseSessionsUseCase.d.ts +3 -1
  702. package/lib/types/src/internal/device-session/use-case/CloseSessionsUseCase.d.ts.map +1 -1
  703. package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts.map +1 -1
  704. package/lib/types/src/internal/discovery/di/discoveryModule.d.ts.map +1 -1
  705. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts +1 -1
  706. package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts.map +1 -1
  707. package/lib/types/src/internal/discovery/use-case/StartDiscoveringUseCase.d.ts +1 -1
  708. package/lib/types/src/internal/discovery/use-case/StartDiscoveringUseCase.d.ts.map +1 -1
  709. package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts +4 -2
  710. package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts.map +1 -1
  711. package/lib/types/src/internal/logger-publisher/di/loggerModule.d.ts.map +1 -1
  712. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +24 -5
  713. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +1 -1
  714. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +51 -6
  715. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
  716. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts +104 -18
  717. package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts.map +1 -1
  718. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +7 -0
  719. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
  720. package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
  721. package/lib/types/src/internal/manager-api/di/managerApiTypes.d.ts +1 -0
  722. package/lib/types/src/internal/manager-api/di/managerApiTypes.d.ts.map +1 -1
  723. package/lib/types/src/internal/manager-api/model/Application.d.ts +12 -12
  724. package/lib/types/src/internal/manager-api/model/Application.d.ts.map +1 -1
  725. package/lib/types/src/internal/manager-api/model/Const.d.ts +2 -0
  726. package/lib/types/src/internal/manager-api/model/Const.d.ts.map +1 -1
  727. package/lib/types/src/internal/manager-api/model/Firmware.d.ts +17 -3
  728. package/lib/types/src/internal/manager-api/model/Firmware.d.ts.map +1 -1
  729. package/lib/types/src/internal/manager-api/model/Language.d.ts +12 -0
  730. package/lib/types/src/internal/manager-api/model/Language.d.ts.map +1 -0
  731. package/lib/types/src/internal/manager-api/model/Params.d.ts +20 -6
  732. package/lib/types/src/internal/manager-api/model/Params.d.ts.map +1 -1
  733. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +9 -3
  734. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
  735. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +42 -7
  736. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
  737. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts +13 -0
  738. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts.map +1 -0
  739. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.test.d.ts +2 -0
  740. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.test.d.ts.map +1 -0
  741. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -1
  742. package/lib/types/src/internal/secure-channel/model/Errors.d.ts +22 -2
  743. package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -1
  744. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +2 -2
  745. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts.map +1 -1
  746. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts +3 -3
  747. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -1
  748. package/lib/types/src/internal/send/di/sendModule.d.ts.map +1 -1
  749. package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts +9 -1
  750. package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts.map +1 -1
  751. package/lib/types/src/internal/transport/di/transportModule.d.ts.map +1 -1
  752. package/lib/types/src/internal/transport/service/DefaultTransportService.d.ts +2 -0
  753. package/lib/types/src/internal/transport/service/DefaultTransportService.d.ts.map +1 -1
  754. package/lib/types/src/internal/transport/service/TransportService.d.ts +3 -1
  755. package/lib/types/src/internal/transport/service/TransportService.d.ts.map +1 -1
  756. package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts +1 -0
  757. package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts.map +1 -1
  758. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  759. package/package.json +14 -15
@@ -1,2 +1,2 @@
1
- import{DeviceSessionStateType as o,DeviceStatus as t,isSuccessCommandResult as v}from"../../../api/index";import{SessionEvents as i}from"../../device-session/model/DeviceSessionEventDispatcher";class D{constructor(e,s,n,r,a){this._sessionEventDispatcher=s;this._connectedDevice=n;this._deviceState=r;this.setDeviceSessionState=a;this._subscription=this._sessionEventDispatcher.listen().subscribe(c=>this.mapEventAction(c)),this._logger=e("device-session-state-handler")}_subscription;_logger;_updateDeviceState(e){const s=this._parseDeviceStatus(e);if(s){const{sessionStateType:n,deviceStatus:r,currentApp:a}=s;this.setDeviceSessionState({sessionStateType:n,deviceStatus:r,deviceModelId:this._connectedDevice.deviceModel.id,currentApp:a,installedApps:[],isSecureConnectionAllowed:!1})}}mapEventAction=e=>{switch(e.eventName){case i.COMMAND_SUCCEEDED:return this._updateDeviceState(e.eventData);case i.DEVICE_STATE_UPDATE_BUSY:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:t.BUSY});case i.DEVICE_STATE_UPDATE_LOCKED:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:t.LOCKED});case i.DEVICE_STATE_UPDATE_CONNECTED:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:t.CONNECTED});default:return null}};_parseDeviceStatus(e){return v(e)?{sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:t.CONNECTED,currentApp:{name:e.data.name,version:e.data.version}}:(this._logger.error("Error while parsing APDU response",{data:{parsedResponse:e}}),null)}unsubscribe(){this._subscription.unsubscribe()}}export{D as DeviceSessionStateHandler};
1
+ import{DeviceSessionStateType as o,DeviceStatus as i,isSuccessCommandResult as v}from"../../../api/index";import{SessionEvents as s}from"../../device-session/model/DeviceSessionEventDispatcher";class d{constructor(e,n,a,c,r){this._sessionEventDispatcher=n;this._connectedDevice=a;this._deviceState=c;this.setDeviceSessionState=r;this._subscription=this._sessionEventDispatcher.listen().subscribe(t=>this.mapEventAction(t)),this._logger=e("device-session-state-handler")}_subscription;_logger;_updateDeviceState(e){const n=this._parseDeviceStatus(e);if(n){const{sessionStateType:a,deviceStatus:c,currentApp:r}=n,t=this._deviceState.getValue();t.sessionStateType===o.Connected?this.setDeviceSessionState({sessionStateType:a,deviceStatus:c,deviceModelId:this._connectedDevice.deviceModel.id,currentApp:r,installedApps:[],isSecureConnectionAllowed:!1}):this.setDeviceSessionState({...t,sessionStateType:a,deviceStatus:c,deviceModelId:this._connectedDevice.deviceModel.id,currentApp:r})}}mapEventAction=e=>{switch(e.eventName){case s.COMMAND_SUCCEEDED:return this._updateDeviceState(e.eventData);case s.DEVICE_STATE_UPDATE_BUSY:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:i.BUSY});case s.DEVICE_STATE_UPDATE_LOCKED:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:i.LOCKED});case s.DEVICE_STATE_UPDATE_CONNECTED:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:i.CONNECTED});default:return null}};_parseDeviceStatus(e){return v(e)?{sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:e.data.name,version:e.data.version}}:(this._logger.debug("Error while parsing APDU response",{data:{parsedResponse:e}}),null)}unsubscribe(){this._subscription.unsubscribe()}}export{d as DeviceSessionStateHandler};
2
2
  //# sourceMappingURL=DeviceSessionStateHandler.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/model/DeviceSessionStateHandler.ts"],
4
- "sourcesContent": ["import { type BehaviorSubject, type Subscription } from \"rxjs\";\n\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport {\n DeviceSessionStateType,\n DeviceStatus,\n type GetAppAndVersionResponse,\n isSuccessCommandResult,\n type TransportConnectedDevice,\n} from \"@api/index\";\nimport { type CommandResult, type LoggerPublisherService } from \"@api/types\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nexport type SetDeviceSessionStateFn = (state: DeviceSessionState) => void;\n\ntype NewDeviceStatus = {\n sessionStateType: DeviceSessionStateType;\n deviceStatus: DeviceStatus;\n currentApp: {\n name: string;\n version: string;\n };\n};\n\nexport class DeviceSessionStateHandler {\n private _subscription: Subscription;\n private readonly _logger: LoggerPublisherService;\n\n constructor(\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n private _sessionEventDispatcher: DeviceSessionEventDispatcher,\n private _connectedDevice: TransportConnectedDevice,\n private _deviceState: BehaviorSubject<DeviceSessionState>,\n private setDeviceSessionState: SetDeviceSessionStateFn,\n ) {\n this._subscription = this._sessionEventDispatcher\n .listen()\n .subscribe((event) => this.mapEventAction(event));\n this._logger = loggerModuleFactory(\"device-session-state-handler\");\n }\n\n private _updateDeviceState(\n parsedResponse: CommandResult<GetAppAndVersionResponse>,\n ): void {\n const newDeviceStatus = this._parseDeviceStatus(parsedResponse);\n\n if (newDeviceStatus) {\n const { sessionStateType, deviceStatus, currentApp } = newDeviceStatus;\n\n this.setDeviceSessionState({\n sessionStateType,\n deviceStatus,\n deviceModelId: this._connectedDevice.deviceModel.id,\n currentApp,\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n }\n }\n\n private mapEventAction = (event: NewEvent) => {\n switch (event.eventName) {\n case SessionEvents.COMMAND_SUCCEEDED:\n return this._updateDeviceState(event.eventData);\n case SessionEvents.DEVICE_STATE_UPDATE_BUSY:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.BUSY,\n });\n case SessionEvents.DEVICE_STATE_UPDATE_LOCKED:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.LOCKED,\n });\n case SessionEvents.DEVICE_STATE_UPDATE_CONNECTED:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.CONNECTED,\n });\n default:\n return null;\n }\n };\n\n private _parseDeviceStatus(\n parsedResponse: CommandResult<GetAppAndVersionResponse>,\n ): NewDeviceStatus | null {\n if (isSuccessCommandResult(parsedResponse)) {\n return {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: {\n name: parsedResponse.data.name,\n version: parsedResponse.data.version,\n },\n };\n } else {\n this._logger.error(\"Error while parsing APDU response\", {\n data: { parsedResponse },\n });\n return null;\n }\n }\n\n public unsubscribe(): void {\n this._subscription.unsubscribe();\n }\n}\n"],
5
- "mappings": "AAGA,OACE,0BAAAA,EACA,gBAAAC,EAEA,0BAAAC,MAEK,aAEP,OAGE,iBAAAC,MACK,8DAaA,MAAMC,CAA0B,CAIrC,YACEC,EACQC,EACAC,EACAC,EACAC,EACR,CAJQ,6BAAAH,EACA,sBAAAC,EACA,kBAAAC,EACA,2BAAAC,EAER,KAAK,cAAgB,KAAK,wBACvB,OAAO,EACP,UAAWC,GAAU,KAAK,eAAeA,CAAK,CAAC,EAClD,KAAK,QAAUL,EAAoB,8BAA8B,CACnE,CAdQ,cACS,QAeT,mBACNM,EACM,CACN,MAAMC,EAAkB,KAAK,mBAAmBD,CAAc,EAE9D,GAAIC,EAAiB,CACnB,KAAM,CAAE,iBAAAC,EAAkB,aAAAC,EAAc,WAAAC,CAAW,EAAIH,EAEvD,KAAK,sBAAsB,CACzB,iBAAAC,EACA,aAAAC,EACA,cAAe,KAAK,iBAAiB,YAAY,GACjD,WAAAC,EACA,cAAe,CAAC,EAChB,0BAA2B,EAC7B,CAAC,CACH,CACF,CAEQ,eAAkBL,GAAoB,CAC5C,OAAQA,EAAM,UAAW,CACvB,KAAKP,EAAc,kBACjB,OAAO,KAAK,mBAAmBO,EAAM,SAAS,EAChD,KAAKP,EAAc,yBACjB,OAAO,KAAK,sBAAsB,CAChC,GAAG,KAAK,aAAa,SAAS,EAC9B,aAAcF,EAAa,IAC7B,CAAC,EACH,KAAKE,EAAc,2BACjB,OAAO,KAAK,sBAAsB,CAChC,GAAG,KAAK,aAAa,SAAS,EAC9B,aAAcF,EAAa,MAC7B,CAAC,EACH,KAAKE,EAAc,8BACjB,OAAO,KAAK,sBAAsB,CAChC,GAAG,KAAK,aAAa,SAAS,EAC9B,aAAcF,EAAa,SAC7B,CAAC,EACH,QACE,OAAO,IACX,CACF,EAEQ,mBACNU,EACwB,CACxB,OAAIT,EAAuBS,CAAc,EAChC,CACL,iBAAkBX,EAAuB,0BACzC,aAAcC,EAAa,UAC3B,WAAY,CACV,KAAMU,EAAe,KAAK,KAC1B,QAASA,EAAe,KAAK,OAC/B,CACF,GAEA,KAAK,QAAQ,MAAM,oCAAqC,CACtD,KAAM,CAAE,eAAAA,CAAe,CACzB,CAAC,EACM,KAEX,CAEO,aAAoB,CACzB,KAAK,cAAc,YAAY,CACjC,CACF",
6
- "names": ["DeviceSessionStateType", "DeviceStatus", "isSuccessCommandResult", "SessionEvents", "DeviceSessionStateHandler", "loggerModuleFactory", "_sessionEventDispatcher", "_connectedDevice", "_deviceState", "setDeviceSessionState", "event", "parsedResponse", "newDeviceStatus", "sessionStateType", "deviceStatus", "currentApp"]
4
+ "sourcesContent": ["import { type BehaviorSubject, type Subscription } from \"rxjs\";\n\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport {\n DeviceSessionStateType,\n DeviceStatus,\n type GetAppAndVersionResponse,\n isSuccessCommandResult,\n type TransportConnectedDevice,\n} from \"@api/index\";\nimport { type CommandResult, type LoggerPublisherService } from \"@api/types\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nexport type SetDeviceSessionStateFn = (state: DeviceSessionState) => void;\n\ntype NewDeviceStatus = {\n sessionStateType: DeviceSessionStateType;\n deviceStatus: DeviceStatus;\n currentApp: {\n name: string;\n version: string;\n };\n};\n\nexport class DeviceSessionStateHandler {\n private _subscription: Subscription;\n private readonly _logger: LoggerPublisherService;\n\n constructor(\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n private _sessionEventDispatcher: DeviceSessionEventDispatcher,\n private _connectedDevice: TransportConnectedDevice,\n private _deviceState: BehaviorSubject<DeviceSessionState>,\n private setDeviceSessionState: SetDeviceSessionStateFn,\n ) {\n this._subscription = this._sessionEventDispatcher\n .listen()\n .subscribe((event) => this.mapEventAction(event));\n this._logger = loggerModuleFactory(\"device-session-state-handler\");\n }\n\n private _updateDeviceState(\n parsedResponse: CommandResult<GetAppAndVersionResponse>,\n ): void {\n const newDeviceStatus = this._parseDeviceStatus(parsedResponse);\n\n if (newDeviceStatus) {\n const { sessionStateType, deviceStatus, currentApp } = newDeviceStatus;\n const state = this._deviceState.getValue();\n if (state.sessionStateType === DeviceSessionStateType.Connected) {\n // When device is connected, initialize fields to default values\n this.setDeviceSessionState({\n sessionStateType,\n deviceStatus,\n deviceModelId: this._connectedDevice.deviceModel.id,\n currentApp,\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n } else {\n // When device is ready, keep un-modified state fields\n this.setDeviceSessionState({\n ...state,\n sessionStateType,\n deviceStatus,\n deviceModelId: this._connectedDevice.deviceModel.id,\n currentApp,\n });\n }\n }\n }\n\n private mapEventAction = (event: NewEvent) => {\n switch (event.eventName) {\n case SessionEvents.COMMAND_SUCCEEDED:\n return this._updateDeviceState(event.eventData);\n case SessionEvents.DEVICE_STATE_UPDATE_BUSY:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.BUSY,\n });\n case SessionEvents.DEVICE_STATE_UPDATE_LOCKED:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.LOCKED,\n });\n case SessionEvents.DEVICE_STATE_UPDATE_CONNECTED:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.CONNECTED,\n });\n default:\n return null;\n }\n };\n\n private _parseDeviceStatus(\n parsedResponse: CommandResult<GetAppAndVersionResponse>,\n ): NewDeviceStatus | null {\n if (isSuccessCommandResult(parsedResponse)) {\n return {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: {\n name: parsedResponse.data.name,\n version: parsedResponse.data.version,\n },\n };\n } else {\n this._logger.debug(\"Error while parsing APDU response\", {\n data: { parsedResponse },\n });\n return null;\n }\n }\n\n public unsubscribe(): void {\n this._subscription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,aAAa,SAAS,EAC9B,aAAcF,EAAa,SAC7B,CAAC,EACH,QACE,OAAO,IACX,CACF,EAEQ,mBACNU,EACwB,CACxB,OAAIT,EAAuBS,CAAc,EAChC,CACL,iBAAkBX,EAAuB,0BACzC,aAAcC,EAAa,UAC3B,WAAY,CACV,KAAMU,EAAe,KAAK,KAC1B,QAASA,EAAe,KAAK,OAC/B,CACF,GAEA,KAAK,QAAQ,MAAM,oCAAqC,CACtD,KAAM,CAAE,eAAAA,CAAe,CACzB,CAAC,EACM,KAEX,CAEO,aAAoB,CACzB,KAAK,cAAc,YAAY,CACjC,CACF",
6
+ "names": ["DeviceSessionStateType", "DeviceStatus", "isSuccessCommandResult", "SessionEvents", "DeviceSessionStateHandler", "loggerModuleFactory", "_sessionEventDispatcher", "_connectedDevice", "_deviceState", "setDeviceSessionState", "event", "parsedResponse", "newDeviceStatus", "sessionStateType", "deviceStatus", "currentApp", "state"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{BehaviorSubject as E,Subject as S}from"rxjs";import{CommandResultStatus as u,DeviceModelId as p,DeviceSessionStateType as l,DeviceStatus as o}from"../../../api/index";import{SessionEvents as s}from"../../device-session/model/DeviceSessionEventDispatcher";import{DeviceSessionStateHandler as D}from"./DeviceSessionStateHandler";describe("DeviceSessionStateHandler",()=>{let n,c,i;const v=vi.fn(()=>i);let r,d,t,a;beforeEach(()=>{n=new S,c={listen:()=>n,dispatch:vi.fn()},i={error:vi.fn()},r={deviceModel:{id:"device-model-1"}},d=new E({sessionStateType:l.ReadyWithoutSecureChannel,deviceStatus:o.CONNECTED,deviceModelId:p.NANO_X,currentApp:{name:"",version:""},installedApps:[],isSecureConnectionAllowed:!1}),t=vi.fn(),a=new D(v,c,r,d,t)}),afterEach(()=>{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}),it("updates device state on COMMAND_SUCCEEDED event with a successful response",()=>{const e={data:{name:"TestApp",version:"1.0.0"},status:u.Success};n.next({eventName:s.COMMAND_SUCCEEDED,eventData:e}),expect(t).toHaveBeenCalledWith({sessionStateType:l.ReadyWithoutSecureChannel,deviceStatus:o.CONNECTED,deviceModelId:"device-model-1",currentApp:{name:"TestApp",version:"1.0.0"},installedApps:[],isSecureConnectionAllowed:!1})}),it("updates device state on DEVICE_STATE_UPDATE_BUSY event",()=>{n.next({eventName:s.DEVICE_STATE_UPDATE_BUSY}),expect(t).toHaveBeenCalled();const e=t.mock.calls[0][0];expect(e.deviceStatus).toBe(o.BUSY)}),it("updates device state on DEVICE_STATE_UPDATE_CONNECTED event",()=>{n.next({eventName:s.DEVICE_STATE_UPDATE_CONNECTED}),expect(t).toHaveBeenCalled();const e=t.mock.calls[0][0];expect(e.deviceStatus).toBe(o.CONNECTED)}),it("logs error and does not update state if command result is unsuccessful",()=>{const e={data:null,error:{_tag:"SomeOtherError"}};n.next({eventName:s.COMMAND_SUCCEEDED,eventData:e}),expect(i.error).toHaveBeenCalledWith("Error while parsing APDU response",{data:{parsedResponse:e}}),expect(t).not.toHaveBeenCalled()}),it("does not update state if command result is not a success",()=>{const e={data:null,error:{_tag:"SomeOtherError"}};n.next({eventName:s.COMMAND_SUCCEEDED,eventData:e}),expect(t).not.toHaveBeenCalled()})});
1
+ import{BehaviorSubject as p,Subject as C}from"rxjs";import{expect as e}from"vitest";import{CommandResultStatus as u,DeviceModelId as S,DeviceSessionStateType as r,DeviceStatus as a}from"../../../api/index";import{SessionEvents as i}from"../../device-session/model/DeviceSessionEventDispatcher";import{DeviceSessionStateHandler as D}from"./DeviceSessionStateHandler";describe("DeviceSessionStateHandler",()=>{let t,v,c;const E=vi.fn(()=>c);let l,d,n,o;beforeEach(()=>{t=new C,v={listen:()=>t,dispatch:vi.fn()},c={error:vi.fn(),debug:vi.fn()},l={deviceModel:{id:"device-model-1"}},d=new p({sessionStateType:r.Connected,deviceStatus:a.CONNECTED,deviceModelId:S.NANO_X}),n=vi.fn(),o=new D(E,v,l,d,n)}),afterEach(()=>{o&&typeof o.unsubscribe=="function"&&o.unsubscribe()}),it("updates device state on COMMAND_SUCCEEDED event with a successful response",()=>{const s={data:{name:"TestApp",version:"1.0.0"},status:u.Success};t.next({eventName:i.COMMAND_SUCCEEDED,eventData:s}),e(n).toHaveBeenCalledWith({sessionStateType:r.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,deviceModelId:"device-model-1",currentApp:{name:"TestApp",version:"1.0.0"},installedApps:[],isSecureConnectionAllowed:!1})}),it("updates device state on COMMAND_SUCCEEDED event when device is ready",()=>{d.next({sessionStateType:r.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,deviceModelId:S.NANO_X,currentApp:{name:"",version:""},installedApps:["Bitcoin","Ethereum"],isSecureConnectionAllowed:!0});const s={data:{name:"TestApp",version:"1.0.0"},status:u.Success};t.next({eventName:i.COMMAND_SUCCEEDED,eventData:s}),e(n).toHaveBeenCalledWith({sessionStateType:r.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,deviceModelId:"device-model-1",currentApp:{name:"TestApp",version:"1.0.0"},installedApps:["Bitcoin","Ethereum"],isSecureConnectionAllowed:!0})}),it("updates device state on DEVICE_STATE_UPDATE_BUSY event",()=>{t.next({eventName:i.DEVICE_STATE_UPDATE_BUSY}),e(n).toHaveBeenCalledWith(e.objectContaining({deviceStatus:a.BUSY}))}),it("updates device state on DEVICE_STATE_UPDATE_CONNECTED event",()=>{t.next({eventName:i.DEVICE_STATE_UPDATE_CONNECTED}),e(n).toHaveBeenCalledWith(e.objectContaining({deviceStatus:a.CONNECTED}))}),it("logs error and does not update state if command result is unsuccessful",()=>{const s={data:null,error:{_tag:"SomeOtherError"}};t.next({eventName:i.COMMAND_SUCCEEDED,eventData:s}),e(c.debug).toHaveBeenCalledWith("Error while parsing APDU response",{data:{parsedResponse:s}}),e(n).not.toHaveBeenCalled()}),it("does not update state if command result is not a success",()=>{const s={data:null,error:{_tag:"SomeOtherError"}};t.next({eventName:i.COMMAND_SUCCEEDED,eventData:s}),e(n).not.toHaveBeenCalled()})});
2
2
  //# sourceMappingURL=DeviceSessionStateHandler.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/model/DeviceSessionStateHandler.test.ts"],
4
- "sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\nimport { BehaviorSubject, Subject } from \"rxjs\";\n\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport {\n CommandResultStatus,\n DeviceModelId,\n DeviceSessionStateType,\n DeviceStatus,\n} from \"@api/index\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nimport { DeviceSessionStateHandler } from \"./DeviceSessionStateHandler\";\n\ndescribe(\"DeviceSessionStateHandler\", () => {\n let fakeEventSubject: Subject<NewEvent>;\n let fakeSessionEventDispatcher: DeviceSessionEventDispatcher;\n let mockLogger: {\n error: (message: string, meta?: Record<string, unknown>) => void;\n };\n const mockLoggerModuleFactory = vi.fn(() => mockLogger);\n let fakeConnectedDevice: { deviceModel: { id: string } };\n let deviceState: BehaviorSubject<DeviceSessionState>;\n let setDeviceSessionState: any;\n let handler: DeviceSessionStateHandler;\n\n beforeEach(() => {\n fakeEventSubject = new Subject<NewEvent>();\n //@ts-expect-error mock\n fakeSessionEventDispatcher = {\n listen: () => fakeEventSubject,\n dispatch: vi.fn(),\n };\n\n mockLogger = {\n error: vi.fn(),\n };\n\n fakeConnectedDevice = {\n deviceModel: {\n id: \"device-model-1\",\n },\n };\n\n deviceState = new BehaviorSubject<DeviceSessionState>({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: DeviceModelId.NANO_X,\n currentApp: { name: \"\", version: \"\" },\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n\n setDeviceSessionState = vi.fn();\n\n handler = new DeviceSessionStateHandler(\n //@ts-expect-error mock\n mockLoggerModuleFactory,\n fakeSessionEventDispatcher,\n fakeConnectedDevice,\n deviceState,\n setDeviceSessionState,\n );\n });\n\n afterEach(() => {\n if (handler && typeof handler.unsubscribe === \"function\") {\n handler.unsubscribe();\n }\n });\n\n it(\"updates device state on COMMAND_SUCCEEDED event with a successful response\", () => {\n // Given\n const fakeCommandResult = {\n data: {\n name: \"TestApp\",\n version: \"1.0.0\",\n },\n status: CommandResultStatus.Success,\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: \"device-model-1\",\n currentApp: { name: \"TestApp\", version: \"1.0.0\" },\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n });\n\n it(\"updates device state on DEVICE_STATE_UPDATE_BUSY event\", () => {\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_BUSY,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalled();\n const callArg = setDeviceSessionState.mock.calls[0][0];\n expect(callArg.deviceStatus).toBe(DeviceStatus.BUSY);\n });\n\n it(\"updates device state on DEVICE_STATE_UPDATE_CONNECTED event\", () => {\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalled();\n const callArg = setDeviceSessionState.mock.calls[0][0];\n expect(callArg.deviceStatus).toBe(DeviceStatus.CONNECTED);\n });\n\n it(\"logs error and does not update state if command result is unsuccessful\", () => {\n // Given\n const fakeErrorCommandResult = {\n data: null,\n error: { _tag: \"SomeOtherError\" },\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeErrorCommandResult,\n });\n\n // Then\n expect(mockLogger.error).toHaveBeenCalledWith(\n \"Error while parsing APDU response\",\n { data: { parsedResponse: fakeErrorCommandResult } },\n );\n expect(setDeviceSessionState).not.toHaveBeenCalled();\n });\n\n it(\"does not update state if command result is not a success\", () => {\n // Given\n const fakeErrorCommandResult = {\n data: null,\n error: { _tag: \"SomeOtherError\" },\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeErrorCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).not.toHaveBeenCalled();\n });\n});\n"],
5
- "mappings": "AAGA,OAAS,mBAAAA,EAAiB,WAAAC,MAAe,OAGzC,OACE,uBAAAC,EACA,iBAAAC,EACA,0BAAAC,EACA,gBAAAC,MACK,aACP,OAGE,iBAAAC,MACK,8DAEP,OAAS,6BAAAC,MAAiC,8BAE1C,SAAS,4BAA6B,IAAM,CAC1C,IAAIC,EACAC,EACAC,EAGJ,MAAMC,EAA0B,GAAG,GAAG,IAAMD,CAAU,EACtD,IAAIE,EACAC,EACAC,EACAC,EAEJ,WAAW,IAAM,CACfP,EAAmB,IAAIP,EAEvBQ,EAA6B,CAC3B,OAAQ,IAAMD,EACd,SAAU,GAAG,GAAG,CAClB,EAEAE,EAAa,CACX,MAAO,GAAG,GAAG,CACf,EAEAE,EAAsB,CACpB,YAAa,CACX,GAAI,gBACN,CACF,EAEAC,EAAc,IAAIb,EAAoC,CACpD,iBAAkBI,EAAuB,0BACzC,aAAcC,EAAa,UAC3B,cAAeF,EAAc,OAC7B,WAAY,CAAE,KAAM,GAAI,QAAS,EAAG,EACpC,cAAe,CAAC,EAChB,0BAA2B,EAC7B,CAAC,EAEDW,EAAwB,GAAG,GAAG,EAE9BC,EAAU,IAAIR,EAEZI,EACAF,EACAG,EACAC,EACAC,CACF,CACF,CAAC,EAED,UAAU,IAAM,CACVC,GAAW,OAAOA,EAAQ,aAAgB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I,EAAyB,CAC7B,KAAM,KACN,MAAO,CAAE,KAAM,gBAAiB,CAClC,EAGAV,EAAiB,KAAK,CACpB,UAAWF,EAAc,kBAEzB,UAAWY,CACb,CAAC,EAGD,OAAOJ,CAAqB,EAAE,IAAI,iBAAiB,CACrD,CAAC,CACH,CAAC",
6
- "names": ["BehaviorSubject", "Subject", "CommandResultStatus", "DeviceModelId", "DeviceSessionStateType", "DeviceStatus", "SessionEvents", "DeviceSessionStateHandler", "fakeEventSubject", "fakeSessionEventDispatcher", "mockLogger", "mockLoggerModuleFactory", "fakeConnectedDevice", "deviceState", "setDeviceSessionState", "handler", "fakeCommandResult", "callArg", "fakeErrorCommandResult"]
4
+ "sourcesContent": ["import { BehaviorSubject, Subject } from \"rxjs\";\nimport { expect, type Mock } from \"vitest\";\n\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport {\n CommandResultStatus,\n DeviceModelId,\n DeviceSessionStateType,\n DeviceStatus,\n} from \"@api/index\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\n\nimport {\n DeviceSessionStateHandler,\n type SetDeviceSessionStateFn,\n} from \"./DeviceSessionStateHandler\";\n\ndescribe(\"DeviceSessionStateHandler\", () => {\n let fakeEventSubject: Subject<NewEvent>;\n let fakeSessionEventDispatcher: DeviceSessionEventDispatcher;\n let mockLogger: {\n error: (message: string, meta?: Record<string, unknown>) => void;\n debug: (message: string, meta?: Record<string, unknown>) => void;\n };\n const mockLoggerModuleFactory = vi.fn(() => mockLogger);\n let fakeConnectedDevice: { deviceModel: { id: string } };\n let deviceState: BehaviorSubject<DeviceSessionState>;\n let setDeviceSessionState: Mock<SetDeviceSessionStateFn>;\n let handler: DeviceSessionStateHandler;\n\n beforeEach(() => {\n fakeEventSubject = new Subject<NewEvent>();\n //@ts-expect-error mock\n fakeSessionEventDispatcher = {\n listen: () => fakeEventSubject,\n dispatch: vi.fn(),\n };\n\n mockLogger = {\n error: vi.fn(),\n debug: vi.fn(),\n };\n\n fakeConnectedDevice = {\n deviceModel: {\n id: \"device-model-1\",\n },\n };\n\n deviceState = new BehaviorSubject<DeviceSessionState>({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: DeviceModelId.NANO_X,\n });\n\n setDeviceSessionState = vi.fn();\n\n handler = new DeviceSessionStateHandler(\n //@ts-expect-error mock\n mockLoggerModuleFactory,\n fakeSessionEventDispatcher,\n fakeConnectedDevice,\n deviceState,\n setDeviceSessionState,\n );\n });\n\n afterEach(() => {\n if (handler && typeof handler.unsubscribe === \"function\") {\n handler.unsubscribe();\n }\n });\n\n it(\"updates device state on COMMAND_SUCCEEDED event with a successful response\", () => {\n // Given\n const fakeCommandResult = {\n data: {\n name: \"TestApp\",\n version: \"1.0.0\",\n },\n status: CommandResultStatus.Success,\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: \"device-model-1\",\n currentApp: { name: \"TestApp\", version: \"1.0.0\" },\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n });\n\n it(\"updates device state on COMMAND_SUCCEEDED event when device is ready\", () => {\n // Given\n deviceState.next({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: DeviceModelId.NANO_X,\n currentApp: { name: \"\", version: \"\" },\n installedApps: [\"Bitcoin\", \"Ethereum\"] as unknown as Application[],\n isSecureConnectionAllowed: true,\n });\n const fakeCommandResult = {\n data: {\n name: \"TestApp\",\n version: \"1.0.0\",\n },\n status: CommandResultStatus.Success,\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: \"device-model-1\",\n currentApp: { name: \"TestApp\", version: \"1.0.0\" },\n installedApps: [\"Bitcoin\", \"Ethereum\"] as unknown as Application[],\n isSecureConnectionAllowed: true,\n });\n });\n\n it(\"updates device state on DEVICE_STATE_UPDATE_BUSY event\", () => {\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_BUSY,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith(\n expect.objectContaining({ deviceStatus: DeviceStatus.BUSY }),\n );\n });\n\n it(\"updates device state on DEVICE_STATE_UPDATE_CONNECTED event\", () => {\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith(\n expect.objectContaining({ deviceStatus: DeviceStatus.CONNECTED }),\n );\n });\n\n it(\"logs error and does not update state if command result is unsuccessful\", () => {\n // Given\n const fakeErrorCommandResult = {\n data: null,\n error: { _tag: \"SomeOtherError\" },\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeErrorCommandResult,\n });\n\n // Then\n expect(mockLogger.debug).toHaveBeenCalledWith(\n \"Error while parsing APDU response\",\n { data: { parsedResponse: fakeErrorCommandResult } },\n );\n expect(setDeviceSessionState).not.toHaveBeenCalled();\n });\n\n it(\"does not update state if command result is not a success\", () => {\n // Given\n const fakeErrorCommandResult = {\n data: null,\n error: { _tag: \"SomeOtherError\" },\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeErrorCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).not.toHaveBeenCalled();\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,EAAiB,WAAAC,MAAe,OACzC,OAAS,UAAAC,MAAyB,SAGlC,OACE,uBAAAC,EACA,iBAAAC,EACA,0BAAAC,EACA,gBAAAC,MACK,aACP,OAGE,iBAAAC,MACK,8DAGP,OACE,6BAAAC,MAEK,8BAEP,SAAS,4BAA6B,IAAM,CAC1C,IAAIC,EACAC,EACAC,EAIJ,MAAMC,EAA0B,GAAG,GAAG,IAAMD,CAAU,EACtD,IAAIE,EACAC,EACAC,EACAC,EAEJ,WAAW,IAAM,CACfP,EAAmB,IAAIR,EAEvBS,EAA6B,CAC3B,OAAQ,IAAMD,EACd,SAAU,GAAG,GAAG,CAClB,EAEAE,EAAa,CACX,MAAO,GAAG,GAAG,EACb,MAAO,GAAG,GAAG,CACf,EAEAE,EAAsB,CACpB,YAAa,CACX,GAAI,gBACN,CACF,EAEAC,EAAc,IAAId,EAAoC,CACpD,iBAAkBK,EAAuB,UACzC,aAAcC,EAAa,UAC3B,cAAeF,EAAc,MAC/B,CAAC,EAEDW,EAAwB,GAAG,GAAG,EAE9BC,EAAU,IAAIR,EAEZI,EACAF,EACAG,EACAC,EACAC,CACF,CACF,CAAC,EAED,UAAU,IAAM,CACVC,GAAW,OAAOA,EAAQ,aAAgB,YAC5CA,EAAQ,YAAY,CAExB,CAAC,EAED,GAAG,6EAA8E,IAAM,CAErF,MAAMC,EAAoB,CACxB,KAAM,CACJ,KAAM,UACN,QAAS,OACX,EACA,OAAQd,EAAoB,OAC9B,EAGAM,EAAiB,KAAK,CACpB,UAAWF,EAAc,kBAEzB,UAAWU,CACb,CAAC,EAGDf,EAAOa,CAAqB,EAAE,qBAAqB,CACjD,iBAAkBV,EAAuB,0BACzC,aAAcC,EAAa,UAC3B,cAAe,iBACf,WAAY,CAAE,KAAM,UAAW,QAAS,OAAQ,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CAAE,CACrD,EACAhB,EAAOa,CAAqB,EAAE,IAAI,iBAAiB,CACrD,CAAC,EAED,GAAG,2DAA4D,IAAM,CAEnE,MAAMG,EAAyB,CAC7B,KAAM,KACN,MAAO,CAAE,KAAM,gBAAiB,CAClC,EAGAT,EAAiB,KAAK,CACpB,UAAWF,EAAc,kBAEzB,UAAWW,CACb,CAAC,EAGDhB,EAAOa,CAAqB,EAAE,IAAI,iBAAiB,CACrD,CAAC,CACH,CAAC",
6
+ "names": ["BehaviorSubject", "Subject", "expect", "CommandResultStatus", "DeviceModelId", "DeviceSessionStateType", "DeviceStatus", "SessionEvents", "DeviceSessionStateHandler", "fakeEventSubject", "fakeSessionEventDispatcher", "mockLogger", "mockLoggerModuleFactory", "fakeConnectedDevice", "deviceState", "setDeviceSessionState", "handler", "fakeCommandResult", "fakeErrorCommandResult"]
7
7
  }
@@ -1,2 +1,2 @@
1
- class a{_header;_data;constructor({header:t,data:r}){this._header=t,this._data=r}toString(){return JSON.stringify({header:this._header.toString(),data:this._data.toString()},null,2)}getRawData(){const t=this._header.getRawData(),r=new Uint8Array(t.length+this._data.length);return r.set(t,0),r.set(this._data,t.length),r}getHeader(){return this._header}getData(){return this._data}}export{a as Frame};
1
+ import{bufferToHexaString as e}from"../../../api/index";class d{_header;_data;constructor({header:t,data:r}){this._header=t,this._data=r}toString(){return JSON.stringify({header:this._header.toString(),data:e(this._data)},null,2)}getRawData(){const t=this._header.getRawData(),r=new Uint8Array(t.length+this._data.length);return r.set(t,0),r.set(this._data,t.length),r}getHeader(){return this._header}getData(){return this._data}}export{d as Frame};
2
2
  //# sourceMappingURL=Frame.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/model/Frame.ts"],
4
- "sourcesContent": ["import { type FrameHeader } from \"@internal/device-session/model/FrameHeader\";\n\ntype FrameConstructorArgs = {\n header: FrameHeader;\n data: Uint8Array;\n};\n\nexport class Frame {\n protected _header: FrameHeader;\n protected _data: Uint8Array;\n\n constructor({ header, data }: FrameConstructorArgs) {\n this._header = header;\n this._data = data;\n }\n\n toString(): string {\n return JSON.stringify(\n {\n header: this._header.toString(),\n data: this._data.toString(),\n },\n null,\n 2,\n );\n }\n\n getRawData(): Uint8Array {\n const headerRaw = this._header.getRawData();\n const raw = new Uint8Array(headerRaw.length + this._data.length);\n\n raw.set(headerRaw, 0);\n raw.set(this._data, headerRaw.length);\n return raw;\n }\n\n getHeader(): FrameHeader {\n return this._header;\n }\n\n getData(): Uint8Array {\n return this._data;\n }\n}\n"],
5
- "mappings": "AAOO,MAAMA,CAAM,CACP,QACA,MAEV,YAAY,CAAE,OAAAC,EAAQ,KAAAC,CAAK,EAAyB,CAClD,KAAK,QAAUD,EACf,KAAK,MAAQC,CACf,CAEA,UAAmB,CACjB,OAAO,KAAK,UACV,CACE,OAAQ,KAAK,QAAQ,SAAS,EAC9B,KAAM,KAAK,MAAM,SAAS,CAC5B,EACA,KACA,CACF,CACF,CAEA,YAAyB,CACvB,MAAMC,EAAY,KAAK,QAAQ,WAAW,EACpCC,EAAM,IAAI,WAAWD,EAAU,OAAS,KAAK,MAAM,MAAM,EAE/D,OAAAC,EAAI,IAAID,EAAW,CAAC,EACpBC,EAAI,IAAI,KAAK,MAAOD,EAAU,MAAM,EAC7BC,CACT,CAEA,WAAyB,CACvB,OAAO,KAAK,OACd,CAEA,SAAsB,CACpB,OAAO,KAAK,KACd,CACF",
6
- "names": ["Frame", "header", "data", "headerRaw", "raw"]
4
+ "sourcesContent": ["import { bufferToHexaString } from \"@api/index\";\nimport { type FrameHeader } from \"@internal/device-session/model/FrameHeader\";\n\ntype FrameConstructorArgs = {\n header: FrameHeader;\n data: Uint8Array;\n};\n\nexport class Frame {\n protected _header: FrameHeader;\n protected _data: Uint8Array;\n\n constructor({ header, data }: FrameConstructorArgs) {\n this._header = header;\n this._data = data;\n }\n\n toString(): string {\n return JSON.stringify(\n {\n header: this._header.toString(),\n data: bufferToHexaString(this._data),\n },\n null,\n 2,\n );\n }\n\n getRawData(): Uint8Array {\n const headerRaw = this._header.getRawData();\n const raw = new Uint8Array(headerRaw.length + this._data.length);\n\n raw.set(headerRaw, 0);\n raw.set(this._data, headerRaw.length);\n return raw;\n }\n\n getHeader(): FrameHeader {\n return this._header;\n }\n\n getData(): Uint8Array {\n return this._data;\n }\n}\n"],
5
+ "mappings": "AAAA,OAAS,sBAAAA,MAA0B,aAQ5B,MAAMC,CAAM,CACP,QACA,MAEV,YAAY,CAAE,OAAAC,EAAQ,KAAAC,CAAK,EAAyB,CAClD,KAAK,QAAUD,EACf,KAAK,MAAQC,CACf,CAEA,UAAmB,CACjB,OAAO,KAAK,UACV,CACE,OAAQ,KAAK,QAAQ,SAAS,EAC9B,KAAMH,EAAmB,KAAK,KAAK,CACrC,EACA,KACA,CACF,CACF,CAEA,YAAyB,CACvB,MAAMI,EAAY,KAAK,QAAQ,WAAW,EACpCC,EAAM,IAAI,WAAWD,EAAU,OAAS,KAAK,MAAM,MAAM,EAE/D,OAAAC,EAAI,IAAID,EAAW,CAAC,EACpBC,EAAI,IAAI,KAAK,MAAOD,EAAU,MAAM,EAC7BC,CACT,CAEA,WAAyB,CACvB,OAAO,KAAK,OACd,CAEA,SAAsB,CACpB,OAAO,KAAK,KACd,CACF",
6
+ "names": ["bufferToHexaString", "Frame", "header", "data", "headerRaw", "raw"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var _=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var c=(n,r,t,e)=>{for(var i=e>1?void 0:e?A(r,t):r,a=n.length-1,m;a>=0;a--)(m=n[a])&&(i=(e?m(r,t,i):m(i))||i);return e&&i&&_(r,t,i),i},d=(n,r)=>(t,e)=>r(t,e,n);import{inject as b,injectable as H}from"inversify";import{Left as l,Maybe as s,Right as z}from"purify-ts";import{v4 as y}from"uuid";import{APDU_DATA_LENGTH_LENGTH as p,CHANNEL_LENGTH as u,HEAD_TAG as E,HEAD_TAG_LENGTH as L,INDEX_LENGTH as f}from"../../../api/device-session/data/FramerConst";import{FramerUtils as g}from"../../../api/device-session/utils/FramerUtils";import{FramerApduError as v,FramerOverflowError as F}from"../../device-session/model/Errors";import{Frame as T}from"../../device-session/model/Frame";import{FrameHeader as w}from"../../device-session/model/FrameHeader";import{loggerTypes as N}from"../../logger-publisher/di/loggerTypes";let o=class{_frameSize;_channel;_padding;_logger;constructor({frameSize:r,channel:t=s.zero(),padding:e=!1},i){this._frameSize=r,this._channel=t,this._padding=e,this._logger=i("framer")}getFrames(r){const t=[];let e=0,i=this.getFrameAtIndex(r,e);for(;i.isRight();)t.push(i.extract()),e+=1,i=this.getFrameAtIndex(r,e).mapLeft(a=>(a instanceof F?this._logger.debug("Frames parsed",{data:{count:e}}):this._logger.error("Error while parsing frame",{data:{error:a}}),a));return t}getFrameAtIndex(r,t){const e=this.getFrameHeaderFrom(t,r.length),i=t*this._frameSize-this.getHeaderSizeSumFrom(t);if(i>r.length)return l(new F);if(e.getLength()>this._frameSize)return l(new v);const a=this._frameSize-e.getLength(),m=r.slice(t===0?0:i,t===0?a:i+this._frameSize-e.getLength()),h=this._padding?new Uint8Array(a).fill(0):new Uint8Array(m.length<a?m.length:a);h.set(m,0);const S=new T({header:e,data:h});return z(S)}getFrameHeaderFrom(r,t){const e=new w({uuid:y(),channel:this._channel.map(i=>g.getLastBytesFrom(i,u)),headTag:new Uint8Array([E]),index:g.numberToByteArray(r,f),length:this.getFrameHeaderSizeFromIndex(r),dataSize:s.zero()});return r===0&&e.setDataSize(s.of(g.numberToByteArray(t,p))),e}getHeaderSizeSumFrom(r){let t=this.getFrameHeaderSizeFromIndex(0),e=1;for(;e<r;)t+=this.getFrameHeaderSizeFromIndex(e),e+=1;return t}getFrameHeaderSizeFromIndex(r){return this._channel.caseOf({Just:()=>u,Nothing:()=>0})+f+L+(r===0?p:0)}};o=c([H(),d(1,b(N.LoggerPublisherServiceFactory))],o);export{o as DefaultApduSenderService};
1
+ var A=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var c=(m,r,t,e)=>{for(var i=e>1?void 0:e?_(r,t):r,a=m.length-1,n;a>=0;a--)(n=m[a])&&(i=(e?n(r,t,i):n(i))||i);return e&&i&&A(r,t,i),i},d=(m,r)=>(t,e)=>r(t,e,m);import{inject as b,injectable as H}from"inversify";import{Left as l,Maybe as s,Right as z}from"purify-ts";import{v4 as v}from"uuid";import{APDU_DATA_LENGTH_LENGTH as p,CHANNEL_LENGTH as u,HEAD_TAG as y,HEAD_TAG_LENGTH as E,INDEX_LENGTH as f}from"../../../api/device-session/data/FramerConst";import{FramerUtils as g}from"../../../api/device-session/utils/FramerUtils";import{FramerApduError as L,FramerOverflowError as F}from"../../device-session/model/Errors";import{Frame as T}from"../../device-session/model/Frame";import{FrameHeader as w}from"../../device-session/model/FrameHeader";import{loggerTypes as N}from"../../logger-publisher/di/loggerTypes";let o=class{_frameSize;_channel;_padding;_logger;constructor({frameSize:r,channel:t=s.zero(),padding:e=!1},i){this._frameSize=r,this._channel=t,this._padding=e,this._logger=i("DefaultApduSenderService")}getFrames(r){const t=[];let e=0,i=this.getFrameAtIndex(r,e);for(;i.isRight();)t.push(i.extract()),e+=1,i=this.getFrameAtIndex(r,e).mapLeft(a=>(a instanceof F?this._logger.debug("Frames parsed",{data:{count:e}}):this._logger.error("Error while parsing frame",{data:{error:a}}),a));return t}getFrameAtIndex(r,t){const e=this.getFrameHeaderFrom(t,r.length),i=t===0?0:t*this._frameSize-this.getHeaderSizeSumFrom(t);if(i>=r.length)return l(new F);if(e.getLength()>this._frameSize)return l(new L);const a=this._frameSize-e.getLength(),n=r.slice(i,i+this._frameSize-e.getLength()),h=this._padding?new Uint8Array(a).fill(0):new Uint8Array(n.length<a?n.length:a);h.set(n,0);const S=new T({header:e,data:h});return z(S)}getFrameHeaderFrom(r,t){const e=new w({uuid:v(),channel:this._channel.map(i=>g.getLastBytesFrom(i,u)),headTag:new Uint8Array([y]),index:g.numberToByteArray(r,f),length:this.getFrameHeaderSizeFromIndex(r),dataSize:s.zero()});return r===0&&e.setDataSize(s.of(g.numberToByteArray(t,p))),e}getHeaderSizeSumFrom(r){let t=this.getFrameHeaderSizeFromIndex(0),e=1;for(;e<r;)t+=this.getFrameHeaderSizeFromIndex(e),e+=1;return t}getFrameHeaderSizeFromIndex(r){return this._channel.caseOf({Just:()=>u,Nothing:()=>0})+f+E+(r===0?p:0)}};o=c([H(),d(1,b(N.LoggerPublisherServiceFactory))],o);export{o as DefaultApduSenderService};
2
2
  //# sourceMappingURL=DefaultApduSenderService.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/service/DefaultApduSenderService.ts"],
4
- "sourcesContent": ["import { inject, injectable } from \"inversify\";\nimport { Either, Left, Maybe, Right } from \"purify-ts\";\nimport { v4 } from \"uuid\";\n\nimport {\n APDU_DATA_LENGTH_LENGTH,\n CHANNEL_LENGTH,\n HEAD_TAG,\n HEAD_TAG_LENGTH,\n INDEX_LENGTH,\n} from \"@api/device-session/data/FramerConst\";\nimport type {\n ApduSenderService,\n ApduSenderServiceConstructorArgs,\n} from \"@api/device-session/service/ApduSenderService\";\nimport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nimport { LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport {\n FramerApduError,\n FramerOverflowError,\n} from \"@internal/device-session/model/Errors\";\nimport { Frame } from \"@internal/device-session/model/Frame\";\nimport { FrameHeader } from \"@internal/device-session/model/FrameHeader\";\nimport { loggerTypes } from \"@internal/logger-publisher/di/loggerTypes\";\nimport { DmkError } from \"@root/src/api/Error\";\n/**\n * Default implementation of ApduSenderService\n *\n * Split APDU in an array of frames readies to send to a TransportConnectedDevice\n */\n@injectable()\nexport class DefaultApduSenderService implements ApduSenderService {\n protected _frameSize: number;\n protected _channel: Maybe<Uint8Array>;\n protected _padding: boolean;\n private _logger: LoggerPublisherService;\n\n /**\n * Constructor\n *\n * @param frameSize\n * @param channel\n * @param padding\n * @param loggerServiceFactory\n */\n constructor(\n {\n frameSize,\n channel = Maybe.zero(),\n padding = false,\n }: ApduSenderServiceConstructorArgs,\n @inject(loggerTypes.LoggerPublisherServiceFactory)\n loggerServiceFactory: (tag: string) => LoggerPublisherService,\n ) {\n this._frameSize = frameSize;\n this._channel = channel;\n this._padding = padding;\n this._logger = loggerServiceFactory(\"framer\");\n }\n\n /**\n * Get frames from apdu\n *\n * @param apdu\n */\n public getFrames(apdu: Uint8Array): Frame[] {\n const frames: Frame[] = [];\n let count = 0;\n let frame = this.getFrameAtIndex(apdu, count);\n\n while (frame.isRight()) {\n frames.push(frame.extract());\n count += 1;\n frame = this.getFrameAtIndex(apdu, count).mapLeft((error) => {\n if (error instanceof FramerOverflowError) {\n this._logger.debug(\"Frames parsed\", { data: { count } });\n } else {\n this._logger.error(\"Error while parsing frame\", { data: { error } });\n }\n return error;\n });\n }\n return frames;\n }\n\n /**\n * Get apdu frame at index\n * Split every {{PACKET_SIZE - HEADER_SIZE}} bytes of apdu\n * @param apdu\n * @param frameIndex\n * @private\n */\n private getFrameAtIndex(\n apdu: Uint8Array,\n frameIndex: number,\n ): Either<DmkError, Frame> {\n const header = this.getFrameHeaderFrom(frameIndex, apdu.length);\n const frameOffset =\n frameIndex * this._frameSize - this.getHeaderSizeSumFrom(frameIndex);\n\n if (frameOffset > apdu.length) {\n return Left(new FramerOverflowError());\n }\n if (header.getLength() > this._frameSize) {\n return Left(new FramerApduError());\n }\n const dataMaxSize = this._frameSize - header.getLength();\n const data = apdu.slice(\n frameIndex === 0 ? 0 : frameOffset,\n frameIndex === 0\n ? dataMaxSize\n : frameOffset + this._frameSize - header.getLength(),\n );\n const frameData = this._padding\n ? new Uint8Array(dataMaxSize).fill(0)\n : new Uint8Array(data.length < dataMaxSize ? data.length : dataMaxSize);\n frameData.set(data, 0);\n const frame = new Frame({\n header,\n data: frameData,\n });\n return Right(frame);\n }\n\n /**\n * Get frame header\n * @param frameIndex\n * @param apduSize\n * @private\n */\n private getFrameHeaderFrom(\n frameIndex: number,\n apduSize: number,\n ): FrameHeader {\n const header = new FrameHeader({\n uuid: v4(),\n channel: this._channel.map((channel) =>\n FramerUtils.getLastBytesFrom(channel, CHANNEL_LENGTH),\n ),\n headTag: new Uint8Array([HEAD_TAG]),\n index: FramerUtils.numberToByteArray(frameIndex, INDEX_LENGTH),\n length: this.getFrameHeaderSizeFromIndex(frameIndex),\n dataSize: Maybe.zero(),\n });\n if (frameIndex === 0) {\n header.setDataSize(\n Maybe.of(\n FramerUtils.numberToByteArray(apduSize, APDU_DATA_LENGTH_LENGTH),\n ),\n );\n }\n return header;\n }\n\n /**\n * Get frame offset\n * First frame has more bytes of header\n * Padding append means a 0 bytes is added at the end of each frame\n * @private\n * @param frameIndex\n */\n private getHeaderSizeSumFrom(frameIndex: number): number {\n let sum = this.getFrameHeaderSizeFromIndex(0);\n let i = 1;\n while (i < frameIndex) {\n sum += this.getFrameHeaderSizeFromIndex(i);\n i += 1;\n }\n return sum;\n }\n\n /**\n * Get frame header size\n * @private\n * @param frameIndex\n */\n private getFrameHeaderSizeFromIndex(frameIndex: number): number {\n return (\n this._channel.caseOf({\n Just: () => CHANNEL_LENGTH,\n Nothing: () => 0,\n }) +\n INDEX_LENGTH +\n HEAD_TAG_LENGTH +\n (frameIndex === 0 ? APDU_DATA_LENGTH_LENGTH : 0)\n );\n }\n}\n"],
5
- "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,EAAO,SAAAC,MAAa,YAC3C,OAAS,MAAAC,MAAU,OAEnB,OACE,2BAAAC,EACA,kBAAAC,EACA,YAAAC,EACA,mBAAAC,EACA,gBAAAC,MACK,uCAKP,OAAS,eAAAC,MAAmB,wCAE5B,OACE,mBAAAC,EACA,uBAAAC,MACK,wCACP,OAAS,SAAAC,MAAa,uCACtB,OAAS,eAAAC,MAAmB,6CAC5B,OAAS,eAAAC,MAAmB,4CAQrB,IA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IAAID,EAAM,CAAC,EACrB,MAAMT,EAAQ,IAAIW,EAAM,CACtB,OAAAP,EACA,KAAMM,CACR,CAAC,EACD,OAAOE,EAAMZ,CAAK,CACpB,CAQQ,mBACNG,EACAU,EACa,CACb,MAAMT,EAAS,IAAIU,EAAY,CAC7B,KAAMC,EAAG,EACT,QAAS,KAAK,SAAS,IAAKtB,GAC1BuB,EAAY,iBAAiBvB,EAASwB,CAAc,CACtD,EACA,QAAS,IAAI,WAAW,CAACC,CAAQ,CAAC,EAClC,MAAOF,EAAY,kBAAkBb,EAAYgB,CAAY,EAC7D,OAAQ,KAAK,4BAA4BhB,CAAU,EACnD,SAAUT,EAAM,KAAK,CACvB,CAAC,EACD,OAAIS,IAAe,GACjBC,EAAO,YACLV,EAAM,GACJsB,EAAY,kBAAkBH,EAAUO,CAAuB,CACjE,CACF,EAEKhB,CACT,CASQ,qBAAqBD,EAA4B,CACvD,IAAIkB,EAAM,KAAK,4BAA4B,CAAC,EACxCC,EAAI,EACR,KAAOA,EAAInB,GACTkB,GAAO,KAAK,4BAA4BC,CAAC,EACzCA,GAAK,EAEP,OAAOD,CACT,CAOQ,4BAA4BlB,EAA4B,CAC9D,OACE,KAAK,SAAS,OAAO,CACnB,KAAM,IAAMc,EACZ,QAAS,IAAM,CACjB,CAAC,EACDE,EACAI,GACCpB,IAAe,EAAIiB,EAA0B,EAElD,CACF,EA5Ja7B,EAANiC,EAAA,CADNC,EAAW,EAqBPC,EAAA,EAAAC,EAAOC,EAAY,6BAA6B,IApBxCrC",
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\nimport { Either, Left, Maybe, Right } from \"purify-ts\";\nimport { v4 } from \"uuid\";\n\nimport {\n APDU_DATA_LENGTH_LENGTH,\n CHANNEL_LENGTH,\n HEAD_TAG,\n HEAD_TAG_LENGTH,\n INDEX_LENGTH,\n} from \"@api/device-session/data/FramerConst\";\nimport type {\n ApduSenderService,\n ApduSenderServiceConstructorArgs,\n} from \"@api/device-session/service/ApduSenderService\";\nimport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nimport { LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport {\n FramerApduError,\n FramerOverflowError,\n} from \"@internal/device-session/model/Errors\";\nimport { Frame } from \"@internal/device-session/model/Frame\";\nimport { FrameHeader } from \"@internal/device-session/model/FrameHeader\";\nimport { loggerTypes } from \"@internal/logger-publisher/di/loggerTypes\";\nimport { DmkError } from \"@root/src/api/Error\";\n/**\n * Default implementation of ApduSenderService\n *\n * Split APDU in an array of frames readies to send to a TransportConnectedDevice\n */\n@injectable()\nexport class DefaultApduSenderService implements ApduSenderService {\n protected _frameSize: number;\n protected _channel: Maybe<Uint8Array>;\n protected _padding: boolean;\n private _logger: LoggerPublisherService;\n\n /**\n * Constructor\n *\n * @param frameSize\n * @param channel\n * @param padding\n * @param loggerServiceFactory\n */\n constructor(\n {\n frameSize,\n channel = Maybe.zero(),\n padding = false,\n }: ApduSenderServiceConstructorArgs,\n @inject(loggerTypes.LoggerPublisherServiceFactory)\n loggerServiceFactory: (tag: string) => LoggerPublisherService,\n ) {\n this._frameSize = frameSize;\n this._channel = channel;\n this._padding = padding;\n this._logger = loggerServiceFactory(\"DefaultApduSenderService\");\n }\n\n /**\n * Get frames from apdu\n *\n * @param apdu\n */\n public getFrames(apdu: Uint8Array): Frame[] {\n const frames: Frame[] = [];\n let count = 0;\n let frame = this.getFrameAtIndex(apdu, count);\n\n while (frame.isRight()) {\n frames.push(frame.extract());\n count += 1;\n frame = this.getFrameAtIndex(apdu, count).mapLeft((error) => {\n if (error instanceof FramerOverflowError) {\n this._logger.debug(\"Frames parsed\", { data: { count } });\n } else {\n this._logger.error(\"Error while parsing frame\", { data: { error } });\n }\n return error;\n });\n }\n return frames;\n }\n\n /**\n * Get apdu frame at index\n * Split every {{PACKET_SIZE - HEADER_SIZE}} bytes of apdu\n * @param apdu\n * @param frameIndex\n * @private\n */\n private getFrameAtIndex(\n apdu: Uint8Array,\n frameIndex: number,\n ): Either<DmkError, Frame> {\n const header = this.getFrameHeaderFrom(frameIndex, apdu.length);\n const frameOffset =\n frameIndex === 0\n ? 0\n : frameIndex * this._frameSize - this.getHeaderSizeSumFrom(frameIndex);\n\n if (frameOffset >= apdu.length) {\n return Left(new FramerOverflowError());\n }\n if (header.getLength() > this._frameSize) {\n return Left(new FramerApduError());\n }\n const dataMaxSize = this._frameSize - header.getLength();\n const data = apdu.slice(\n frameOffset,\n frameOffset + this._frameSize - header.getLength(),\n );\n const frameData = this._padding\n ? new Uint8Array(dataMaxSize).fill(0)\n : new Uint8Array(data.length < dataMaxSize ? data.length : dataMaxSize);\n frameData.set(data, 0);\n const frame = new Frame({\n header,\n data: frameData,\n });\n return Right(frame);\n }\n\n /**\n * Get frame header\n * @param frameIndex\n * @param apduSize\n * @private\n */\n private getFrameHeaderFrom(\n frameIndex: number,\n apduSize: number,\n ): FrameHeader {\n const header = new FrameHeader({\n uuid: v4(),\n channel: this._channel.map((channel) =>\n FramerUtils.getLastBytesFrom(channel, CHANNEL_LENGTH),\n ),\n headTag: new Uint8Array([HEAD_TAG]),\n index: FramerUtils.numberToByteArray(frameIndex, INDEX_LENGTH),\n length: this.getFrameHeaderSizeFromIndex(frameIndex),\n dataSize: Maybe.zero(),\n });\n if (frameIndex === 0) {\n header.setDataSize(\n Maybe.of(\n FramerUtils.numberToByteArray(apduSize, APDU_DATA_LENGTH_LENGTH),\n ),\n );\n }\n return header;\n }\n\n /**\n * Get frame offset\n * First frame has more bytes of header\n * Padding append means a 0 bytes is added at the end of each frame\n * @private\n * @param frameIndex\n */\n private getHeaderSizeSumFrom(frameIndex: number): number {\n let sum = this.getFrameHeaderSizeFromIndex(0);\n let i = 1;\n while (i < frameIndex) {\n sum += this.getFrameHeaderSizeFromIndex(i);\n i += 1;\n }\n return sum;\n }\n\n /**\n * Get frame header size\n * @private\n * @param frameIndex\n */\n private getFrameHeaderSizeFromIndex(frameIndex: number): number {\n return (\n this._channel.caseOf({\n Just: ()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AAS,OAAO,CACnB,KAAM,IAAMc,EACZ,QAAS,IAAM,CACjB,CAAC,EACDE,EACAI,GACCpB,IAAe,EAAIiB,EAA0B,EAElD,CACF,EA5Ja7B,EAANiC,EAAA,CADNC,EAAW,EAqBPC,EAAA,EAAAC,EAAOC,EAAY,6BAA6B,IApBxCrC",
6
6
  "names": ["inject", "injectable", "Left", "Maybe", "Right", "v4", "APDU_DATA_LENGTH_LENGTH", "CHANNEL_LENGTH", "HEAD_TAG", "HEAD_TAG_LENGTH", "INDEX_LENGTH", "FramerUtils", "FramerApduError", "FramerOverflowError", "Frame", "FrameHeader", "loggerTypes", "DefaultApduSenderService", "frameSize", "channel", "Maybe", "padding", "loggerServiceFactory", "apdu", "frames", "count", "frame", "error", "FramerOverflowError", "frameIndex", "header", "frameOffset", "Left", "FramerApduError", "dataMaxSize", "data", "frameData", "Frame", "Right", "apduSize", "FrameHeader", "v4", "FramerUtils", "CHANNEL_LENGTH", "HEAD_TAG", "INDEX_LENGTH", "APDU_DATA_LENGTH_LENGTH", "sum", "i", "HEAD_TAG_LENGTH", "__decorateClass", "injectable", "__decorateParam", "inject", "loggerTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Maybe as x}from"purify-ts";import{Frame as t}from"../../device-session/model/Frame";import{FrameHeader as i}from"../../device-session/model/FrameHeader";import{DefaultLoggerPublisherService as w}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{DefaultApduSenderService as d}from"./DefaultApduSenderService";vi.mock("uuid",()=>({v4:vi.fn().mockReturnValue("42")}));const o=new w([],"frame");describe("DefaultApduSenderService",()=>{describe("[USB] With padding and channel",()=>{it("should return 1 frame",()=>{const n=x.of(new Uint8Array([18,52])),a=new d({frameSize:64,padding:!0,channel:n},()=>o),e=new Uint8Array([224,1,0,0,0]),r=a.getFrames(e);expect(r).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,5])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])})]),expect(r.map(c=>c.getRawData())).toEqual([new Uint8Array([18,52,5,0,0,0,5,224,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])])}),it("should return 2 frames",()=>{const n=x.of(new Uint8Array([18,52])),a=new d({frameSize:64,padding:!0,channel:n},()=>o),e=new Uint8Array([224,212,0,0,64,84,111,102,117,73,115,78,117,116,114,105,116,105,111,117,115,65,110,100,66,114,105,110,103,115,74,111,121,68,101,108,105,103,104,116,72,101,97,108,116,104,105,110,101,115,115,72,97,114,109,111,110,121,73,110,69,118,101,114,121,66,105,116,101]),r=a.getFrames(e);expect(r).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,69])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,212,0,0,64,84,111,102,117,73,115,78,117,116,114,105,116,105,111,117,115,65,110,100,66,114,105,110,103,115,74,111,121,68,101,108,105,103,104,116,72,101,97,108,116,104,105,110,101,115,115,72,97,114,109,111,110])}),new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),index:new Uint8Array([0,1]),length:5,dataSize:x.zero()}),data:new Uint8Array([121,73,110,69,118,101,114,121,66,105,116,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])})]),expect(r.map(c=>c.getRawData())).toEqual([new Uint8Array([18,52,5,0,0,0,69,224,212,0,0,64,84,111,102,117,73,115,78,117,116,114,105,116,105,111,117,115,65,110,100,66,114,105,110,103,115,74,111,121,68,101,108,105,103,104,116,72,101,97,108,116,104,105,110,101,115,115,72,97,114,109,111,110]),new Uint8Array([18,52,5,0,1,121,73,110,69,118,101,114,121,66,105,116,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])])})}),describe("[BLE] Without padding nor channel",()=>{it("should return 1 frame",()=>{const n=new d({frameSize:123},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e).toEqual([new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,5])),index:new Uint8Array([0,0]),length:5}),data:new Uint8Array([224,1,0,0,0])})]),expect(e.map(r=>r.getRawData())).toEqual([new Uint8Array([5,0,0,0,5,224,1,0,0,0])])}),it("should return 3 frames",()=>{const n=new d({frameSize:10},()=>o),a=new Uint8Array([1,5,79,76,79,83,0,7,46,50,46,52,45,50,0,144,0]),e=n.getFrames(a);expect(e).toEqual([new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),index:new Uint8Array([0,0]),dataSize:x.of(new Uint8Array([0,17])),length:5}),data:new Uint8Array([1,5,79,76,79])}),new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),dataSize:x.zero(),index:new Uint8Array([0,1]),length:3}),data:new Uint8Array([83,0,7,46,50,46,52])}),new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),dataSize:x.zero(),index:new Uint8Array([0,2]),length:3}),data:new Uint8Array([45,50,0,144,0])})]),expect(e.map(r=>r.getRawData())).toEqual([new Uint8Array([5,0,0,0,17,1,5,79,76,79]),new Uint8Array([5,0,1,83,0,7,46,50,46,52]),new Uint8Array([5,0,2,45,50,0,144,0])])})}),describe("Errors",()=>{it("should return a well formatted header with very big channel",()=>{const n=new d({frameSize:64,channel:x.of(new Uint8Array([1193012,214084,353364,30788,590916]))},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([68,68])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,5])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,1,0,0,0])})]),expect(e.map(r=>r.getRawData())).toEqual([new Uint8Array([68,68,5,0,0,0,5,224,1,0,0,0])])}),it("should return empty if packet size smaller than header size",()=>{const n=new d({frameSize:Math.random()&4,channel:x.of(new Uint8Array([18,52]))},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e.length).toEqual(0)}),it("should return empty if no apdu length",()=>{const n=new d({frameSize:Math.random()&255,padding:Math.random()>.5,channel:x.of(new Uint8Array([18,52]))},()=>o),a=new Uint8Array([]),e=n.getFrames(a);expect(e.length).toEqual(0)})})});
1
+ import{Maybe as x}from"purify-ts";import{Frame as t}from"../../device-session/model/Frame";import{FrameHeader as i}from"../../device-session/model/FrameHeader";import{DefaultLoggerPublisherService as w}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{DefaultApduSenderService as d}from"./DefaultApduSenderService";vi.mock("uuid",()=>({v4:vi.fn().mockReturnValue("42")}));const o=new w([],"frame");describe("DefaultApduSenderService",()=>{describe("[USB] With padding and channel",()=>{it("should return 1 frame",()=>{const n=x.of(new Uint8Array([18,52])),a=new d({frameSize:64,padding:!0,channel:n},()=>o),e=new Uint8Array([224,1,0,0,0]),r=a.getFrames(e);expect(r).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,5])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])})]),expect(r.map(c=>c.getRawData())).toEqual([new Uint8Array([18,52,5,0,0,0,5,224,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])])}),it("should return 2 frames",()=>{const n=x.of(new Uint8Array([18,52])),a=new d({frameSize:64,padding:!0,channel:n},()=>o),e=new Uint8Array([224,212,0,0,64,84,111,102,117,73,115,78,117,116,114,105,116,105,111,117,115,65,110,100,66,114,105,110,103,115,74,111,121,68,101,108,105,103,104,116,72,101,97,108,116,104,105,110,101,115,115,72,97,114,109,111,110,121,73,110,69,118,101,114,121,66,105,116,101]),r=a.getFrames(e);expect(r).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,69])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,212,0,0,64,84,111,102,117,73,115,78,117,116,114,105,116,105,111,117,115,65,110,100,66,114,105,110,103,115,74,111,121,68,101,108,105,103,104,116,72,101,97,108,116,104,105,110,101,115,115,72,97,114,109,111,110])}),new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),index:new Uint8Array([0,1]),length:5,dataSize:x.zero()}),data:new Uint8Array([121,73,110,69,118,101,114,121,66,105,116,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])})]),expect(r.map(c=>c.getRawData())).toEqual([new Uint8Array([18,52,5,0,0,0,69,224,212,0,0,64,84,111,102,117,73,115,78,117,116,114,105,116,105,111,117,115,65,110,100,66,114,105,110,103,115,74,111,121,68,101,108,105,103,104,116,72,101,97,108,116,104,105,110,101,115,115,72,97,114,109,111,110]),new Uint8Array([18,52,5,0,1,121,73,110,69,118,101,114,121,66,105,116,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])])}),it("should return exactly 0 frame",()=>{const n=x.of(new Uint8Array([18,52])),a=new d({frameSize:64,padding:!0,channel:n},()=>o),e=new Uint8Array([]),r=a.getFrames(e);expect(r).toEqual([])}),it("should return exactly 1 frame",()=>{const n=x.of(new Uint8Array([18,52])),a=new d({frameSize:64,padding:!0,channel:n},()=>o),e=new Uint8Array([224,6,0,19,52,71,50,73,103,115,81,104,104,88,83,105,77,113,56,107,85,80,121,78,110,70,99,99,49,69,105,65,103,119,53,78,120,109,45,104,105,111,121,86,103,106,57,119,72,86,101,77,4,9,146,192,254]),r=a.getFrames(e);expect(r).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,57])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,6,0,19,52,71,50,73,103,115,81,104,104,88,83,105,77,113,56,107,85,80,121,78,110,70,99,99,49,69,105,65,103,119,53,78,120,109,45,104,105,111,121,86,103,106,57,119,72,86,101,77,4,9,146,192,254])})]),expect(r.map(c=>c.getRawData())).toEqual([new Uint8Array([18,52,5,0,0,0,57,224,6,0,19,52,71,50,73,103,115,81,104,104,88,83,105,77,113,56,107,85,80,121,78,110,70,99,99,49,69,105,65,103,119,53,78,120,109,45,104,105,111,121,86,103,106,57,119,72,86,101,77,4,9,146,192,254])])})}),describe("[BLE] Without padding nor channel",()=>{it("should return 1 frame",()=>{const n=new d({frameSize:123},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e).toEqual([new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,5])),index:new Uint8Array([0,0]),length:5}),data:new Uint8Array([224,1,0,0,0])})]),expect(e.map(r=>r.getRawData())).toEqual([new Uint8Array([5,0,0,0,5,224,1,0,0,0])])}),it("should return 3 frames",()=>{const n=new d({frameSize:10},()=>o),a=new Uint8Array([1,5,79,76,79,83,0,7,46,50,46,52,45,50,0,144,0]),e=n.getFrames(a);expect(e).toEqual([new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),index:new Uint8Array([0,0]),dataSize:x.of(new Uint8Array([0,17])),length:5}),data:new Uint8Array([1,5,79,76,79])}),new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),dataSize:x.zero(),index:new Uint8Array([0,1]),length:3}),data:new Uint8Array([83,0,7,46,50,46,52])}),new t({header:new i({uuid:"42",channel:x.zero(),headTag:new Uint8Array([5]),dataSize:x.zero(),index:new Uint8Array([0,2]),length:3}),data:new Uint8Array([45,50,0,144,0])})]),expect(e.map(r=>r.getRawData())).toEqual([new Uint8Array([5,0,0,0,17,1,5,79,76,79]),new Uint8Array([5,0,1,83,0,7,46,50,46,52]),new Uint8Array([5,0,2,45,50,0,144,0])])})}),describe("Errors",()=>{it("should return a well formatted header with very big channel",()=>{const n=new d({frameSize:64,channel:x.of(new Uint8Array([1193012,214084,353364,30788,590916]))},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e).toEqual([new t({header:new i({uuid:"42",channel:x.of(new Uint8Array([68,68])),headTag:new Uint8Array([5]),dataSize:x.of(new Uint8Array([0,5])),index:new Uint8Array([0,0]),length:7}),data:new Uint8Array([224,1,0,0,0])})]),expect(e.map(r=>r.getRawData())).toEqual([new Uint8Array([68,68,5,0,0,0,5,224,1,0,0,0])])}),it("should return empty if packet size smaller than header size",()=>{const n=new d({frameSize:Math.random()&4,channel:x.of(new Uint8Array([18,52]))},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e.length).toEqual(0)}),it("should return empty if no apdu length",()=>{const n=new d({frameSize:Math.random()&255,padding:Math.random()>.5,channel:x.of(new Uint8Array([18,52]))},()=>o),a=new Uint8Array([]),e=n.getFrames(a);expect(e.length).toEqual(0)})})});
2
2
  //# sourceMappingURL=DefaultApduSenderService.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/service/DefaultApduSenderService.test.ts"],
4
- "sourcesContent": ["import { Maybe } from \"purify-ts\";\n\nimport { Frame } from \"@internal/device-session/model/Frame\";\nimport { FrameHeader } from \"@internal/device-session/model/FrameHeader\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\n\nimport { DefaultApduSenderService } from \"./DefaultApduSenderService\";\n\nvi.mock(\"uuid\", () => ({\n v4: vi.fn().mockReturnValue(\"42\"),\n}));\n\nconst loggerService = new DefaultLoggerPublisherService([], \"frame\");\n\ndescribe(\"DefaultApduSenderService\", () => {\n describe(\"[USB] With padding and channel\", () => {\n it(\"should return 1 frame\", () => {\n // given\n const channel = Maybe.of(new Uint8Array([0x12, 0x34]));\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n padding: true,\n channel,\n },\n () => loggerService,\n );\n // getVersion APDU\n const apdu = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(apdu);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0, 0x05])),\n index: new Uint8Array([0, 0]),\n length: 7,\n }),\n data: new Uint8Array([\n 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00,\n ]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x00, 0x00, 0x05, 0xe0, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n ]),\n ]);\n });\n\n it(\"should return 2 frames\", () => {\n // given\n const channel = Maybe.of(new Uint8Array([0x12, 0x34]));\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n padding: true,\n channel,\n },\n () => loggerService,\n );\n const apdu = new Uint8Array([\n // editDeviceName APDU\n 0xe0, 0xd4, 0x00, 0x00, 0x40,\n // editDeviceNameData\n 0x54, 0x6f, 0x66, 0x75, 0x49, 0x73, 0x4e, 0x75, 0x74, 0x72, 0x69, 0x74,\n 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6e, 0x64, 0x42, 0x72, 0x69, 0x6e, 0x67,\n 0x73, 0x4a, 0x6f, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x48,\n 0x65, 0x61, 0x6c, 0x74, 0x68, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x48, 0x61,\n 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x49, 0x6e, 0x45, 0x76, 0x65, 0x72, 0x79,\n 0x42, 0x69, 0x74, 0x65,\n ]);\n\n // when\n const frames = apduSenderService.getFrames(apdu);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0x00, 0x45])),\n index: new Uint8Array([0x00, 0x00]),\n length: 7,\n }),\n data: new Uint8Array([\n 0xe0, 0xd4, 0x00, 0x00, 0x40, 0x54, 0x6f, 0x66, 0x75, 0x49, 0x73,\n 0x4e, 0x75, 0x74, 0x72, 0x69, 0x74, 0x69, 0x6f, 0x75, 0x73, 0x41,\n 0x6e, 0x64, 0x42, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x4a, 0x6f, 0x79,\n 0x44, 0x65, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x48, 0x65, 0x61, 0x6c,\n 0x74, 0x68, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x48, 0x61, 0x72, 0x6d,\n 0x6f, 0x6e,\n ]),\n }),\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n index: new Uint8Array([0x00, 0x01]),\n length: 5,\n dataSize: Maybe.zero(),\n }),\n data: new Uint8Array([\n 0x79, 0x49, 0x6e, 0x45, 0x76, 0x65, 0x72, 0x79, 0x42, 0x69, 0x74,\n 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n ]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x00, 0x00, 0x45, 0xe0, 0xd4, 0x00, 0x00,\n 0x40, 0x54, 0x6f, 0x66, 0x75, 0x49, 0x73, 0x4e, 0x75, 0x74, 0x72,\n 0x69, 0x74, 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6e, 0x64, 0x42, 0x72,\n 0x69, 0x6e, 0x67, 0x73, 0x4a, 0x6f, 0x79, 0x44, 0x65, 0x6c, 0x69,\n 0x67, 0x68, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x69, 0x6e,\n 0x65, 0x73, 0x73, 0x48, 0x61, 0x72, 0x6d, 0x6f, 0x6e,\n ]),\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x01, 0x79, 0x49, 0x6e, 0x45, 0x76, 0x65,\n 0x72, 0x79, 0x42, 0x69, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n ]),\n ]);\n });\n });\n\n describe(\"[BLE] Without padding nor channel\", () => {\n it(\"should return 1 frame\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 123,\n },\n () => loggerService,\n );\n const command = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0, 5])),\n index: new Uint8Array([0, 0]),\n length: 5,\n }),\n data: new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x05, 0x00, 0x00, 0x00, 0x05, 0xe0, 0x01, 0x00, 0x00, 0x00,\n ]),\n ]);\n });\n\n it(\"should return 3 frames\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 10,\n },\n () => loggerService,\n );\n const command = new Uint8Array([\n 0x01, 0x05, 0x4f, 0x4c, 0x4f, 0x53, 0x00, 0x07, 0x2e, 0x32, 0x2e, 0x34,\n 0x2d, 0x32, 0x00, 0x90, 0x00,\n ]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n index: new Uint8Array([0, 0]),\n dataSize: Maybe.of(new Uint8Array([0, 0x11])),\n length: 5,\n }),\n data: new Uint8Array([0x01, 0x05, 0x4f, 0x4c, 0x4f]),\n }),\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.zero(),\n index: new Uint8Array([0, 0x01]),\n length: 3,\n }),\n data: new Uint8Array([0x53, 0x00, 0x07, 0x2e, 0x32, 0x2e, 0x34]),\n }),\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.zero(),\n index: new Uint8Array([0, 0x02]),\n length: 3,\n }),\n data: new Uint8Array([0x2d, 0x32, 0x00, 0x90, 0x00]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x05, 0x00, 0x00, 0x00, 0x11, 0x01, 0x05, 0x4f, 0x4c, 0x4f,\n ]),\n new Uint8Array([\n 0x05, 0x00, 0x01, 0x53, 0x00, 0x07, 0x2e, 0x32, 0x2e, 0x34,\n ]),\n new Uint8Array([0x05, 0x00, 0x02, 0x2d, 0x32, 0x00, 0x90, 0x00]),\n ]);\n });\n });\n\n describe(\"Errors\", () => {\n it(\"should return a well formatted header with very big channel\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n channel: Maybe.of(\n new Uint8Array([0x123434, 0x34444, 0x56454, 0x7844, 0x90444]),\n ),\n },\n () => loggerService,\n );\n const command = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x44, 0x44])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0, 0x05])),\n index: new Uint8Array([0, 0]),\n length: 7,\n }),\n data: new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x44, 0x44, 0x05, 0x00, 0x00, 0x00, 0x05, 0xe0, 0x01, 0x00, 0x00,\n 0x00,\n ]),\n ]);\n });\n it(\"should return empty if packet size smaller than header size\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: Math.random() & 4,\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n },\n () => loggerService,\n );\n const command = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames.length).toEqual(0);\n });\n\n it(\"should return empty if no apdu length\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n // random frameSize < 0xff\n frameSize: Math.random() & 0xff,\n // random padding boolean\n padding: Math.random() > 0.5,\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n },\n () => loggerService,\n );\n const command = new Uint8Array([]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames.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EAED,GAAG,wCAAyC,IAAM,CAEhD,MAAMF,EAAoB,IAAIH,EAC5B,CAEE,UAAW,KAAK,OAAO,EAAI,IAE3B,QAAS,KAAK,OAAO,EAAI,GACzB,QAASJ,EAAM,GAAG,IAAI,WAAW,CAAC,GAAM,EAAI,CAAC,CAAC,CAChD,EACA,IAAMK,CACR,EACMM,EAAU,IAAI,WAAW,CAAC,CAAC,EAG3BF,EAASF,EAAkB,UAAUI,CAAO,EAGlD,OAAOF,EAAO,MAAM,EAAE,QAAQ,CAAC,CACjC,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Maybe } from \"purify-ts\";\n\nimport { Frame } from \"@internal/device-session/model/Frame\";\nimport { FrameHeader } from \"@internal/device-session/model/FrameHeader\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\n\nimport { DefaultApduSenderService } from \"./DefaultApduSenderService\";\n\nvi.mock(\"uuid\", () => ({\n v4: vi.fn().mockReturnValue(\"42\"),\n}));\n\nconst loggerService = new DefaultLoggerPublisherService([], \"frame\");\n\ndescribe(\"DefaultApduSenderService\", () => {\n describe(\"[USB] With padding and channel\", () => {\n it(\"should return 1 frame\", () => {\n // given\n const channel = Maybe.of(new Uint8Array([0x12, 0x34]));\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n padding: true,\n channel,\n },\n () => loggerService,\n );\n // getVersion APDU\n const apdu = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(apdu);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0, 0x05])),\n index: new Uint8Array([0, 0]),\n length: 7,\n }),\n data: new Uint8Array([\n 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00,\n ]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x00, 0x00, 0x05, 0xe0, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n ]),\n ]);\n });\n\n it(\"should return 2 frames\", () => {\n // given\n const channel = Maybe.of(new Uint8Array([0x12, 0x34]));\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n padding: true,\n channel,\n },\n () => loggerService,\n );\n const apdu = new Uint8Array([\n // editDeviceName APDU\n 0xe0, 0xd4, 0x00, 0x00, 0x40,\n // editDeviceNameData\n 0x54, 0x6f, 0x66, 0x75, 0x49, 0x73, 0x4e, 0x75, 0x74, 0x72, 0x69, 0x74,\n 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6e, 0x64, 0x42, 0x72, 0x69, 0x6e, 0x67,\n 0x73, 0x4a, 0x6f, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x48,\n 0x65, 0x61, 0x6c, 0x74, 0x68, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x48, 0x61,\n 0x72, 0x6d, 0x6f, 0x6e, 0x79, 0x49, 0x6e, 0x45, 0x76, 0x65, 0x72, 0x79,\n 0x42, 0x69, 0x74, 0x65,\n ]);\n\n // when\n const frames = apduSenderService.getFrames(apdu);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0x00, 0x45])),\n index: new Uint8Array([0x00, 0x00]),\n length: 7,\n }),\n data: new Uint8Array([\n 0xe0, 0xd4, 0x00, 0x00, 0x40, 0x54, 0x6f, 0x66, 0x75, 0x49, 0x73,\n 0x4e, 0x75, 0x74, 0x72, 0x69, 0x74, 0x69, 0x6f, 0x75, 0x73, 0x41,\n 0x6e, 0x64, 0x42, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x4a, 0x6f, 0x79,\n 0x44, 0x65, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x48, 0x65, 0x61, 0x6c,\n 0x74, 0x68, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x48, 0x61, 0x72, 0x6d,\n 0x6f, 0x6e,\n ]),\n }),\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n index: new Uint8Array([0x00, 0x01]),\n length: 5,\n dataSize: Maybe.zero(),\n }),\n data: new Uint8Array([\n 0x79, 0x49, 0x6e, 0x45, 0x76, 0x65, 0x72, 0x79, 0x42, 0x69, 0x74,\n 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n ]),\n }),\n ]);\n\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x00, 0x00, 0x45, 0xe0, 0xd4, 0x00, 0x00,\n 0x40, 0x54, 0x6f, 0x66, 0x75, 0x49, 0x73, 0x4e, 0x75, 0x74, 0x72,\n 0x69, 0x74, 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6e, 0x64, 0x42, 0x72,\n 0x69, 0x6e, 0x67, 0x73, 0x4a, 0x6f, 0x79, 0x44, 0x65, 0x6c, 0x69,\n 0x67, 0x68, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x69, 0x6e,\n 0x65, 0x73, 0x73, 0x48, 0x61, 0x72, 0x6d, 0x6f, 0x6e,\n ]),\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x01, 0x79, 0x49, 0x6e, 0x45, 0x76, 0x65,\n 0x72, 0x79, 0x42, 0x69, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n ]),\n ]);\n });\n\n it(\"should return exactly 0 frame\", () => {\n // given\n const channel = Maybe.of(new Uint8Array([0x12, 0x34]));\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n padding: true,\n channel,\n },\n () => loggerService,\n );\n const apdu = new Uint8Array([]);\n\n // when\n const frames = apduSenderService.getFrames(apdu);\n expect(frames).toEqual([]);\n });\n\n it(\"should return exactly 1 frame\", () => {\n // given\n const channel = Maybe.of(new Uint8Array([0x12, 0x34]));\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n padding: true,\n channel,\n },\n () => loggerService,\n );\n const apdu = new Uint8Array([\n 0xe0, 0x06, 0x00, 0x13, 0x34, 0x47, 0x32, 0x49, 0x67, 0x73, 0x51, 0x68,\n 0x68, 0x58, 0x53, 0x69, 0x4d, 0x71, 0x38, 0x6b, 0x55, 0x50, 0x79, 0x4e,\n 0x6e, 0x46, 0x63, 0x63, 0x31, 0x45, 0x69, 0x41, 0x67, 0x77, 0x35, 0x4e,\n 0x78, 0x6d, 0x2d, 0x68, 0x69, 0x6f, 0x79, 0x56, 0x67, 0x6a, 0x39, 0x77,\n 0x48, 0x56, 0x65, 0x4d, 0x04, 0x09, 0x92, 0xc0, 0xfe,\n ]);\n\n // when\n const frames = apduSenderService.getFrames(apdu);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0x00, 0x39])),\n index: new Uint8Array([0x00, 0x00]),\n length: 7,\n }),\n data: new Uint8Array([\n 0xe0, 0x06, 0x00, 0x13, 0x34, 0x47, 0x32, 0x49, 0x67, 0x73, 0x51,\n 0x68, 0x68, 0x58, 0x53, 0x69, 0x4d, 0x71, 0x38, 0x6b, 0x55, 0x50,\n 0x79, 0x4e, 0x6e, 0x46, 0x63, 0x63, 0x31, 0x45, 0x69, 0x41, 0x67,\n 0x77, 0x35, 0x4e, 0x78, 0x6d, 0x2d, 0x68, 0x69, 0x6f, 0x79, 0x56,\n 0x67, 0x6a, 0x39, 0x77, 0x48, 0x56, 0x65, 0x4d, 0x04, 0x09, 0x92,\n 0xc0, 0xfe,\n ]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x12, 0x34, 0x05, 0x00, 0x00, 0x00, 0x39, 0xe0, 0x06, 0x00, 0x13,\n 0x34, 0x47, 0x32, 0x49, 0x67, 0x73, 0x51, 0x68, 0x68, 0x58, 0x53,\n 0x69, 0x4d, 0x71, 0x38, 0x6b, 0x55, 0x50, 0x79, 0x4e, 0x6e, 0x46,\n 0x63, 0x63, 0x31, 0x45, 0x69, 0x41, 0x67, 0x77, 0x35, 0x4e, 0x78,\n 0x6d, 0x2d, 0x68, 0x69, 0x6f, 0x79, 0x56, 0x67, 0x6a, 0x39, 0x77,\n 0x48, 0x56, 0x65, 0x4d, 0x04, 0x09, 0x92, 0xc0, 0xfe,\n ]),\n ]);\n });\n });\n\n describe(\"[BLE] Without padding nor channel\", () => {\n it(\"should return 1 frame\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 123,\n },\n () => loggerService,\n );\n const command = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0, 5])),\n index: new Uint8Array([0, 0]),\n length: 5,\n }),\n data: new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x05, 0x00, 0x00, 0x00, 0x05, 0xe0, 0x01, 0x00, 0x00, 0x00,\n ]),\n ]);\n });\n\n it(\"should return 3 frames\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 10,\n },\n () => loggerService,\n );\n const command = new Uint8Array([\n 0x01, 0x05, 0x4f, 0x4c, 0x4f, 0x53, 0x00, 0x07, 0x2e, 0x32, 0x2e, 0x34,\n 0x2d, 0x32, 0x00, 0x90, 0x00,\n ]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n index: new Uint8Array([0, 0]),\n dataSize: Maybe.of(new Uint8Array([0, 0x11])),\n length: 5,\n }),\n data: new Uint8Array([0x01, 0x05, 0x4f, 0x4c, 0x4f]),\n }),\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.zero(),\n index: new Uint8Array([0, 0x01]),\n length: 3,\n }),\n data: new Uint8Array([0x53, 0x00, 0x07, 0x2e, 0x32, 0x2e, 0x34]),\n }),\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.zero(),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.zero(),\n index: new Uint8Array([0, 0x02]),\n length: 3,\n }),\n data: new Uint8Array([0x2d, 0x32, 0x00, 0x90, 0x00]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x05, 0x00, 0x00, 0x00, 0x11, 0x01, 0x05, 0x4f, 0x4c, 0x4f,\n ]),\n new Uint8Array([\n 0x05, 0x00, 0x01, 0x53, 0x00, 0x07, 0x2e, 0x32, 0x2e, 0x34,\n ]),\n new Uint8Array([0x05, 0x00, 0x02, 0x2d, 0x32, 0x00, 0x90, 0x00]),\n ]);\n });\n });\n\n describe(\"Errors\", () => {\n it(\"should return a well formatted header with very big channel\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: 64,\n channel: Maybe.of(\n new Uint8Array([0x123434, 0x34444, 0x56454, 0x7844, 0x90444]),\n ),\n },\n () => loggerService,\n );\n const command = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames).toEqual([\n new Frame({\n header: new FrameHeader({\n uuid: \"42\",\n channel: Maybe.of(new Uint8Array([0x44, 0x44])),\n headTag: new Uint8Array([0x05]),\n dataSize: Maybe.of(new Uint8Array([0, 0x05])),\n index: new Uint8Array([0, 0]),\n length: 7,\n }),\n data: new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]),\n }),\n ]);\n expect(frames.map((fr) => fr.getRawData())).toEqual([\n new Uint8Array([\n 0x44, 0x44, 0x05, 0x00, 0x00, 0x00, 0x05, 0xe0, 0x01, 0x00, 0x00,\n 0x00,\n ]),\n ]);\n });\n it(\"should return empty if packet size smaller than header size\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n frameSize: Math.random() & 4,\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n },\n () => loggerService,\n );\n const command = new Uint8Array([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames.length).toEqual(0);\n });\n\n it(\"should return empty if no apdu length\", () => {\n // given\n const apduSenderService = new DefaultApduSenderService(\n {\n // random frameSize < 0xff\n frameSize: Math.random() & 0xff,\n // random padding boolean\n padding: Math.random() > 0.5,\n channel: Maybe.of(new Uint8Array([0x12, 0x34])),\n },\n () => loggerService,\n );\n const command = new Uint8Array([]);\n\n // when\n const frames = apduSenderService.getFrames(command);\n\n // then\n expect(frames.length).toEqual(0);\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,SAAAA,MAAa,YAEtB,OAAS,SAAAC,MAAa,uCACtB,OAAS,eAAAC,MAAmB,6CAC5B,OAAS,iCAAAC,MAAqC,mEAE9C,OAAS,4BAAAC,MAAgC,6BAEzC,GAAG,KAAK,OAAQ,KAAO,CACrB,GAAI,GAAG,GAAG,EAAE,gBAAgB,IAAI,CAClC,EAAE,EAEF,MAAMC,EAAgB,IAAIF,EAA8B,CAAC,EAAG,OAAO,EAEnE,SAAS,2BAA4B,IAAM,CACzC,SAAS,iCAAkC,IAAM,CAC/C,GAAG,wBAAyB,IAAM,CAEhC,MAA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AOS,EAAO,IAAKC,GAAOA,EAAG,WAAW,CAAC,CAAC,EAAE,QAAQ,CAClD,IAAI,WAAW,CACb,GAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,IAAM,EAAM,EAAM,EAC5D,CACF,CAAC,CACH,CAAC,CACH,CAAC,EACD,GAAG,8DAA+D,IAAM,CAEtE,MAAMH,EAAoB,IAAIH,EAC5B,CACE,UAAW,KAAK,OAAO,EAAI,EAC3B,QAASJ,EAAM,GAAG,IAAI,WAAW,CAAC,GAAM,EAAI,CAAC,CAAC,CAChD,EACA,IAAMK,CACR,EACMM,EAAU,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,EAAM,CAAI,CAAC,EAGvDF,EAASF,EAAkB,UAAUI,CAAO,EAGlD,OAAOF,EAAO,MAAM,EAAE,QAAQ,CAAC,CACjC,CAAC,EAED,GAAG,wCAAyC,IAAM,CAEhD,MAAMF,EAAoB,IAAIH,EAC5B,CAEE,UAAW,KAAK,OAAO,EAAI,IAE3B,QAAS,KAAK,OAAO,EAAI,GACzB,QAASJ,EAAM,GAAG,IAAI,WAAW,CAAC,GAAM,EAAI,CAAC,CAAC,CAChD,EACA,IAAMK,CACR,EACMM,EAAU,IAAI,WAAW,CAAC,CAAC,EAG3BF,EAASF,EAAkB,UAAUI,CAAO,EAGlD,OAAOF,EAAO,MAAM,EAAE,QAAQ,CAAC,CACjC,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["Maybe", "Frame", "FrameHeader", "DefaultLoggerPublisherService", "DefaultApduSenderService", "loggerService", "channel", "apduSenderService", "apdu", "frames", "fr", "command"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var p=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var t=(o,e,i,s)=>{for(var c=s>1?void 0:s?m(e,i):e,v=o.length-1,n;v>=0;v--)(n=o[v])&&(c=(s?n(e,i,c):n(c))||c);return s&&c&&p(e,i,c),c},S=(o,e)=>(i,s)=>e(i,s,o);import{inject as D,injectable as d}from"inversify";import{deviceSessionTypes as f}from"../../device-session/di/deviceSessionTypes";let r=class{_sessionService;constructor(e){this._sessionService=e}execute(){const e=this._sessionService.getDeviceSessions();for(const i of e)i.close()}};r=t([d(),S(0,D(f.DeviceSessionService))],r);export{r as CloseSessionsUseCase};
1
+ var a=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var S=(o,e,i,s)=>{for(var r=s>1?void 0:s?m(e,i):e,t=o.length-1,n;t>=0;t--)(n=o[t])&&(r=(s?n(e,i,r):n(r))||r);return s&&r&&a(e,i,r),r},v=(o,e)=>(i,s)=>e(i,s,o);import{inject as p,injectable as D}from"inversify";import{deviceSessionTypes as d}from"../../device-session/di/deviceSessionTypes";import{transportDiTypes as f}from"../../transport/di/transportDiTypes";let c=class{_sessionService;_transportService;constructor(e,i){this._sessionService=e,this._transportService=i}execute(){const e=this._sessionService.getDeviceSessions();for(const i of e)this._transportService.closeConnection(i.connectedDevice),this._sessionService.removeDeviceSession(i.id)}};c=S([D(),v(0,p(d.DeviceSessionService)),v(1,p(f.TransportService))],c);export{c as CloseSessionsUseCase};
2
2
  //# sourceMappingURL=CloseSessionsUseCase.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/use-case/CloseSessionsUseCase.ts"],
4
- "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport type { DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\n\n@injectable()\nexport class CloseSessionsUseCase {\n private readonly _sessionService: DeviceSessionService;\n constructor(\n @inject(deviceSessionTypes.DeviceSessionService)\n sessionService: DeviceSessionService,\n ) {\n this._sessionService = sessionService;\n }\n\n execute() {\n const deviceSessions = this._sessionService.getDeviceSessions();\n\n for (const dSession of deviceSessions) {\n dSession.close();\n }\n }\n}\n"],
5
- "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAEnC,OAAS,sBAAAC,MAA0B,iDAI5B,IAAMC,EAAN,KAA2B,CACf,gBACjB,YAEEC,EACA,CACA,KAAK,gBAAkBA,CACzB,CAEA,SAAU,CACR,MAAMC,EAAiB,KAAK,gBAAgB,kBAAkB,EAE9D,UAAWC,KAAYD,EACrBC,EAAS,MAAM,CAEnB,CACF,EAhBaH,EAANI,EAAA,CADNC,EAAW,EAIPC,EAAA,EAAAC,EAAOC,EAAmB,oBAAoB,IAHtCR",
6
- "names": ["inject", "injectable", "deviceSessionTypes", "CloseSessionsUseCase", "sessionService", "deviceSessions", "dSession", "__decorateClass", "injectable", "__decorateParam", "inject", "deviceSessionTypes"]
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport type { DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { transportDiTypes } from \"@internal/transport/di/transportDiTypes\";\nimport type { TransportService } from \"@internal/transport/service/TransportService\";\n\n@injectable()\nexport class CloseSessionsUseCase {\n private readonly _sessionService: DeviceSessionService;\n private readonly _transportService: TransportService;\n constructor(\n @inject(deviceSessionTypes.DeviceSessionService)\n sessionService: DeviceSessionService,\n @inject(transportDiTypes.TransportService)\n transportService: TransportService,\n ) {\n this._sessionService = sessionService;\n this._transportService = transportService;\n }\n\n execute() {\n const deviceSessions = this._sessionService.getDeviceSessions();\n\n for (const dSession of deviceSessions) {\n this._transportService.closeConnection(dSession.connectedDevice);\n this._sessionService.removeDeviceSession(dSession.id);\n }\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAEnC,OAAS,sBAAAC,MAA0B,iDAEnC,OAAS,oBAAAC,MAAwB,0CAI1B,IAAMC,EAAN,KAA2B,CACf,gBACA,kBACjB,YAEEC,EAEAC,EACA,CACA,KAAK,gBAAkBD,EACvB,KAAK,kBAAoBC,CAC3B,CAEA,SAAU,CACR,MAAMC,EAAiB,KAAK,gBAAgB,kBAAkB,EAE9D,UAAWC,KAAYD,EACrB,KAAK,kBAAkB,gBAAgBC,EAAS,eAAe,EAC/D,KAAK,gBAAgB,oBAAoBA,EAAS,EAAE,CAExD,CACF,EArBaJ,EAANK,EAAA,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAmB,oBAAoB,GAE9CF,EAAA,EAAAC,EAAOE,EAAiB,gBAAgB,IANhCV",
6
+ "names": ["inject", "injectable", "deviceSessionTypes", "transportDiTypes", "CloseSessionsUseCase", "sessionService", "transportService", "deviceSessions", "dSession", "__decorateClass", "injectable", "__decorateParam", "inject", "deviceSessionTypes", "transportDiTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS as S}from"../../device-session/data/DeviceSessionRefresherConst";import{deviceSessionStubBuilder as m}from"../../device-session/model/DeviceSession.stub";import{DefaultDeviceSessionService as l}from"../../device-session/service/DefaultDeviceSessionService";import{CloseSessionsUseCase as p}from"../../device-session/use-case/CloseSessionsUseCase";import{DefaultLoggerPublisherService as u}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as f}from"../../manager-api/data/AxiosManagerApiDataSource";import{DefaultManagerApiService as D}from"../../manager-api/service/DefaultManagerApiService";import{DefaultSecureChannelDataSource as v}from"../../secure-channel/data/DefaultSecureChannelDataSource";import{DefaultSecureChannelService as g}from"../../secure-channel/service/DefaultSecureChannelService";let r,a,t,n,c,o;describe("CloseSessionsUseCase",()=>{beforeEach(()=>{r=new u([],"close-sessions-use-case-test"),a=new f({}),t=new D(a),n=new v({}),c=new g(n),o=new l(()=>r)}),it("should be able to close every session",()=>{const i=[...Array(10).keys()].map(e=>{const s=m({id:e.toString()},()=>r,t,c,S);return vi.spyOn(s,"close"),s});i.forEach(e=>o.addDeviceSession(e)),new p(o).execute(),i.forEach(e=>{expect(e.close).toHaveBeenCalled()})})});
1
+ import{DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS as S}from"../../device-session/data/DeviceSessionRefresherConst";import{deviceSessionStubBuilder as m}from"../../device-session/model/DeviceSession.stub";import{DefaultDeviceSessionService as p}from"../../device-session/service/DefaultDeviceSessionService";import{CloseSessionsUseCase as l}from"../../device-session/use-case/CloseSessionsUseCase";import{DefaultLoggerPublisherService as u}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as f}from"../../manager-api/data/AxiosManagerApiDataSource";import{DefaultManagerApiService as v}from"../../manager-api/service/DefaultManagerApiService";import{DefaultSecureChannelDataSource as D}from"../../secure-channel/data/DefaultSecureChannelDataSource";import{DefaultSecureChannelService as g}from"../../secure-channel/service/DefaultSecureChannelService";import{DefaultTransportService as C}from"../../transport/service/__mocks__/DefaultTransportService";let o,i,t,a,n,r,c;describe("CloseSessionsUseCase",()=>{beforeEach(()=>{o=new u([],"close-sessions-use-case-test"),i=new f({}),t=new v(i),a=new D({}),n=new g(a),r=new p(()=>o),c=new C}),it("should be able to close every session",()=>{[...Array(10).keys()].map(e=>{const s=m({id:e.toString()},()=>o,t,n,S);return vi.spyOn(s,"close"),s}).forEach(e=>r.addDeviceSession(e)),new l(r,c).execute();for(const e of r.getDeviceSessions())expect(e.close).toHaveBeenCalled()})});
2
2
  //# sourceMappingURL=CloseSessionsUseCase.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/use-case/CloseSessionsUseCase.test.ts"],
4
- "sourcesContent": ["import { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DefaultDeviceSessionService } from \"@internal/device-session/service/DefaultDeviceSessionService\";\nimport { type DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { CloseSessionsUseCase } from \"@internal/device-session/use-case/CloseSessionsUseCase\";\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\";\n\nlet logger: LoggerPublisherService;\nlet managerApiDataSource: ManagerApiDataSource;\nlet managerApi: ManagerApiService;\nlet secureChannelDataSource: SecureChannelDataSource;\nlet secureChannel: SecureChannelService;\nlet sessionService: DeviceSessionService;\n\ndescribe(\"CloseSessionsUseCase\", () => {\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService(\n [],\n \"close-sessions-use-case-test\",\n );\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 sessionService = new DefaultDeviceSessionService(() => logger);\n });\n\n it(\"should be able to close every session\", () => {\n //given\n const sessions = [...Array(10).keys()].map((id) => {\n const session = deviceSessionStubBuilder(\n { id: id.toString() },\n () => logger,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n vi.spyOn(session, \"close\");\n return session;\n });\n sessions.forEach((session) => sessionService.addDeviceSession(session));\n const useCase = new CloseSessionsUseCase(sessionService);\n //when\n useCase.execute();\n //then\n sessions.forEach((session) => {\n expect(session.close).toHaveBeenCalled();\n });\n });\n});\n"],
5
- "mappings": "AAEA,OAAS,4CAAAA,MAAgD,4DACzD,OAAS,4BAAAC,MAAgC,oDACzC,OAAS,+BAAAC,MAAmC,+DAE5C,OAAS,wBAAAC,MAA4B,yDACrC,OAAS,iCAAAC,MAAqC,mEAC9C,OAAS,6BAAAC,MAAiC,uDAE1C,OAAS,4BAAAC,MAAgC,yDAEzC,OAAS,kCAAAC,MAAsC,+DAE/C,OAAS,+BAAAC,MAAmC,+DAG5C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEJ,SAAS,uBAAwB,IAAM,CACrC,WAAW,IAAM,CACfL,EAAS,IAAIL,EACX,CAAC,EACD,8BACF,EACAM,EAAuB,IAAIL,EAA0B,CAAC,CAAc,EACpEM,EAAa,IAAIL,EAAyBI,CAAoB,EAC9DE,EAA0B,IAAIL,EAC5B,CAAC,CACH,EACAM,EAAgB,IAAIL,EAA4BI,CAAuB,EACvEE,EAAiB,IAAIZ,EAA4B,IAAMO,CAAM,CAC/D,CAAC,EAED,GAAG,wCAAyC,IAAM,CAEhD,MAAMM,EAAW,CAAC,GAAG,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,IAAKC,GAAO,CACjD,MAAMC,EAAUhB,EACd,CAAE,GAAIe,EAAG,SAAS,CAAE,EACpB,IAAMP,EACNE,EACAE,EACAb,CACF,EACA,UAAG,MAAMiB,EAAS,OAAO,EAClBA,CACT,CAAC,EACDF,EAAS,QAASE,GAAYH,EAAe,iBAAiBG,CAAO,CAAC,EACtD,IAAId,EAAqBW,CAAc,EAE/C,QAAQ,EAEhBC,EAAS,QAASE,GAAY,CAC5B,OAAOA,EAAQ,KAAK,EAAE,iBAAiB,CACzC,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS", "deviceSessionStubBuilder", "DefaultDeviceSessionService", "CloseSessionsUseCase", "DefaultLoggerPublisherService", "AxiosManagerApiDataSource", "DefaultManagerApiService", "DefaultSecureChannelDataSource", "DefaultSecureChannelService", "logger", "managerApiDataSource", "managerApi", "secureChannelDataSource", "secureChannel", "sessionService", "sessions", "id", "session"]
4
+ "sourcesContent": ["import { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DefaultDeviceSessionService } from \"@internal/device-session/service/DefaultDeviceSessionService\";\nimport { type DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { CloseSessionsUseCase } from \"@internal/device-session/use-case/CloseSessionsUseCase\";\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/__mocks__/DefaultTransportService\";\n\nlet logger: LoggerPublisherService;\nlet managerApiDataSource: ManagerApiDataSource;\nlet managerApi: ManagerApiService;\nlet secureChannelDataSource: SecureChannelDataSource;\nlet secureChannel: SecureChannelService;\nlet sessionService: DeviceSessionService;\nlet transportService: DefaultTransportService;\n\n// @TODO Fix this test with vi.spyOn session close [SNAPSHOT PURPOSE]\ndescribe(\"CloseSessionsUseCase\", () => {\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService(\n [],\n \"close-sessions-use-case-test\",\n );\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 sessionService = new DefaultDeviceSessionService(() => logger);\n transportService = new DefaultTransportService();\n });\n\n it(\"should be able to close every session\", () => {\n //given\n const sessions = [...Array(10).keys()].map((id) => {\n const session = deviceSessionStubBuilder(\n { id: id.toString() },\n () => logger,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n vi.spyOn(session, \"close\");\n return session;\n });\n sessions.forEach((session) => sessionService.addDeviceSession(session));\n const useCase = new CloseSessionsUseCase(sessionService, transportService);\n //when\n useCase.execute();\n //then\n for (const session of sessionService.getDeviceSessions()) {\n expect(session.close).toHaveBeenCalled();\n }\n });\n});\n"],
5
+ "mappings": "AAEA,OAAS,4CAAAA,MAAgD,4DACzD,OAAS,4BAAAC,MAAgC,oDACzC,OAAS,+BAAAC,MAAmC,+DAE5C,OAAS,wBAAAC,MAA4B,yDACrC,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,gEAExC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAGJ,SAAS,uBAAwB,IAAM,CACrC,WAAW,IAAM,CACfN,EAAS,IAAIN,EACX,CAAC,EACD,8BACF,EACAO,EAAuB,IAAIN,EAA0B,CAAC,CAAc,EACpEO,EAAa,IAAIN,EAAyBK,CAAoB,EAC9DE,EAA0B,IAAIN,EAC5B,CAAC,CACH,EACAO,EAAgB,IAAIN,EAA4BK,CAAuB,EACvEE,EAAiB,IAAIb,EAA4B,IAAMQ,CAAM,EAC7DM,EAAmB,IAAIP,CACzB,CAAC,EAED,GAAG,wCAAyC,IAAM,CAE/B,CAAC,GAAG,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,IAAKQ,GAAO,CACjD,MAAMC,EAAUjB,EACd,CAAE,GAAIgB,EAAG,SAAS,CAAE,EACpB,IAAMP,EACNE,EACAE,EACAd,CACF,EACA,UAAG,MAAMkB,EAAS,OAAO,EAClBA,CACT,CAAC,EACQ,QAASA,GAAYH,EAAe,iBAAiBG,CAAO,CAAC,EACtD,IAAIf,EAAqBY,EAAgBC,CAAgB,EAEjE,QAAQ,EAEhB,UAAWE,KAAWH,EAAe,kBAAkB,EACrD,OAAOG,EAAQ,KAAK,EAAE,iBAAiB,CAE3C,CAAC,CACH,CAAC",
6
+ "names": ["DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS", "deviceSessionStubBuilder", "DefaultDeviceSessionService", "CloseSessionsUseCase", "DefaultLoggerPublisherService", "AxiosManagerApiDataSource", "DefaultManagerApiService", "DefaultSecureChannelDataSource", "DefaultSecureChannelService", "DefaultTransportService", "logger", "managerApiDataSource", "managerApi", "secureChannelDataSource", "secureChannel", "sessionService", "transportService", "id", "session"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ContainerModule as i}from"inversify";import{ConnectUseCase as a}from"../../discovery/use-case/ConnectUseCase";import{DisconnectUseCase as C}from"../../discovery/use-case/DisconnectUseCase";import{GetConnectedDeviceUseCase as n}from"../../discovery/use-case/GetConnectedDeviceUseCase";import{ListConnectedDevicesUseCase as r}from"../../discovery/use-case/ListConnectedDevicesUseCase";import{ListenToAvailableDevicesUseCase as U}from"../../discovery/use-case/ListenToAvailableDevicesUseCase";import{ListenToConnectedDeviceUseCase as v}from"../../discovery/use-case/ListenToConnectedDeviceUseCase";import{StartDiscoveringUseCase as m}from"../../discovery/use-case/StartDiscoveringUseCase";import{StopDiscoveringUseCase as D}from"../../discovery/use-case/StopDiscoveringUseCase";import{StubUseCase as t}from"../../../../src/di.stub";import{discoveryTypes as e}from"./discoveryTypes";const P=({stub:c=!1})=>new i((o,p,f,s)=>{o(e.ConnectUseCase).to(a),o(e.DisconnectUseCase).to(C),o(e.StartDiscoveringUseCase).to(m),o(e.StopDiscoveringUseCase).to(D),o(e.GetConnectedDeviceUseCase).to(n),o(e.ListenToAvailableDevicesUseCase).to(U),o(e.ListenToConnectedDeviceUseCase).to(v),o(e.ListConnectedDevicesUseCase).to(r),c&&(s(e.StartDiscoveringUseCase).to(t),s(e.StopDiscoveringUseCase).to(t),s(e.ConnectUseCase).to(t),s(e.DisconnectUseCase).to(t),s(e.GetConnectedDeviceUseCase).to(t),s(e.ListenToAvailableDevicesUseCase).to(t),s(e.ListenToConnectedDeviceUseCase).to(t),s(e.ListConnectedDevicesUseCase).to(t))});export{P as discoveryModuleFactory};
1
+ import{ContainerModule as i}from"inversify";import{ConnectUseCase as C}from"../../discovery/use-case/ConnectUseCase";import{DisconnectUseCase as c}from"../../discovery/use-case/DisconnectUseCase";import{GetConnectedDeviceUseCase as r}from"../../discovery/use-case/GetConnectedDeviceUseCase";import{ListConnectedDevicesUseCase as n}from"../../discovery/use-case/ListConnectedDevicesUseCase";import{ListenToAvailableDevicesUseCase as U}from"../../discovery/use-case/ListenToAvailableDevicesUseCase";import{ListenToConnectedDeviceUseCase as v}from"../../discovery/use-case/ListenToConnectedDeviceUseCase";import{StartDiscoveringUseCase as m}from"../../discovery/use-case/StartDiscoveringUseCase";import{StopDiscoveringUseCase as D}from"../../discovery/use-case/StopDiscoveringUseCase";import{StubUseCase as t}from"../../../../src/di.stub";import{discoveryTypes as e}from"./discoveryTypes";const P=({stub:a=!1})=>new i(({bind:o,rebindSync:s})=>{o(e.ConnectUseCase).to(C),o(e.DisconnectUseCase).to(c),o(e.StartDiscoveringUseCase).to(m),o(e.StopDiscoveringUseCase).to(D),o(e.GetConnectedDeviceUseCase).to(r),o(e.ListenToAvailableDevicesUseCase).to(U),o(e.ListenToConnectedDeviceUseCase).to(v),o(e.ListConnectedDevicesUseCase).to(n),a&&(s(e.ConnectUseCase).to(t),s(e.DisconnectUseCase).to(t),s(e.StartDiscoveringUseCase).to(t),s(e.StopDiscoveringUseCase).to(t),s(e.GetConnectedDeviceUseCase).to(t),s(e.ListenToAvailableDevicesUseCase).to(t),s(e.ListenToConnectedDeviceUseCase).to(t),s(e.ListConnectedDevicesUseCase).to(t))});export{P as discoveryModuleFactory};
2
2
  //# sourceMappingURL=discoveryModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/discovery/di/discoveryModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { ConnectUseCase } from \"@internal/discovery/use-case/ConnectUseCase\";\nimport { DisconnectUseCase } from \"@internal/discovery/use-case/DisconnectUseCase\";\nimport { GetConnectedDeviceUseCase } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nimport { ListConnectedDevicesUseCase } from \"@internal/discovery/use-case/ListConnectedDevicesUseCase\";\nimport { ListenToAvailableDevicesUseCase } from \"@internal/discovery/use-case/ListenToAvailableDevicesUseCase\";\nimport { ListenToConnectedDeviceUseCase } from \"@internal/discovery/use-case/ListenToConnectedDeviceUseCase\";\nimport { StartDiscoveringUseCase } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nimport { StopDiscoveringUseCase } from \"@internal/discovery/use-case/StopDiscoveringUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { discoveryTypes } from \"./discoveryTypes\";\n\ntype FactoryProps = {\n stub: boolean;\n};\n\nexport const discoveryModuleFactory = ({ stub = false }: FactoryProps) =>\n new ContainerModule((bind, _unbind, _isBound, rebind) => {\n bind(discoveryTypes.ConnectUseCase).to(ConnectUseCase);\n bind(discoveryTypes.DisconnectUseCase).to(DisconnectUseCase);\n bind(discoveryTypes.StartDiscoveringUseCase).to(StartDiscoveringUseCase);\n bind(discoveryTypes.StopDiscoveringUseCase).to(StopDiscoveringUseCase);\n bind(discoveryTypes.GetConnectedDeviceUseCase).to(\n GetConnectedDeviceUseCase,\n );\n bind(discoveryTypes.ListenToAvailableDevicesUseCase).to(\n ListenToAvailableDevicesUseCase,\n );\n bind(discoveryTypes.ListenToConnectedDeviceUseCase).to(\n ListenToConnectedDeviceUseCase,\n );\n bind(discoveryTypes.ListConnectedDevicesUseCase).to(\n ListConnectedDevicesUseCase,\n );\n\n if (stub) {\n rebind(discoveryTypes.StartDiscoveringUseCase).to(StubUseCase);\n rebind(discoveryTypes.StopDiscoveringUseCase).to(StubUseCase);\n rebind(discoveryTypes.ConnectUseCase).to(StubUseCase);\n rebind(discoveryTypes.DisconnectUseCase).to(StubUseCase);\n rebind(discoveryTypes.GetConnectedDeviceUseCase).to(StubUseCase);\n rebind(discoveryTypes.ListenToAvailableDevicesUseCase).to(StubUseCase);\n rebind(discoveryTypes.ListenToConnectedDeviceUseCase).to(StubUseCase);\n rebind(discoveryTypes.ListConnectedDevicesUseCase).to(StubUseCase);\n }\n });\n"],
5
- "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,kBAAAC,MAAsB,8CAC/B,OAAS,qBAAAC,MAAyB,iDAClC,OAAS,6BAAAC,MAAiC,yDAC1C,OAAS,+BAAAC,MAAmC,2DAC5C,OAAS,mCAAAC,MAAuC,+DAChD,OAAS,kCAAAC,MAAsC,8DAC/C,OAAS,2BAAAC,MAA+B,uDACxC,OAAS,0BAAAC,MAA8B,sDACvC,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,kBAAAC,MAAsB,mBAMxB,MAAMC,EAAyB,CAAC,CAAE,KAAAC,EAAO,EAAM,IACpD,IAAIZ,EAAgB,CAACa,EAAMC,EAASC,EAAUC,IAAW,CACvDH,EAAKH,EAAe,cAAc,EAAE,GAAGT,CAAc,EACrDY,EAAKH,EAAe,iBAAiB,EAAE,GAAGR,CAAiB,EAC3DW,EAAKH,EAAe,uBAAuB,EAAE,GAAGH,CAAuB,EACvEM,EAAKH,EAAe,sBAAsB,EAAE,GAAGF,CAAsB,EACrEK,EAAKH,EAAe,yBAAyB,EAAE,GAC7CP,CACF,EACAU,EAAKH,EAAe,+BAA+B,EAAE,GACnDL,CACF,EACAQ,EAAKH,EAAe,8BAA8B,EAAE,GAClDJ,CACF,EACAO,EAAKH,EAAe,2BAA2B,EAAE,GAC/CN,CACF,EAEIQ,IACFI,EAAON,EAAe,uBAAuB,EAAE,GAAGD,CAAW,EAC7DO,EAAON,EAAe,sBAAsB,EAAE,GAAGD,CAAW,EAC5DO,EAAON,EAAe,cAAc,EAAE,GAAGD,CAAW,EACpDO,EAAON,EAAe,iBAAiB,EAAE,GAAGD,CAAW,EACvDO,EAAON,EAAe,yBAAyB,EAAE,GAAGD,CAAW,EAC/DO,EAAON,EAAe,+BAA+B,EAAE,GAAGD,CAAW,EACrEO,EAAON,EAAe,8BAA8B,EAAE,GAAGD,CAAW,EACpEO,EAAON,EAAe,2BAA2B,EAAE,GAAGD,CAAW,EAErE,CAAC",
6
- "names": ["ContainerModule", "ConnectUseCase", "DisconnectUseCase", "GetConnectedDeviceUseCase", "ListConnectedDevicesUseCase", "ListenToAvailableDevicesUseCase", "ListenToConnectedDeviceUseCase", "StartDiscoveringUseCase", "StopDiscoveringUseCase", "StubUseCase", "discoveryTypes", "discoveryModuleFactory", "stub", "bind", "_unbind", "_isBound", "rebind"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { ConnectUseCase } from \"@internal/discovery/use-case/ConnectUseCase\";\nimport { DisconnectUseCase } from \"@internal/discovery/use-case/DisconnectUseCase\";\nimport { GetConnectedDeviceUseCase } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nimport { ListConnectedDevicesUseCase } from \"@internal/discovery/use-case/ListConnectedDevicesUseCase\";\nimport { ListenToAvailableDevicesUseCase } from \"@internal/discovery/use-case/ListenToAvailableDevicesUseCase\";\nimport { ListenToConnectedDeviceUseCase } from \"@internal/discovery/use-case/ListenToConnectedDeviceUseCase\";\nimport { StartDiscoveringUseCase } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nimport { StopDiscoveringUseCase } from \"@internal/discovery/use-case/StopDiscoveringUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { discoveryTypes } from \"./discoveryTypes\";\n\ntype FactoryProps = {\n stub: boolean;\n};\n\nexport const discoveryModuleFactory = ({ stub = false }: FactoryProps) =>\n new ContainerModule(({ bind, rebindSync }) => {\n bind(discoveryTypes.ConnectUseCase).to(ConnectUseCase);\n bind(discoveryTypes.DisconnectUseCase).to(DisconnectUseCase);\n bind(discoveryTypes.StartDiscoveringUseCase).to(StartDiscoveringUseCase);\n bind(discoveryTypes.StopDiscoveringUseCase).to(StopDiscoveringUseCase);\n bind(discoveryTypes.GetConnectedDeviceUseCase).to(\n GetConnectedDeviceUseCase,\n );\n bind(discoveryTypes.ListenToAvailableDevicesUseCase).to(\n ListenToAvailableDevicesUseCase,\n );\n bind(discoveryTypes.ListenToConnectedDeviceUseCase).to(\n ListenToConnectedDeviceUseCase,\n );\n bind(discoveryTypes.ListConnectedDevicesUseCase).to(\n ListConnectedDevicesUseCase,\n );\n\n if (stub) {\n rebindSync(discoveryTypes.ConnectUseCase).to(StubUseCase);\n rebindSync(discoveryTypes.DisconnectUseCase).to(StubUseCase);\n rebindSync(discoveryTypes.StartDiscoveringUseCase).to(StubUseCase);\n rebindSync(discoveryTypes.StopDiscoveringUseCase).to(StubUseCase);\n rebindSync(discoveryTypes.GetConnectedDeviceUseCase).to(StubUseCase);\n rebindSync(discoveryTypes.ListenToAvailableDevicesUseCase).to(\n StubUseCase,\n );\n rebindSync(discoveryTypes.ListenToConnectedDeviceUseCase).to(StubUseCase);\n rebindSync(discoveryTypes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ACxEK,EAAWJ,EAAe,2BAA2B,EAAE,GAAGD,CAAW,EAEzE,CAAC",
6
+ "names": ["ContainerModule", "ConnectUseCase", "DisconnectUseCase", "GetConnectedDeviceUseCase", "ListConnectedDevicesUseCase", "ListenToAvailableDevicesUseCase", "ListenToConnectedDeviceUseCase", "StartDiscoveringUseCase", "StopDiscoveringUseCase", "StubUseCase", "discoveryTypes", "discoveryModuleFactory", "stub", "bind", "rebindSync"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Container as p}from"inversify";import{TransportMock as f}from"../../../api/transport/model/__mocks__/TransportMock";import{deviceModelModuleFactory as l}from"../../device-model/di/deviceModelModule";import{deviceSessionModuleFactory as d}from"../../device-session/di/deviceSessionModule";import{ConnectUseCase as C}from"../../discovery/use-case/ConnectUseCase";import{DisconnectUseCase as v}from"../../discovery/use-case/DisconnectUseCase";import{ListConnectedDevicesUseCase as u}from"../../discovery/use-case/ListConnectedDevicesUseCase";import{ListenToAvailableDevicesUseCase as g}from"../../discovery/use-case/ListenToAvailableDevicesUseCase";import{StartDiscoveringUseCase as U}from"../../discovery/use-case/StartDiscoveringUseCase";import{StopDiscoveringUseCase as y}from"../../discovery/use-case/StopDiscoveringUseCase";import{loggerModuleFactory as D}from"../../logger-publisher/di/loggerModule";import{managerApiModuleFactory as k}from"../../manager-api/di/managerApiModule";import{secureChannelModuleFactory as M}from"../../secure-channel/di/secureChannelModule";import{transportModuleFactory as b}from"../../transport/di/transportModule";import{discoveryModuleFactory as F}from"./discoveryModule";import{discoveryTypes as o}from"./discoveryTypes";describe("discoveryModuleFactory",()=>{let e,t,s;beforeEach(()=>{t=F({stub:!1}),e=new p,s=new f,e.load(t,D(),l({stub:!1}),d(),b({transports:[vi.fn().mockImplementation(()=>s)]}),k({config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url"}}),M({config:{webSocketUrl:"http://fake-websocket.url"}}))}),it("should return the device module",()=>{expect(t).toBeDefined()}),it("should return none mocked use cases",()=>{const r=e.get(o.StartDiscoveringUseCase);expect(r).toBeInstanceOf(U);const n=e.get(o.StopDiscoveringUseCase);expect(n).toBeInstanceOf(y);const c=e.get(o.DisconnectUseCase);expect(c).toBeInstanceOf(v);const i=e.get(o.ConnectUseCase);expect(i).toBeInstanceOf(C);const a=e.get(o.ListenToAvailableDevicesUseCase);expect(a).toBeInstanceOf(g);const m=e.get(o.ListConnectedDevicesUseCase);expect(m).toBeInstanceOf(u)})});
1
+ import{Container as p}from"inversify";import{TransportMock as f}from"../../../api/transport/model/__mocks__/TransportMock";import{deviceModelModuleFactory as l}from"../../device-model/di/deviceModelModule";import{deviceSessionModuleFactory as d}from"../../device-session/di/deviceSessionModule";import{ConnectUseCase as C}from"../../discovery/use-case/ConnectUseCase";import{DisconnectUseCase as v}from"../../discovery/use-case/DisconnectUseCase";import{ListConnectedDevicesUseCase as u}from"../../discovery/use-case/ListConnectedDevicesUseCase";import{ListenToAvailableDevicesUseCase as g}from"../../discovery/use-case/ListenToAvailableDevicesUseCase";import{StartDiscoveringUseCase as U}from"../../discovery/use-case/StartDiscoveringUseCase";import{StopDiscoveringUseCase as y}from"../../discovery/use-case/StopDiscoveringUseCase";import{loggerModuleFactory as D}from"../../logger-publisher/di/loggerModule";import{managerApiModuleFactory as k}from"../../manager-api/di/managerApiModule";import{secureChannelModuleFactory as M}from"../../secure-channel/di/secureChannelModule";import{transportModuleFactory as b}from"../../transport/di/transportModule";import{discoveryModuleFactory as F}from"./discoveryModule";import{discoveryTypes as o}from"./discoveryTypes";describe("discoveryModuleFactory",()=>{let e,t,s;beforeEach(()=>{t=F({stub:!1}),e=new p,s=new f,e.loadSync(t,D(),l({stub:!1}),d(),b({transports:[vi.fn().mockImplementation(()=>s)]}),k({config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url"}}),M({config:{webSocketUrl:"http://fake-websocket.url"}}))}),it("should return the device module",()=>{expect(t).toBeDefined()}),it("should return none mocked use cases",()=>{const r=e.get(o.StartDiscoveringUseCase);expect(r).toBeInstanceOf(U);const n=e.get(o.StopDiscoveringUseCase);expect(n).toBeInstanceOf(y);const c=e.get(o.DisconnectUseCase);expect(c).toBeInstanceOf(v);const i=e.get(o.ConnectUseCase);expect(i).toBeInstanceOf(C);const a=e.get(o.ListenToAvailableDevicesUseCase);expect(a).toBeInstanceOf(g);const m=e.get(o.ListConnectedDevicesUseCase);expect(m).toBeInstanceOf(u)})});
2
2
  //# sourceMappingURL=discoveryModule.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/discovery/di/discoveryModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { TransportMock } from \"@api/transport/model/__mocks__/TransportMock\";\nimport { type DmkConfig, type Transport } from \"@api/types\";\nimport { deviceModelModuleFactory } from \"@internal/device-model/di/deviceModelModule\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { ConnectUseCase } from \"@internal/discovery/use-case/ConnectUseCase\";\nimport { DisconnectUseCase } from \"@internal/discovery/use-case/DisconnectUseCase\";\nimport { ListConnectedDevicesUseCase } from \"@internal/discovery/use-case/ListConnectedDevicesUseCase\";\nimport { ListenToAvailableDevicesUseCase } from \"@internal/discovery/use-case/ListenToAvailableDevicesUseCase\";\nimport { StartDiscoveringUseCase } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nimport { StopDiscoveringUseCase } from \"@internal/discovery/use-case/StopDiscoveringUseCase\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { managerApiModuleFactory } from \"@internal/manager-api/di/managerApiModule\";\nimport { secureChannelModuleFactory } from \"@internal/secure-channel/di/secureChannelModule\";\nimport { transportModuleFactory } from \"@internal/transport/di/transportModule\";\n\nimport { discoveryModuleFactory } from \"./discoveryModule\";\nimport { discoveryTypes } from \"./discoveryTypes\";\n\ndescribe(\"discoveryModuleFactory\", () => {\n let container: Container;\n let mod: ReturnType<typeof discoveryModuleFactory>;\n let transport: Transport;\n beforeEach(() => {\n mod = discoveryModuleFactory({ stub: false });\n container = new Container();\n transport = new TransportMock();\n\n container.load(\n mod,\n // The following modules are injected into discovery module\n loggerModuleFactory(),\n deviceModelModuleFactory({ stub: false }),\n deviceSessionModuleFactory(),\n transportModuleFactory({\n transports: [vi.fn().mockImplementation(() => transport)],\n }),\n managerApiModuleFactory({\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n } as DmkConfig,\n }),\n secureChannelModuleFactory({\n config: {\n webSocketUrl: \"http://fake-websocket.url\",\n } as DmkConfig,\n }),\n );\n });\n it(\"should return the device module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return none mocked use cases\", () => {\n const startDiscoveringUseCase = container.get(\n discoveryTypes.StartDiscoveringUseCase,\n );\n expect(startDiscoveringUseCase).toBeInstanceOf(StartDiscoveringUseCase);\n\n const stopDiscoveringUseCase = container.get(\n discoveryTypes.StopDiscoveringUseCase,\n );\n expect(stopDiscoveringUseCase).toBeInstanceOf(StopDiscoveringUseCase);\n\n const disconnectUseCase = container.get(discoveryTypes.DisconnectUseCase);\n expect(disconnectUseCase).toBeInstanceOf(DisconnectUseCase);\n\n const connectUseCase = container.get(discoveryTypes.ConnectUseCase);\n expect(connectUseCase).toBeInstanceOf(ConnectUseCase);\n\n const listenToAvailableDevicesUseCase = container.get(\n discoveryTypes.ListenToAvailableDevicesUseCase,\n );\n expect(listenToAvailableDevicesUseCase).toBeInstanceOf(\n ListenToAvailableDevicesUseCase,\n );\n const listConnectedDevicesUseCase = container.get(\n discoveryTypes.ListConnectedDevicesUseCase,\n );\n expect(listConnectedDevicesUseCase).toBeInstanceOf(\n ListConnectedDevicesUseCase,\n );\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,aAAAA,MAAiB,YAE1B,OAAS,iBAAAC,MAAqB,+CAE9B,OAAS,4BAAAC,MAAgC,8CACzC,OAAS,8BAAAC,MAAkC,kDAC3C,OAAS,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AClE,OAAOO,CAAc,EAAE,eAAelB,CAAc,EAEpD,MAAMmB,EAAkCP,EAAU,IAChDD,EAAe,+BACjB,EACA,OAAOQ,CAA+B,EAAE,eACtChB,CACF,EACA,MAAMiB,EAA8BR,EAAU,IAC5CD,EAAe,2BACjB,EACA,OAAOS,CAA2B,EAAE,eAClClB,CACF,CACF,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { TransportMock } from \"@api/transport/model/__mocks__/TransportMock\";\nimport { type DmkConfig, type Transport } from \"@api/types\";\nimport { deviceModelModuleFactory } from \"@internal/device-model/di/deviceModelModule\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { ConnectUseCase } from \"@internal/discovery/use-case/ConnectUseCase\";\nimport { DisconnectUseCase } from \"@internal/discovery/use-case/DisconnectUseCase\";\nimport { ListConnectedDevicesUseCase } from \"@internal/discovery/use-case/ListConnectedDevicesUseCase\";\nimport { ListenToAvailableDevicesUseCase } from \"@internal/discovery/use-case/ListenToAvailableDevicesUseCase\";\nimport { StartDiscoveringUseCase } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nimport { StopDiscoveringUseCase } from \"@internal/discovery/use-case/StopDiscoveringUseCase\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { managerApiModuleFactory } from \"@internal/manager-api/di/managerApiModule\";\nimport { secureChannelModuleFactory } from \"@internal/secure-channel/di/secureChannelModule\";\nimport { transportModuleFactory } from \"@internal/transport/di/transportModule\";\n\nimport { discoveryModuleFactory } from \"./discoveryModule\";\nimport { discoveryTypes } from \"./discoveryTypes\";\n\ndescribe(\"discoveryModuleFactory\", () => {\n let container: Container;\n let mod: ReturnType<typeof discoveryModuleFactory>;\n let transport: Transport;\n beforeEach(() => {\n mod = discoveryModuleFactory({ stub: false });\n container = new Container();\n transport = new TransportMock();\n\n container.loadSync(\n mod,\n // The following modules are injected into discovery module\n loggerModuleFactory(),\n deviceModelModuleFactory({ stub: false }),\n deviceSessionModuleFactory(),\n transportModuleFactory({\n transports: [vi.fn().mockImplementation(() => transport)],\n }),\n managerApiModuleFactory({\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n } as DmkConfig,\n }),\n secureChannelModuleFactory({\n config: {\n webSocketUrl: \"http://fake-websocket.url\",\n } as DmkConfig,\n }),\n );\n });\n it(\"should return the device module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return none mocked use cases\", () => {\n const startDiscoveringUseCase = container.get(\n discoveryTypes.StartDiscoveringUseCase,\n );\n expect(startDiscoveringUseCase).toBeInstanceOf(StartDiscoveringUseCase);\n\n const stopDiscoveringUseCase = container.get(\n discoveryTypes.StopDiscoveringUseCase,\n );\n expect(stopDiscoveringUseCase).toBeInstanceOf(StopDiscoveringUseCase);\n\n const disconnectUseCase = container.get(discoveryTypes.DisconnectUseCase);\n expect(disconnectUseCase).toBeInstanceOf(DisconnectUseCase);\n\n const connectUseCase = container.get(discoveryTypes.ConnectUseCase);\n expect(connectUseCase).toBeInstanceOf(ConnectUseCase);\n\n const listenToAvailableDevicesUseCase = container.get(\n discoveryTypes.ListenToAvailableDevicesUseCase,\n );\n expect(listenToAvailableDevicesUseCase).toBeInstanceOf(\n ListenToAvailableDevicesUseCase,\n );\n const listConnectedDevicesUseCase = container.get(\n discoveryTypes.ListConnectedDevicesUseCase,\n );\n expect(listConnectedDevicesUseCase).toBeInstanceOf(\n ListConnectedDevicesUseCase,\n );\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,aAAAA,MAAiB,YAE1B,OAAS,iBAAAC,MAAqB,+CAE9B,OAAS,4BAAAC,MAAgC,8CACzC,OAAS,8BAAAC,MAAkC,kDAC3C,OAAS,kBAAAC,MAAsB,8CAC/B,OAAS,qBAAAC,MAAyB,iDAClC,OAAS,+BAAAC,MAAmC,2DAC5C,OAAS,mCAAAC,MAAuC,+DAChD,OAAS,2BAAAC,MAA+B,uDACx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,EAA8BR,EAAU,IAC5CD,EAAe,2BACjB,EACA,OAAOS,CAA2B,EAAE,eAClClB,CACF,CACF,CAAC,CACH,CAAC",
6
6
  "names": ["Container", "TransportMock", "deviceModelModuleFactory", "deviceSessionModuleFactory", "ConnectUseCase", "DisconnectUseCase", "ListConnectedDevicesUseCase", "ListenToAvailableDevicesUseCase", "StartDiscoveringUseCase", "StopDiscoveringUseCase", "loggerModuleFactory", "managerApiModuleFactory", "secureChannelModuleFactory", "transportModuleFactory", "discoveryModuleFactory", "discoveryTypes", "container", "mod", "transport", "startDiscoveringUseCase", "stopDiscoveringUseCase", "disconnectUseCase", "connectUseCase", "listenToAvailableDevicesUseCase", "listConnectedDevicesUseCase"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Left as D,Maybe as y,Right as s}from"purify-ts";import{TransportMock as C}from"../../../api/transport/model/__mocks__/TransportMock";import{DisconnectError as S}from"../../../api/transport/model/Errors";import{connectedDeviceStubBuilder as h}from"../../../api/transport/model/TransportConnectedDevice.stub";import{DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS as v}from"../../device-session/data/DeviceSessionRefresherConst";import{deviceSessionStubBuilder as u}from"../../device-session/model/DeviceSession.stub";import{DeviceSessionNotFound as w}from"../../device-session/model/Errors";import{DefaultDeviceSessionService as g}from"../../device-session/service/DefaultDeviceSessionService";import{DefaultLoggerPublisherService as T}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as k}from"../../manager-api/data/AxiosManagerApiDataSource";import{DefaultManagerApiService as A}from"../../manager-api/service/DefaultManagerApiService";import{DefaultSecureChannelDataSource as E}from"../../secure-channel/data/DefaultSecureChannelDataSource";import{DefaultSecureChannelService as I}from"../../secure-channel/service/DefaultSecureChannelService";import{DefaultTransportService as O}from"../../transport/service/DefaultTransportService";import{DisconnectUseCase as a}from"./DisconnectUseCase";vi.mock("@internal/transport/service/DefaultTransportService");let e,p,c=[];const r=vi.fn().mockReturnValue(new T([],"DisconnectUseCaseTest"));let i,m,f,d,l;const n="sessionId";describe("DisconnectUseCase",()=>{beforeAll(()=>{p=new C,c=[p],e=new g(r),i=new O,vi.spyOn(i,"getTransport").mockReturnValue(y.of(p))}),it("should disconnect from a device",async()=>{const t=h();f=new k({}),m=new A(f),d=new E({}),l=new I(d);const o=u({id:n,connectedDevice:t},r,m,l,v);vi.spyOn(e,"getDeviceSessionById").mockImplementation(()=>s(o)),vi.spyOn(o,"close"),vi.spyOn(e,"removeDeviceSession"),vi.spyOn(c[0],"disconnect").mockImplementation(()=>Promise.resolve(s(void 0))),await new a(i,e,r).execute({sessionId:n}),expect(o.close).toHaveBeenCalled(),expect(e.removeDeviceSession).toHaveBeenCalledWith(n),expect(c[0].disconnect).toHaveBeenCalledWith({connectedDevice:t})}),it("should throw an error when deviceSession not found",async()=>{const t=new a(i,e,r);try{await t.execute({sessionId:n})}catch(o){expect(o).toStrictEqual(new w)}}),it("should throw an error if usb hid disconnection fails",async()=>{vi.spyOn(e,"getDeviceSessionById").mockImplementation(()=>s(u({id:n},r,m,l,v))),vi.spyOn(c[0],"disconnect").mockResolvedValue(D(new S));const t=new a(i,e,r);try{await t.execute({sessionId:n})}catch(o){expect(o).toStrictEqual(new S)}})});
1
+ import{Left as D,Maybe as y,Right as s}from"purify-ts";import{TransportMock as C}from"../../../api/transport/model/__mocks__/TransportMock";import{DisconnectError as S}from"../../../api/transport/model/Errors";import{connectedDeviceStubBuilder as h}from"../../../api/transport/model/TransportConnectedDevice.stub";import{DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS as u}from"../../device-session/data/DeviceSessionRefresherConst";import{deviceSessionStubBuilder as v}from"../../device-session/model/DeviceSession.stub";import{DeviceSessionNotFound as w}from"../../device-session/model/Errors";import{DefaultDeviceSessionService as g}from"../../device-session/service/DefaultDeviceSessionService";import{DefaultLoggerPublisherService as T}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as k}from"../../manager-api/data/AxiosManagerApiDataSource";import{DefaultManagerApiService as A}from"../../manager-api/service/DefaultManagerApiService";import{DefaultSecureChannelDataSource as E}from"../../secure-channel/data/DefaultSecureChannelDataSource";import{DefaultSecureChannelService as I}from"../../secure-channel/service/DefaultSecureChannelService";import{DefaultTransportService as O}from"../../transport/service/DefaultTransportService";import{DisconnectUseCase as a}from"./DisconnectUseCase";vi.mock("@internal/transport/service/DefaultTransportService");let e,p,c=[];const r=vi.fn().mockReturnValue(new T([],"DisconnectUseCaseTest"));let i,m,f,d,l;const n="sessionId";describe("DisconnectUseCase",()=>{beforeAll(()=>{p=new C,c=[p],e=new g(r),i=new O,vi.spyOn(i,"getTransport").mockReturnValue(y.of(p))}),it("should disconnect from a device",async()=>{const t=h();f=new k({}),m=new A(f),d=new E({}),l=new I(d);const o=v({id:n,connectedDevice:t},r,m,l,u);vi.spyOn(e,"getDeviceSessionById").mockImplementation(()=>s(o)),vi.spyOn(o,"close"),vi.spyOn(e,"removeDeviceSession"),vi.spyOn(c[0],"disconnect").mockImplementation(()=>Promise.resolve(s(void 0))),await new a(i,e,r).execute({sessionId:n}),expect(o.close).toHaveBeenCalled(),expect(e.removeDeviceSession).toHaveBeenCalledWith(n),expect(c[0].disconnect).toHaveBeenCalledWith({connectedDevice:t})}),it("should throw an error when deviceSession not found",async()=>{const t=new a(i,e,r);try{await t.execute({sessionId:n})}catch(o){expect(o).toStrictEqual(new w)}}),it("should throw an error if usb hid disconnection fails",async()=>{vi.spyOn(e,"getDeviceSessionById").mockImplementation(()=>s(v({id:n},r,m,l,u))),vi.spyOn(c[0],"disconnect").mockResolvedValue(D(new S));const t=new a(i,e,r);try{await t.execute({sessionId:n})}catch(o){expect(o).toStrictEqual(new S)}})});
2
2
  //# sourceMappingURL=DisconnectUseCase.test.js.map