@ledgerhq/device-management-kit 0.7.0 → 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 (388) hide show
  1. package/lib/cjs/package.json +1 -2
  2. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  3. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +2 -2
  4. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
  5. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
  6. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
  7. package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
  8. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js +1 -1
  9. package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
  10. package/lib/cjs/src/api/command/di/commandModule.js +1 -1
  11. package/lib/cjs/src/api/command/di/commandModule.js.map +3 -3
  12. package/lib/cjs/src/api/command/di/commandModule.test.js +1 -1
  13. package/lib/cjs/src/api/command/di/commandModule.test.js.map +2 -2
  14. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  15. package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  16. package/lib/cjs/src/api/command/utils/CommandUtils.js +1 -1
  17. package/lib/cjs/src/api/command/utils/CommandUtils.js.map +2 -2
  18. package/lib/cjs/src/api/command/utils/CommandUtils.test.js +1 -1
  19. package/lib/cjs/src/api/command/utils/CommandUtils.test.js.map +2 -2
  20. package/lib/cjs/src/api/command/utils/GlobalCommandError.js +1 -1
  21. package/lib/cjs/src/api/command/utils/GlobalCommandError.js.map +2 -2
  22. package/lib/cjs/src/api/device/DeviceModel.js +1 -1
  23. package/lib/cjs/src/api/device/DeviceModel.js.map +2 -2
  24. package/lib/cjs/src/api/device-action/di/deviceActionModule.js +1 -1
  25. package/lib/cjs/src/api/device-action/di/deviceActionModule.js.map +3 -3
  26. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js +1 -1
  27. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  28. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
  29. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  30. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  31. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
  32. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +1 -1
  33. package/lib/cjs/src/api/device-action/os/Errors.js +1 -1
  34. package/lib/cjs/src/api/device-action/os/Errors.js.map +3 -3
  35. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
  36. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
  37. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +1 -1
  38. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  39. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
  40. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  41. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
  42. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
  43. package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
  44. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
  45. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +2 -2
  46. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -1
  47. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +1 -1
  48. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  49. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
  50. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  51. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
  52. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -1
  53. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js.map +1 -1
  54. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
  55. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +2 -2
  56. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +1 -1
  57. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  58. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
  59. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js +1 -1
  60. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +1 -1
  61. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +1 -1
  62. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +2 -2
  63. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +1 -1
  64. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +2 -2
  65. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  66. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
  67. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.js +1 -1
  68. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.js.map +2 -2
  69. package/lib/cjs/src/api/device-model/model/DeviceModel.js +1 -1
  70. package/lib/cjs/src/api/device-model/model/DeviceModel.js.map +2 -2
  71. package/lib/cjs/src/api/index.js +1 -1
  72. package/lib/cjs/src/api/index.js.map +2 -2
  73. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
  74. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  75. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +1 -1
  76. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
  77. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
  78. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js +1 -1
  79. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +1 -1
  80. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
  81. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
  82. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
  83. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
  84. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
  85. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +2 -2
  86. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js +1 -1
  87. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +1 -1
  88. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  89. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  90. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
  91. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
  92. package/lib/cjs/src/api/secure-channel/task/types.js +1 -1
  93. package/lib/cjs/src/api/secure-channel/task/types.js.map +2 -2
  94. package/lib/cjs/src/api/secure-channel/utils.js +1 -1
  95. package/lib/cjs/src/api/secure-channel/utils.js.map +3 -3
  96. package/lib/cjs/src/api/secure-channel/utils.test.js +1 -1
  97. package/lib/cjs/src/api/secure-channel/utils.test.js.map +3 -3
  98. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  99. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
  100. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js +2 -0
  101. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
  102. package/lib/cjs/src/api/transport/model/Errors.js +1 -1
  103. package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
  104. package/lib/cjs/src/api/utils/AppName.js +2 -0
  105. package/lib/cjs/src/api/utils/AppName.js.map +7 -0
  106. package/lib/cjs/src/api/utils/AppName.test.js +2 -0
  107. package/lib/cjs/src/api/utils/AppName.test.js.map +7 -0
  108. package/lib/cjs/src/di.js +1 -1
  109. package/lib/cjs/src/di.js.map +2 -2
  110. package/lib/cjs/src/internal/config/di/configModule.js +1 -1
  111. package/lib/cjs/src/internal/config/di/configModule.js.map +3 -3
  112. package/lib/cjs/src/internal/config/di/configModule.test.js +1 -1
  113. package/lib/cjs/src/internal/config/di/configModule.test.js.map +2 -2
  114. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js +1 -1
  115. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  116. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  117. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  118. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  119. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  120. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  121. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  122. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  123. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  124. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  125. package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  126. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  127. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  128. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  129. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  130. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js +1 -1
  131. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  132. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  133. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  134. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
  135. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  136. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  137. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  138. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  139. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  140. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  141. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  142. package/lib/cjs/src/internal/secure-channel/model/Errors.js +1 -1
  143. package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +3 -3
  144. package/lib/cjs/src/internal/send/di/sendModule.js +1 -1
  145. package/lib/cjs/src/internal/send/di/sendModule.js.map +3 -3
  146. package/lib/cjs/src/internal/send/di/sendModule.test.js +1 -1
  147. package/lib/cjs/src/internal/send/di/sendModule.test.js.map +2 -2
  148. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js +1 -1
  149. package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
  150. package/lib/cjs/src/internal/transport/di/transportModule.js +1 -1
  151. package/lib/cjs/src/internal/transport/di/transportModule.js.map +3 -3
  152. package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
  153. package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
  154. package/lib/esm/package.json +1 -2
  155. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  156. package/lib/esm/src/api/DeviceManagementKit.test.js.map +2 -2
  157. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
  158. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
  159. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
  160. package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
  161. package/lib/esm/src/api/apdu/utils/ByteArrayParser.js +1 -1
  162. package/lib/esm/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
  163. package/lib/esm/src/api/command/di/commandModule.js +1 -1
  164. package/lib/esm/src/api/command/di/commandModule.js.map +3 -3
  165. package/lib/esm/src/api/command/di/commandModule.test.js +1 -1
  166. package/lib/esm/src/api/command/di/commandModule.test.js.map +2 -2
  167. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
  168. package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
  169. package/lib/esm/src/api/command/utils/CommandUtils.js +1 -1
  170. package/lib/esm/src/api/command/utils/CommandUtils.js.map +3 -3
  171. package/lib/esm/src/api/command/utils/CommandUtils.test.js +1 -1
  172. package/lib/esm/src/api/command/utils/CommandUtils.test.js.map +2 -2
  173. package/lib/esm/src/api/command/utils/GlobalCommandError.js +1 -1
  174. package/lib/esm/src/api/command/utils/GlobalCommandError.js.map +2 -2
  175. package/lib/esm/src/api/device/DeviceModel.js +1 -1
  176. package/lib/esm/src/api/device/DeviceModel.js.map +2 -2
  177. package/lib/esm/src/api/device-action/di/deviceActionModule.js +1 -1
  178. package/lib/esm/src/api/device-action/di/deviceActionModule.js.map +3 -3
  179. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js +1 -1
  180. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  181. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
  182. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  183. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
  184. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
  185. package/lib/esm/src/api/device-action/os/Errors.js +1 -1
  186. package/lib/esm/src/api/device-action/os/Errors.js.map +3 -3
  187. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
  188. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
  189. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  190. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
  191. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  192. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
  193. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
  194. package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
  195. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
  196. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +2 -2
  197. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  198. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
  199. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  200. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
  201. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
  202. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +2 -2
  203. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
  204. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
  205. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js +1 -1
  206. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +3 -3
  207. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +1 -1
  208. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +3 -3
  209. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  210. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
  211. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.js +1 -1
  212. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.js.map +2 -2
  213. package/lib/esm/src/api/device-model/model/DeviceModel.js +1 -1
  214. package/lib/esm/src/api/device-model/model/DeviceModel.js.map +2 -2
  215. package/lib/esm/src/api/index.js +1 -1
  216. package/lib/esm/src/api/index.js.map +3 -3
  217. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
  218. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  219. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
  220. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
  221. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
  222. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
  223. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
  224. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
  225. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
  226. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +2 -2
  227. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  228. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  229. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
  230. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
  231. package/lib/esm/src/api/secure-channel/task/types.js +1 -1
  232. package/lib/esm/src/api/secure-channel/task/types.js.map +2 -2
  233. package/lib/esm/src/api/secure-channel/utils.js +1 -1
  234. package/lib/esm/src/api/secure-channel/utils.js.map +3 -3
  235. package/lib/esm/src/api/secure-channel/utils.test.js +1 -1
  236. package/lib/esm/src/api/secure-channel/utils.test.js.map +3 -3
  237. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  238. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
  239. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js +2 -0
  240. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
  241. package/lib/esm/src/api/transport/model/Errors.js +1 -1
  242. package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
  243. package/lib/esm/src/api/utils/AppName.js +2 -0
  244. package/lib/esm/src/api/utils/AppName.js.map +7 -0
  245. package/lib/esm/src/api/utils/AppName.test.js +2 -0
  246. package/lib/esm/src/api/utils/AppName.test.js.map +7 -0
  247. package/lib/esm/src/di.js +1 -1
  248. package/lib/esm/src/di.js.map +2 -2
  249. package/lib/esm/src/internal/config/di/configModule.js +1 -1
  250. package/lib/esm/src/internal/config/di/configModule.js.map +3 -3
  251. package/lib/esm/src/internal/config/di/configModule.test.js +1 -1
  252. package/lib/esm/src/internal/config/di/configModule.test.js.map +2 -2
  253. package/lib/esm/src/internal/device-model/di/deviceModelModule.js +1 -1
  254. package/lib/esm/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  255. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  256. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  257. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  258. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  259. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  260. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  261. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
  262. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
  263. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
  264. package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
  265. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  266. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  267. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  268. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  269. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js +1 -1
  270. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  271. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  272. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  273. package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
  274. package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  275. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  276. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  277. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  278. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  279. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  280. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  281. package/lib/esm/src/internal/secure-channel/model/Errors.js +1 -1
  282. package/lib/esm/src/internal/secure-channel/model/Errors.js.map +3 -3
  283. package/lib/esm/src/internal/send/di/sendModule.js +1 -1
  284. package/lib/esm/src/internal/send/di/sendModule.js.map +3 -3
  285. package/lib/esm/src/internal/send/di/sendModule.test.js +1 -1
  286. package/lib/esm/src/internal/send/di/sendModule.test.js.map +2 -2
  287. package/lib/esm/src/internal/send/use-case/SendApduUseCase.js +1 -1
  288. package/lib/esm/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
  289. package/lib/esm/src/internal/transport/di/transportModule.js +1 -1
  290. package/lib/esm/src/internal/transport/di/transportModule.js.map +3 -3
  291. package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
  292. package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
  293. package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts.map +1 -1
  294. package/lib/types/src/api/apdu/utils/ApduParser.d.ts.map +1 -1
  295. package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts +28 -0
  296. package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts.map +1 -1
  297. package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts +1 -0
  298. package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts.map +1 -1
  299. package/lib/types/src/api/command/di/commandModule.d.ts.map +1 -1
  300. package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
  301. package/lib/types/src/api/command/utils/CommandErrors.d.ts.map +1 -1
  302. package/lib/types/src/api/command/utils/CommandUtils.d.ts +3 -0
  303. package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
  304. package/lib/types/src/api/command/utils/GlobalCommandError.d.ts +1 -1
  305. package/lib/types/src/api/command/utils/GlobalCommandError.d.ts.map +1 -1
  306. package/lib/types/src/api/device/DeviceModel.d.ts +2 -1
  307. package/lib/types/src/api/device/DeviceModel.d.ts.map +1 -1
  308. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
  309. package/lib/types/src/api/device-action/di/deviceActionModule.d.ts.map +1 -1
  310. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +1 -0
  311. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
  312. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -1
  313. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +0 -1
  314. package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -1
  315. package/lib/types/src/api/device-action/os/Errors.d.ts +10 -0
  316. package/lib/types/src/api/device-action/os/Errors.d.ts.map +1 -1
  317. package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map +1 -1
  318. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +2 -1
  319. package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -1
  320. package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
  321. package/lib/types/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.d.ts.map +1 -1
  322. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -1
  323. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +3 -2
  324. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -1
  325. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts.map +1 -1
  326. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts +0 -1
  327. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
  328. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -1
  329. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +0 -1
  330. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -1
  331. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.d.ts.map +1 -1
  332. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts +0 -1
  333. package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
  334. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts +2 -2
  335. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -1
  336. package/lib/types/src/api/device-model/data/StaticDeviceModelDataSource.d.ts.map +1 -1
  337. package/lib/types/src/api/device-model/model/DeviceModel.d.ts.map +1 -1
  338. package/lib/types/src/api/device-session/service/DefaultApduReceiverService.stub.d.ts.map +1 -1
  339. package/lib/types/src/api/device-session/service/DefaultApduSenderService.stub.d.ts.map +1 -1
  340. package/lib/types/src/api/index.d.ts +1 -1
  341. package/lib/types/src/api/index.d.ts.map +1 -1
  342. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -1
  343. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +2 -1
  344. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -1
  345. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -1
  346. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts +2 -1
  347. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts.map +1 -1
  348. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -1
  349. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts +2 -1
  350. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts.map +1 -1
  351. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts.map +1 -1
  352. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts +2 -1
  353. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -1
  354. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +5 -2
  355. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -1
  356. package/lib/types/src/api/secure-channel/task/types.d.ts +6 -1
  357. package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -1
  358. package/lib/types/src/api/secure-channel/utils.d.ts +0 -11
  359. package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -1
  360. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +8 -7
  361. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -1
  362. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts +2 -0
  363. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts.map +1 -0
  364. package/lib/types/src/api/transport/model/Errors.d.ts +5 -0
  365. package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
  366. package/lib/types/src/api/utils/AppName.d.ts +2 -0
  367. package/lib/types/src/api/utils/AppName.d.ts.map +1 -0
  368. package/lib/types/src/api/utils/AppName.test.d.ts +2 -0
  369. package/lib/types/src/api/utils/AppName.test.d.ts.map +1 -0
  370. package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
  371. package/lib/types/src/di.d.ts.map +1 -1
  372. package/lib/types/src/internal/config/di/configModule.d.ts.map +1 -1
  373. package/lib/types/src/internal/device-model/di/deviceModelModule.d.ts.map +1 -1
  374. package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
  375. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
  376. package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts.map +1 -1
  377. package/lib/types/src/internal/discovery/di/discoveryModule.d.ts.map +1 -1
  378. package/lib/types/src/internal/logger-publisher/di/loggerModule.d.ts.map +1 -1
  379. package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
  380. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -1
  381. package/lib/types/src/internal/secure-channel/model/Errors.d.ts +22 -2
  382. package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -1
  383. package/lib/types/src/internal/send/di/sendModule.d.ts.map +1 -1
  384. package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts +5 -1
  385. package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts.map +1 -1
  386. package/lib/types/src/internal/transport/di/transportModule.d.ts.map +1 -1
  387. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  388. package/package.json +2 -3
@@ -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(\"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 * 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": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBACnCC,EAA2C,qBAC3CC,EAAmB,gBAEnBC,EAMO,gDAKPC,EAA4B,iDAE5BC,EAGO,iDACPC,EAAsB,gDACtBC,EAA4B,sDAC5BC,EAA4B,qDAQrB,IAAMC,EAAN,KAA4D,CACvD,WACA,SACA,SACF,QAUR,YACE,CACE,UAAAC,EACA,QAAAC,EAAU,QAAM,KAAK,EACrB,QAAAC,EAAU,EACZ,EAEAC,EACA,CACA,KAAK,WAAaH,EAClB,KAAK,SAAWC,EAChB,KAAK,SAAWC,EAChB,KAAK,QAAUC,EAAqB,0BAA0B,CAChE,CAOO,UAAUC,EAA2B,CAC1C,MAAMC,EAAkB,CAAC,EACzB,IAAIC,EAAQ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EAClC,MAAO,cAAY,kBAAkBQ,EAAY,cAAY,EAC7D,OAAQ,KAAK,4BAA4BA,CAAU,EACnD,SAAU,QAAM,KAAK,CACvB,CAAC,EACD,OAAIA,IAAe,GACjBC,EAAO,YACL,QAAM,GACJ,cAAY,kBAAkBK,EAAU,yBAAuB,CACjE,CACF,EAEKL,CACT,CASQ,qBAAqBD,EAA4B,CACvD,IAAIO,EAAM,KAAK,4BAA4B,CAAC,EACxCC,EAAI,EACR,KAAOA,EAAIR,GACTO,GAAO,KAAK,4BAA4BC,CAAC,EACzCA,GAAK,EAEP,OAAOD,CACT,CAOQ,4BAA4BP,EAA4B,CAC9D,OACE,KAAK,SAAS,OAAO,CACnB,KAAM,IAAM,iBACZ,QAAS,IAAM,CACjB,CAAC,EACD,eACA,mBACCA,IAAe,EAAI,0BAA0B,EAElD,CACF,EA5JaV,EAANmB,EAAA,IADN,cAAW,EAqBPC,EAAA,eAAO,cAAY,6BAA6B,IApBxCpB",
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: () => 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": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBACnCC,EAA2C,qBAC3CC,EAAmB,gBAEnBC,EAMO,gDAKPC,EAA4B,iDAE5BC,EAGO,iDACPC,EAAsB,gDACtBC,EAA4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AAID,EAAM,CAAC,EACrB,MAAMN,EAAQ,IAAI,QAAM,CACtB,OAAAG,EACA,KAAMI,CACR,CAAC,EACD,SAAO,SAAMP,CAAK,CACpB,CAQQ,mBACNE,EACAM,EACa,CACb,MAAML,EAAS,IAAI,cAAY,CAC7B,QAAM,MAAG,EACT,QAAS,KAAK,SAAS,IAAKT,GAC1B,cAAY,iBAAiBA,EAAS,gBAAc,CACtD,EACA,QAAS,IAAI,WAAW,CAAC,UAAQ,CAAC,EAClC,MAAO,cAAY,kBAAkBQ,EAAY,cAAY,EAC7D,OAAQ,KAAK,4BAA4BA,CAAU,EACnD,SAAU,QAAM,KAAK,CACvB,CAAC,EACD,OAAIA,IAAe,GACjBC,EAAO,YACL,QAAM,GACJ,cAAY,kBAAkBK,EAAU,yBAAuB,CACjE,CACF,EAEKL,CACT,CASQ,qBAAqBD,EAA4B,CACvD,IAAIO,EAAM,KAAK,4BAA4B,CAAC,EACxCC,EAAI,EACR,KAAOA,EAAIR,GACTO,GAAO,KAAK,4BAA4BC,CAAC,EACzCA,GAAK,EAEP,OAAOD,CACT,CAOQ,4BAA4BP,EAA4B,CAC9D,OACE,KAAK,SAAS,OAAO,CACnB,KAAM,IAAM,iBACZ,QAAS,IAAM,CACjB,CAAC,EACD,eACA,mBACCA,IAAe,EAAI,0BAA0B,EAElD,CACF,EA5JaV,EAANmB,EAAA,IADN,cAAW,EAqBPC,EAAA,eAAO,cAAY,6BAA6B,IApBxCpB",
6
6
  "names": ["DefaultApduSenderService_exports", "__export", "DefaultApduSenderService", "__toCommonJS", "import_inversify", "import_purify_ts", "import_uuid", "import_FramerConst", "import_FramerUtils", "import_Errors", "import_Frame", "import_FrameHeader", "import_loggerTypes", "DefaultApduSenderService", "frameSize", "channel", "padding", "loggerServiceFactory", "apdu", "frames", "count", "frame", "error", "frameIndex", "header", "frameOffset", "dataMaxSize", "data", "frameData", "apduSize", "sum", "i", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var x=require("purify-ts"),t=require("../../device-session/model/Frame"),i=require("../../device-session/model/FrameHeader"),w=require("../../logger-publisher/service/DefaultLoggerPublisherService"),d=require("./DefaultApduSenderService");vi.mock("uuid",()=>({v4:vi.fn().mockReturnValue("42")}));const o=new w.DefaultLoggerPublisherService([],"frame");describe("DefaultApduSenderService",()=>{describe("[USB] With padding and channel",()=>{it("should return 1 frame",()=>{const n=x.Maybe.of(new Uint8Array([18,52])),a=new d.DefaultApduSenderService({frameSize:64,padding:!0,channel:n},()=>o),e=new Uint8Array([224,1,0,0,0]),r=a.getFrames(e);expect(r).toEqual([new t.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.Maybe.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.Maybe.of(new Uint8Array([18,52])),a=new d.DefaultApduSenderService({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.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.Maybe.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.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),index:new Uint8Array([0,1]),length:5,dataSize:x.Maybe.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.DefaultApduSenderService({frameSize:123},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e).toEqual([new t.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.zero(),headTag:new Uint8Array([5]),dataSize:x.Maybe.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.DefaultApduSenderService({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.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.zero(),headTag:new Uint8Array([5]),index:new Uint8Array([0,0]),dataSize:x.Maybe.of(new Uint8Array([0,17])),length:5}),data:new Uint8Array([1,5,79,76,79])}),new t.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.zero(),headTag:new Uint8Array([5]),dataSize:x.Maybe.zero(),index:new Uint8Array([0,1]),length:3}),data:new Uint8Array([83,0,7,46,50,46,52])}),new t.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.zero(),headTag:new Uint8Array([5]),dataSize:x.Maybe.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.DefaultApduSenderService({frameSize:64,channel:x.Maybe.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.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.of(new Uint8Array([68,68])),headTag:new Uint8Array([5]),dataSize:x.Maybe.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.DefaultApduSenderService({frameSize:Math.random()&4,channel:x.Maybe.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.DefaultApduSenderService({frameSize:Math.random()&255,padding:Math.random()>.5,channel:x.Maybe.of(new Uint8Array([18,52]))},()=>o),a=new Uint8Array([]),e=n.getFrames(a);expect(e.length).toEqual(0)})})});
1
+ "use strict";var x=require("purify-ts"),t=require("../../device-session/model/Frame"),i=require("../../device-session/model/FrameHeader"),w=require("../../logger-publisher/service/DefaultLoggerPublisherService"),d=require("./DefaultApduSenderService");vi.mock("uuid",()=>({v4:vi.fn().mockReturnValue("42")}));const o=new w.DefaultLoggerPublisherService([],"frame");describe("DefaultApduSenderService",()=>{describe("[USB] With padding and channel",()=>{it("should return 1 frame",()=>{const n=x.Maybe.of(new Uint8Array([18,52])),a=new d.DefaultApduSenderService({frameSize:64,padding:!0,channel:n},()=>o),e=new Uint8Array([224,1,0,0,0]),r=a.getFrames(e);expect(r).toEqual([new t.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.Maybe.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.Maybe.of(new Uint8Array([18,52])),a=new d.DefaultApduSenderService({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.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.Maybe.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.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),index:new Uint8Array([0,1]),length:5,dataSize:x.Maybe.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.Maybe.of(new Uint8Array([18,52])),a=new d.DefaultApduSenderService({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.Maybe.of(new Uint8Array([18,52])),a=new d.DefaultApduSenderService({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.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.of(new Uint8Array([18,52])),headTag:new Uint8Array([5]),dataSize:x.Maybe.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.DefaultApduSenderService({frameSize:123},()=>o),a=new Uint8Array([224,1,0,0,0]),e=n.getFrames(a);expect(e).toEqual([new t.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.zero(),headTag:new Uint8Array([5]),dataSize:x.Maybe.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.DefaultApduSenderService({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.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.zero(),headTag:new Uint8Array([5]),index:new Uint8Array([0,0]),dataSize:x.Maybe.of(new Uint8Array([0,17])),length:5}),data:new Uint8Array([1,5,79,76,79])}),new t.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.zero(),headTag:new Uint8Array([5]),dataSize:x.Maybe.zero(),index:new Uint8Array([0,1]),length:3}),data:new Uint8Array([83,0,7,46,50,46,52])}),new t.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.zero(),headTag:new Uint8Array([5]),dataSize:x.Maybe.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.DefaultApduSenderService({frameSize:64,channel:x.Maybe.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.Frame({header:new i.FrameHeader({uuid:"42",channel:x.Maybe.of(new Uint8Array([68,68])),headTag:new Uint8Array([5]),dataSize:x.Maybe.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.DefaultApduSenderService({frameSize:Math.random()&4,channel:x.Maybe.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.DefaultApduSenderService({frameSize:Math.random()&255,padding:Math.random()>.5,channel:x.Maybe.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.length).toEqual(0);\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAAsB,qBAEtBC,EAAsB,gDACtBC,EAA4B,s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AC,CAAC,CAChD,EACA,IAAMF,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,IAAAA,EAAsB,qBAEtBC,EAAsB,gDACtBC,EAA4B,sDAC5BC,EAA8C,4EAE9CC,EAAyC,sCAEzC,GAAG,KAAK,OAAQ,KAAO,CACrB,GAAI,GAAG,GAAG,EAAE,gBAAgB,IAAI,CAClC,EAAE,EAEF,MAAMC,EAAgB,IAAI,gCAA8B,CAAC,EAAG,OAAO,EAEnE,SAAS,2BAA4B,IAAM,CACzC,SAAS,iCAAkC,IAAM,CAC/C,GAAG,wBAAyB,IAAM,CAEhC,MAAMC,EAAU,QAAM,GAAG,IAAI,WAAW,CAAC,GAAM,EAAI,CAAC,CAAC,EAC/CC,EAAoB,IAAI,2BAC5B,CACE,UAAW,GACX,QAAS,GACT,QAAAD,CACF,EACA,IAAMD,CACR,EAEMG,EAAO,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,EAAM,CAAI,CAAC,EAGpDC,EAASF,EA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AI,EAC3B,QAAS,QAAM,GAAG,IAAI,WAAW,CAAC,GAAM,EAAI,CAAC,CAAC,CAChD,EACA,IAAMF,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,IAAI,2BAC5B,CAEE,UAAW,KAAK,OAAO,EAAI,IAE3B,QAAS,KAAK,OAAO,EAAI,GACzB,QAAS,QAAM,GAAG,IAAI,WAAW,CAAC,GAAM,EAAI,CAAC,CAAC,CAChD,EACA,IAAMF,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": ["import_purify_ts", "import_Frame", "import_FrameHeader", "import_DefaultLoggerPublisherService", "import_DefaultApduSenderService", "loggerService", "channel", "apduSenderService", "apdu", "frames", "fr", "command"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var C=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var i in e)C(t,i,{get:e[i],enumerable:!0})},g=(t,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of y(e))!S.call(t,s)&&s!==i&&C(t,s,{get:()=>e[s],enumerable:!(a=L(e,s))||a.enumerable});return t};var u=t=>g(C({},"__esModule",{value:!0}),t);var F={};T(F,{discoveryModuleFactory:()=>A});module.exports=u(F);var n=require("inversify"),r=require("../../discovery/use-case/ConnectUseCase"),U=require("../../discovery/use-case/DisconnectUseCase"),v=require("../../discovery/use-case/GetConnectedDeviceUseCase"),m=require("../../discovery/use-case/ListConnectedDevicesUseCase"),D=require("../../discovery/use-case/ListenToAvailableDevicesUseCase"),p=require("../../discovery/use-case/ListenToConnectedDeviceUseCase"),f=require("../../discovery/use-case/StartDiscoveringUseCase"),l=require("../../discovery/use-case/StopDiscoveringUseCase"),c=require("../../../../src/di.stub"),o=require("./discoveryTypes");const A=({stub:t=!1})=>new n.ContainerModule((e,i,a,s)=>{e(o.discoveryTypes.ConnectUseCase).to(r.ConnectUseCase),e(o.discoveryTypes.DisconnectUseCase).to(U.DisconnectUseCase),e(o.discoveryTypes.StartDiscoveringUseCase).to(f.StartDiscoveringUseCase),e(o.discoveryTypes.StopDiscoveringUseCase).to(l.StopDiscoveringUseCase),e(o.discoveryTypes.GetConnectedDeviceUseCase).to(v.GetConnectedDeviceUseCase),e(o.discoveryTypes.ListenToAvailableDevicesUseCase).to(D.ListenToAvailableDevicesUseCase),e(o.discoveryTypes.ListenToConnectedDeviceUseCase).to(p.ListenToConnectedDeviceUseCase),e(o.discoveryTypes.ListConnectedDevicesUseCase).to(m.ListConnectedDevicesUseCase),t&&(s(o.discoveryTypes.StartDiscoveringUseCase).to(c.StubUseCase),s(o.discoveryTypes.StopDiscoveringUseCase).to(c.StubUseCase),s(o.discoveryTypes.ConnectUseCase).to(c.StubUseCase),s(o.discoveryTypes.DisconnectUseCase).to(c.StubUseCase),s(o.discoveryTypes.GetConnectedDeviceUseCase).to(c.StubUseCase),s(o.discoveryTypes.ListenToAvailableDevicesUseCase).to(c.StubUseCase),s(o.discoveryTypes.ListenToConnectedDeviceUseCase).to(c.StubUseCase),s(o.discoveryTypes.ListConnectedDevicesUseCase).to(c.StubUseCase))});0&&(module.exports={discoveryModuleFactory});
1
+ "use strict";var C=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var s in e)C(t,s,{get:e[s],enumerable:!0})},A=(t,e,s,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of T(e))!g.call(t,i)&&i!==s&&C(t,i,{get:()=>e[i],enumerable:!(c=L(e,i))||c.enumerable});return t};var F=t=>A(C({},"__esModule",{value:!0}),t);var M={};u(M,{discoveryModuleFactory:()=>G});module.exports=F(M);var r=require("inversify"),n=require("../../discovery/use-case/ConnectUseCase"),U=require("../../discovery/use-case/DisconnectUseCase"),v=require("../../discovery/use-case/GetConnectedDeviceUseCase"),m=require("../../discovery/use-case/ListConnectedDevicesUseCase"),D=require("../../discovery/use-case/ListenToAvailableDevicesUseCase"),p=require("../../discovery/use-case/ListenToConnectedDeviceUseCase"),f=require("../../discovery/use-case/StartDiscoveringUseCase"),l=require("../../discovery/use-case/StopDiscoveringUseCase"),a=require("../../../../src/di.stub"),o=require("./discoveryTypes");const G=({stub:t=!1})=>new r.ContainerModule(({bind:e,rebindSync:s})=>{e(o.discoveryTypes.ConnectUseCase).to(n.ConnectUseCase),e(o.discoveryTypes.DisconnectUseCase).to(U.DisconnectUseCase),e(o.discoveryTypes.StartDiscoveringUseCase).to(f.StartDiscoveringUseCase),e(o.discoveryTypes.StopDiscoveringUseCase).to(l.StopDiscoveringUseCase),e(o.discoveryTypes.GetConnectedDeviceUseCase).to(v.GetConnectedDeviceUseCase),e(o.discoveryTypes.ListenToAvailableDevicesUseCase).to(D.ListenToAvailableDevicesUseCase),e(o.discoveryTypes.ListenToConnectedDeviceUseCase).to(p.ListenToConnectedDeviceUseCase),e(o.discoveryTypes.ListConnectedDevicesUseCase).to(m.ListConnectedDevicesUseCase),t&&(s(o.discoveryTypes.ConnectUseCase).to(a.StubUseCase),s(o.discoveryTypes.DisconnectUseCase).to(a.StubUseCase),s(o.discoveryTypes.StartDiscoveringUseCase).to(a.StubUseCase),s(o.discoveryTypes.StopDiscoveringUseCase).to(a.StubUseCase),s(o.discoveryTypes.GetConnectedDeviceUseCase).to(a.StubUseCase),s(o.discoveryTypes.ListenToAvailableDevicesUseCase).to(a.StubUseCase),s(o.discoveryTypes.ListenToConnectedDeviceUseCase).to(a.StubUseCase),s(o.discoveryTypes.ListConnectedDevicesUseCase).to(a.StubUseCase))});0&&(module.exports={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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA+B,uDAC/BC,EAAkC,0DAClCC,EAA0C,kEAC1CC,EAA4C,oEAC5CC,EAAgD,wEAChDC,EAA+C,uEAC/CC,EAAwC,gEACxCC,EAAuC,+DACvCC,EAA4B,6BAE5BC,EAA+B,4BAMxB,MAAMZ,EAAyB,CAAC,CAAE,KAAAa,EAAO,EAAM,IACpD,IAAI,kBAAgB,CAACC,EAAMC,EAASC,EAAUC,IAAW,CACvDH,EAAK,iBAAe,cAAc,EAAE,GAAG,gBAAc,EACrDA,EAAK,iBAAe,iBAAiB,EAAE,GAAG,mBAAiB,EAC3DA,EAAK,iBAAe,uBAAuB,EAAE,GAAG,yBAAuB,EACvEA,EAAK,iBAAe,sBAAsB,EAAE,GAAG,wBAAsB,EACrEA,EAAK,iBAAe,yBAAyB,EAAE,GAC7C,2BACF,EACAA,EAAK,iBAAe,+BAA+B,EAAE,GACnD,iCACF,EACAA,EAAK,iBAAe,8BAA8B,EAAE,GAClD,gCACF,EACAA,EAAK,iBAAe,2BAA2B,EAAE,GAC/C,6BACF,EAEID,IACFI,EAAO,iBAAe,uBAAuB,EAAE,GAAG,aAAW,EAC7DA,EAAO,iBAAe,sBAAsB,EAAE,GAAG,aAAW,EAC5DA,EAAO,iBAAe,cAAc,EAAE,GAAG,aAAW,EACpDA,EAAO,iBAAe,iBAAiB,EAAE,GAAG,aAAW,EACvDA,EAAO,iBAAe,yBAAyB,EAAE,GAAG,aAAW,EAC/DA,EAAO,iBAAe,+BAA+B,EAAE,GAAG,aAAW,EACrEA,EAAO,iBAAe,8BAA8B,EAAE,GAAG,aAAW,EACpEA,EAAO,iBAAe,2BAA2B,EAAE,GAAG,aAAW,EAErE,CAAC",
6
- "names": ["discoveryModule_exports", "__export", "discoveryModuleFactory", "__toCommonJS", "import_inversify", "import_ConnectUseCase", "import_DisconnectUseCase", "import_GetConnectedDeviceUseCase", "import_ListConnectedDevicesUseCase", "import_ListenToAvailableDevicesUseCase", "import_ListenToConnectedDeviceUseCase", "import_StartDiscoveringUseCase", "import_StopDiscoveringUseCase", "import_di", "import_discoveryTypes", "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.ListConnectedDevicesUseCase).to(StubUseCase);\n }\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA+B,uDAC/BC,EAAkC,0DAClCC,EAA0C,kEAC1CC,EAA4C,oEAC5CC,EAAgD,wEAChDC,EAA+C,uEAC/CC,EAAwC,gEACxCC,EAAuC,+DACvCC,EAA4B,6BAE5BC,EAA+B,4BAMxB,MAAMZ,EAAyB,CAAC,CAAE,KAAAa,EAAO,EAAM,IACpD,IAAI,kBAAgB,CAAC,CAAE,KAAAC,EAAM,WAAAC,CAAW,IAAM,CAC5CD,EAAK,iBAAe,cAAc,EAAE,GAAG,gBAAc,EACrDA,EAAK,iBAAe,iBAAiB,EAAE,GAAG,mBAAiB,EAC3DA,EAAK,iBAAe,uBAAuB,EAAE,GAAG,yBAAuB,EACvEA,EAAK,iBAAe,sBAAsB,EAAE,GAAG,wBAAsB,EACrEA,EAAK,iBAAe,yBAAyB,EAAE,GAC7C,2BACF,EACAA,EAAK,iBAAe,+BAA+B,EAAE,GACnD,iCACF,EACAA,EAAK,iBAAe,8BAA8B,EAAE,GAClD,gCACF,EACAA,EAAK,iBAAe,2BAA2B,EAAE,GAC/C,6BACF,EAEID,IACFE,EAAW,iBAAe,cAAc,EAAE,GAAG,aAAW,EACxDA,EAAW,iBAAe,iBAAiB,EAAE,GAAG,aAAW,EAC3DA,EAAW,iBAAe,uBAAuB,EAAE,GAAG,aAAW,EACjEA,EAAW,iBAAe,sBAAsB,EAAE,GAAG,aAAW,EAChEA,EAAW,iBAAe,yBAAyB,EAAE,GAAG,aAAW,EACnEA,EAAW,iBAAe,+BAA+B,EAAE,GACzD,aACF,EACAA,EAAW,iBAAe,8BAA8B,EAAE,GAAG,aAAW,EACxEA,EAAW,iBAAe,2BAA2B,EAAE,GAAG,aAAW,EAEzE,CAAC",
6
+ "names": ["discoveryModule_exports", "__export", "discoveryModuleFactory", "__toCommonJS", "import_inversify", "import_ConnectUseCase", "import_DisconnectUseCase", "import_GetConnectedDeviceUseCase", "import_ListConnectedDevicesUseCase", "import_ListenToAvailableDevicesUseCase", "import_ListenToConnectedDeviceUseCase", "import_StartDiscoveringUseCase", "import_StopDiscoveringUseCase", "import_di", "import_discoveryTypes", "stub", "bind", "rebindSync"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var r=require("inversify"),n=require("../../../api/transport/model/__mocks__/TransportMock"),c=require("../../device-model/di/deviceModelModule"),i=require("../../device-session/di/deviceSessionModule"),a=require("../../discovery/use-case/ConnectUseCase"),m=require("../../discovery/use-case/DisconnectUseCase"),p=require("../../discovery/use-case/ListConnectedDevicesUseCase"),f=require("../../discovery/use-case/ListenToAvailableDevicesUseCase"),l=require("../../discovery/use-case/StartDiscoveringUseCase"),d=require("../../discovery/use-case/StopDiscoveringUseCase"),C=require("../../logger-publisher/di/loggerModule"),v=require("../../manager-api/di/managerApiModule"),u=require("../../secure-channel/di/secureChannelModule"),g=require("../../transport/di/transportModule"),U=require("./discoveryModule"),o=require("./discoveryTypes");describe("discoveryModuleFactory",()=>{let e,t,s;beforeEach(()=>{t=(0,U.discoveryModuleFactory)({stub:!1}),e=new r.Container,s=new n.TransportMock,e.load(t,(0,C.loggerModuleFactory)(),(0,c.deviceModelModuleFactory)({stub:!1}),(0,i.deviceSessionModuleFactory)(),(0,g.transportModuleFactory)({transports:[vi.fn().mockImplementation(()=>s)]}),(0,v.managerApiModuleFactory)({config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url"}}),(0,u.secureChannelModuleFactory)({config:{webSocketUrl:"http://fake-websocket.url"}}))}),it("should return the device module",()=>{expect(t).toBeDefined()}),it("should return none mocked use cases",()=>{const y=e.get(o.discoveryTypes.StartDiscoveringUseCase);expect(y).toBeInstanceOf(l.StartDiscoveringUseCase);const D=e.get(o.discoveryTypes.StopDiscoveringUseCase);expect(D).toBeInstanceOf(d.StopDiscoveringUseCase);const k=e.get(o.discoveryTypes.DisconnectUseCase);expect(k).toBeInstanceOf(m.DisconnectUseCase);const M=e.get(o.discoveryTypes.ConnectUseCase);expect(M).toBeInstanceOf(a.ConnectUseCase);const b=e.get(o.discoveryTypes.ListenToAvailableDevicesUseCase);expect(b).toBeInstanceOf(f.ListenToAvailableDevicesUseCase);const F=e.get(o.discoveryTypes.ListConnectedDevicesUseCase);expect(F).toBeInstanceOf(p.ListConnectedDevicesUseCase)})});
1
+ "use strict";var r=require("inversify"),n=require("../../../api/transport/model/__mocks__/TransportMock"),c=require("../../device-model/di/deviceModelModule"),i=require("../../device-session/di/deviceSessionModule"),a=require("../../discovery/use-case/ConnectUseCase"),m=require("../../discovery/use-case/DisconnectUseCase"),p=require("../../discovery/use-case/ListConnectedDevicesUseCase"),f=require("../../discovery/use-case/ListenToAvailableDevicesUseCase"),l=require("../../discovery/use-case/StartDiscoveringUseCase"),d=require("../../discovery/use-case/StopDiscoveringUseCase"),C=require("../../logger-publisher/di/loggerModule"),v=require("../../manager-api/di/managerApiModule"),u=require("../../secure-channel/di/secureChannelModule"),g=require("../../transport/di/transportModule"),U=require("./discoveryModule"),o=require("./discoveryTypes");describe("discoveryModuleFactory",()=>{let e,t,s;beforeEach(()=>{t=(0,U.discoveryModuleFactory)({stub:!1}),e=new r.Container,s=new n.TransportMock,e.loadSync(t,(0,C.loggerModuleFactory)(),(0,c.deviceModelModuleFactory)({stub:!1}),(0,i.deviceSessionModuleFactory)(),(0,g.transportModuleFactory)({transports:[vi.fn().mockImplementation(()=>s)]}),(0,v.managerApiModuleFactory)({config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url"}}),(0,u.secureChannelModuleFactory)({config:{webSocketUrl:"http://fake-websocket.url"}}))}),it("should return the device module",()=>{expect(t).toBeDefined()}),it("should return none mocked use cases",()=>{const y=e.get(o.discoveryTypes.StartDiscoveringUseCase);expect(y).toBeInstanceOf(l.StartDiscoveringUseCase);const D=e.get(o.discoveryTypes.StopDiscoveringUseCase);expect(D).toBeInstanceOf(d.StopDiscoveringUseCase);const k=e.get(o.discoveryTypes.DisconnectUseCase);expect(k).toBeInstanceOf(m.DisconnectUseCase);const M=e.get(o.discoveryTypes.ConnectUseCase);expect(M).toBeInstanceOf(a.ConnectUseCase);const b=e.get(o.discoveryTypes.ListenToAvailableDevicesUseCase);expect(b).toBeInstanceOf(f.ListenToAvailableDevicesUseCase);const F=e.get(o.discoveryTypes.ListConnectedDevicesUseCase);expect(F).toBeInstanceOf(p.ListConnectedDevicesUseCase)})});
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,IAAAA,EAA0B,qBAE1BC,EAA8B,wDAE9BC,EAAyC,uDACzCC,EAA2C,2DAC3CC,EAA+B,uDAC/BC,EAAkC,0DAClCC,EAA4C,oEAC5CC,EAAgD,wEAChDC,EAAwC,gEACxCC,EAAuC,+DACvCC,EAAoC,sDACpCC,EAAwC,qDACxCC,EAA2C,2DAC3CC,EAAuC,kDAEvCC,EAAuC,6BACvCC,EAA+B,4BAE/B,SAAS,yBAA0B,IAAM,CACvC,IAAIC,EACAC,EACAC,EACJ,WAAW,IAAM,CACfD,KAAM,0BAAuB,CAAE,KAAM,EAAM,CAAC,EAC5CD,EAAY,IAAI,YAChBE,EAAY,IAAI,gBAEhBF,EAAU,KACRC,KAEA,uBAAoB,KACpB,4BAAyB,CAAE,KAAM,EAAM,CAAC,KACxC,8BAA2B,KAC3B,0BAAuB,CACrB,WAAY,CAAC,GAAG,GAAG,EAAE,mBAAmB,IAAMC,CAAS,CAAC,CAC1D,CAAC,KACD,2BAAwB,CACtB,OAAQ,CACN,cAAe,kBACf,QAAS,sBACX,CACF,CAAC,KACD,8BAA2B,CACzB,OAAQ,CACN,aAAc,2BAChB,CACF,CAAC,CACH,CACF,CAAC,EACD,GAAG,kCAAmC,IAAM,CAC1C,OAAOD,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,sCAAuC,IAAM,CAC9C,MAAME,EAA0BH,EAAU,IACxC,iBAAe,uBACjB,EACA,OAAOG,CAAuB,EAAE,eAAe,yBAAuB,EAEtE,MAAMC,EAAyBJ,EAAU,IACvC,iBAAe,sBACjB,EACA,OAAOI,CAAsB,EAAE,eAAe,wBAAsB,EAEpE,MAAMC,EAAoBL,EAAU,IAAI,iBAAe,iBAAiB,EACxE,OAAOK,CAAiB,EAAE,eAAe,mBAAiB,EAE1D,MAAMC,EAAiBN,EAAU,IAAI,iBAAe,cAAc,EAClE,OAAOM,CAAc,EAAE,eAAe,gBAAc,EAEpD,MAAMC,EAAkCP,EAAU,IAChD,iBAAe,+BACjB,EACA,OAAOO,CAA+B,EAAE,eACtC,iCACF,EACA,MAAMC,EAA8BR,EAAU,IAC5C,iBAAe,2BACjB,EACA,OAAOQ,CAA2B,EAAE,eAClC,6BACF,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,IAAAA,EAA0B,qBAE1BC,EAA8B,wDAE9BC,EAAyC,uDACzCC,EAA2C,2DAC3CC,EAA+B,uDAC/BC,EAAkC,0DAClCC,EAA4C,oEAC5CC,EAAgD,wEAChDC,EAAwC,gEACxCC,EAAuC,+DACvCC,EAAoC,sDACpCC,EAAwC,qDACxCC,EAA2C,2DAC3CC,EAAuC,kDAEvCC,EAAuC,6BACvCC,EAA+B,4BAE/B,SAAS,yBAA0B,IAAM,CACvC,IAAIC,EACAC,EACAC,EACJ,WAAW,IAAM,CACfD,KAAM,0BAAuB,CAAE,KAAM,EAAM,CAAC,EAC5CD,EAAY,IAAI,YAChBE,EAAY,IAAI,gBAEhBF,EAAU,SACRC,KAEA,uBAAoB,KACpB,4BAAyB,CAAE,KAAM,EAAM,CAAC,KACxC,8BAA2B,KAC3B,0BAAuB,CACrB,WAAY,CAAC,GAAG,GAAG,EAAE,mBAAmB,IAAMC,CAAS,CAAC,CAC1D,CAAC,KACD,2BAAwB,CACtB,OAAQ,CACN,cAAe,kBACf,QAAS,sBACX,CACF,CAAC,KACD,8BAA2B,CACzB,OAAQ,CACN,aAAc,2BAChB,CACF,CAAC,CACH,CACF,CAAC,EACD,GAAG,kCAAmC,IAAM,CAC1C,OAAOD,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,sCAAuC,IAAM,CAC9C,MAAME,EAA0BH,EAAU,IACxC,iBAAe,uBACjB,EACA,OAAOG,CAAuB,EAAE,eAAe,yBAAuB,EAEtE,MAAMC,EAAyBJ,EAAU,IACvC,iBAAe,sBACjB,EACA,OAAOI,CAAsB,EAAE,eAAe,wBAAsB,EAEpE,MAAMC,EAAoBL,EAAU,IAAI,iBAAe,iBAAiB,EACxE,OAAOK,CAAiB,EAAE,eAAe,mBAAiB,EAE1D,MAAMC,EAAiBN,EAAU,IAAI,iBAAe,cAAc,EAClE,OAAOM,CAAc,EAAE,eAAe,gBAAc,EAEpD,MAAMC,EAAkCP,EAAU,IAChD,iBAAe,+BACjB,EACA,OAAOO,CAA+B,EAAE,eACtC,iCACF,EACA,MAAMC,EAA8BR,EAAU,IAC5C,iBAAe,2BACjB,EACA,OAAOQ,CAA2B,EAAE,eAClC,6BACF,CACF,CAAC,CACH,CAAC",
6
6
  "names": ["import_inversify", "import_TransportMock", "import_deviceModelModule", "import_deviceSessionModule", "import_ConnectUseCase", "import_DisconnectUseCase", "import_ListConnectedDevicesUseCase", "import_ListenToAvailableDevicesUseCase", "import_StartDiscoveringUseCase", "import_StopDiscoveringUseCase", "import_loggerModule", "import_managerApiModule", "import_secureChannelModule", "import_transportModule", "import_discoveryModule", "import_discoveryTypes", "container", "mod", "transport", "startDiscoveringUseCase", "stopDiscoveringUseCase", "disconnectUseCase", "connectUseCase", "listenToAvailableDevicesUseCase", "listConnectedDevicesUseCase"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var y=(e,r)=>{for(var i in r)c(e,i,{get:r[i],enumerable:!0})},m=(e,r,i,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of a(r))!p.call(e,o)&&o!==i&&c(e,o,{get:()=>r[o],enumerable:!(t=u(r,o))||t.enumerable});return e};var l=e=>m(c({},"__esModule",{value:!0}),e);var v={};y(v,{loggerModuleFactory:()=>f});module.exports=l(v);var n=require("inversify"),s=require("../../logger-publisher/service/DefaultLoggerPublisherService"),g=require("./loggerTypes");const f=({subscribers:e}={subscribers:[]})=>new n.ContainerModule((r,i,t,o,S,_,d)=>{r(g.loggerTypes.LoggerPublisherServiceFactory).toFactory(F=>b=>new s.DefaultLoggerPublisherService(e,b))});0&&(module.exports={loggerModuleFactory});
1
+ "use strict";var c=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var m=(e,r)=>{for(var o in r)c(e,o,{get:r[o],enumerable:!0})},a=(e,r,o,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of u(r))!y.call(e,t)&&t!==o&&c(e,t,{get:()=>r[t],enumerable:!(i=b(r,t))||i.enumerable});return e};var l=e=>a(c({},"__esModule",{value:!0}),e);var S={};m(S,{loggerModuleFactory:()=>n});module.exports=l(S);var g=require("inversify"),s=require("../../logger-publisher/service/DefaultLoggerPublisherService"),p=require("./loggerTypes");const n=({subscribers:e}={subscribers:[]})=>new g.ContainerModule(({bind:r})=>{r(p.loggerTypes.LoggerPublisherServiceFactory).toFactory(o=>i=>new s.DefaultLoggerPublisherService(e,i))});0&&(module.exports={loggerModuleFactory});
2
2
  //# sourceMappingURL=loggerModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/logger-publisher/di/loggerModule.ts"],
4
- "sourcesContent": ["import { ContainerModule, type interfaces } from \"inversify\";\n\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type LoggerSubscriberService } from \"@api/logger-subscriber/service/LoggerSubscriberService\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\n\nimport { loggerTypes } from \"./loggerTypes\";\n\ntype FactoryProps = {\n subscribers: LoggerSubscriberService[];\n};\n\nexport const loggerModuleFactory = (\n { subscribers }: FactoryProps = { subscribers: [] },\n) =>\n new ContainerModule(\n (\n bind,\n _unbind,\n _isBound,\n _rebind,\n _unbindAsync,\n _onActivation,\n _onDeactivation,\n ) => {\n bind<interfaces.Factory<LoggerPublisherService>>(\n loggerTypes.LoggerPublisherServiceFactory,\n ).toFactory((_context) => {\n return (tag: string) =>\n new DefaultLoggerPublisherService(subscribers, tag);\n });\n },\n );\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,qBAIjDC,EAA8C,4EAE9CC,EAA4B,yBAMrB,MAAMJ,EAAsB,CACjC,CAAE,YAAAK,CAAY,EAAkB,CAAE,YAAa,CAAC,CAAE,IAElD,IAAI,kBACF,CACEC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,IACG,CACHN,EACE,cAAY,6BACd,EAAE,UAAWO,GACHC,GACN,IAAI,gCAA8BT,EAAaS,CAAG,CACrD,CACH,CACF",
6
- "names": ["loggerModule_exports", "__export", "loggerModuleFactory", "__toCommonJS", "import_inversify", "import_DefaultLoggerPublisherService", "import_loggerTypes", "subscribers", "bind", "_unbind", "_isBound", "_rebind", "_unbindAsync", "_onActivation", "_onDeactivation", "_context", "tag"]
4
+ "sourcesContent": ["import { ContainerModule, type Factory } from \"inversify\";\n\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type LoggerSubscriberService } from \"@api/logger-subscriber/service/LoggerSubscriberService\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\n\nimport { loggerTypes } from \"./loggerTypes\";\n\ntype FactoryProps = {\n subscribers: LoggerSubscriberService[];\n};\n\nexport const loggerModuleFactory = (\n { subscribers }: FactoryProps = { subscribers: [] },\n) =>\n new ContainerModule(({ bind }) => {\n bind<Factory<LoggerPublisherService>>(\n loggerTypes.LoggerPublisherServiceFactory,\n ).toFactory((_context) => {\n return (tag: string) =>\n new DefaultLoggerPublisherService(subscribers, tag);\n });\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA8C,qBAI9CC,EAA8C,4EAE9CC,EAA4B,yBAMrB,MAAMJ,EAAsB,CACjC,CAAE,YAAAK,CAAY,EAAkB,CAAE,YAAa,CAAC,CAAE,IAElD,IAAI,kBAAgB,CAAC,CAAE,KAAAC,CAAK,IAAM,CAChCA,EACE,cAAY,6BACd,EAAE,UAAWC,GACHC,GACN,IAAI,gCAA8BH,EAAaG,CAAG,CACrD,CACH,CAAC",
6
+ "names": ["loggerModule_exports", "__export", "loggerModuleFactory", "__toCommonJS", "import_inversify", "import_DefaultLoggerPublisherService", "import_loggerTypes", "subscribers", "bind", "_context", "tag"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var r=require("inversify"),t=require("./loggerModule");describe("loggerModuleFactory",()=>{describe("Default",()=>{let o,e;beforeEach(()=>{e=(0,t.loggerModuleFactory)(),o=new r.Container,o.load(e)}),it("should return the config module",()=>{expect(e).toBeDefined()})})});
1
+ "use strict";var r=require("inversify"),t=require("./loggerModule");describe("loggerModuleFactory",()=>{describe("Default",()=>{let o,e;beforeEach(()=>{e=(0,t.loggerModuleFactory)(),o=new r.Container,o.loadSync(e)}),it("should return the config module",()=>{expect(e).toBeDefined()})})});
2
2
  //# sourceMappingURL=loggerModule.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/logger-publisher/di/loggerModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { loggerModuleFactory } from \"./loggerModule\";\n\ndescribe(\"loggerModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof loggerModuleFactory>;\n beforeEach(() => {\n mod = loggerModuleFactory();\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAoC,0BAEpC,SAAS,sBAAuB,IAAM,CACpC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,uBAAoB,EAC1BD,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { loggerModuleFactory } from \"./loggerModule\";\n\ndescribe(\"loggerModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof loggerModuleFactory>;\n beforeEach(() => {\n mod = loggerModuleFactory();\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAoC,0BAEpC,SAAS,sBAAuB,IAAM,CACpC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,uBAAoB,EAC1BD,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_inversify", "import_loggerModule", "container", "mod"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var m=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var C=(e,o)=>{for(var r in o)m(e,r,{get:o[r],enumerable:!0})},M=(e,o,r,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of u(o))!A.call(e,a)&&a!==r&&m(e,a,{get:()=>o[a],enumerable:!(n=f(o,a))||n.enumerable});return e};var l=e=>M(m({},"__esModule",{value:!0}),e);var v={};C(v,{managerApiModuleFactory:()=>D});module.exports=l(v);var s=require("inversify"),g=require("../../manager-api/data/AxiosManagerApiDataSource"),S=require("../../manager-api/service/DefaultManagerApiService"),c=require("../../manager-api/use-case/SetProviderUseCase"),i=require("../../../../src/di.stub"),t=require("./managerApiTypes");const D=({stub:e,config:o})=>new s.ContainerModule((r,n,a,p)=>{r(t.managerApiTypes.DmkConfig).toConstantValue(o),r(t.managerApiTypes.ManagerApiDataSource).to(g.AxiosManagerApiDataSource).inSingletonScope(),r(t.managerApiTypes.ManagerApiService).to(S.DefaultManagerApiService).inSingletonScope(),r(t.managerApiTypes.SetProviderUseCase).to(c.SetProviderUseCase),e&&(p(t.managerApiTypes.ManagerApiDataSource).to(i.StubUseCase),p(t.managerApiTypes.ManagerApiService).to(i.StubUseCase),p(t.managerApiTypes.SetProviderUseCase).to(i.StubUseCase))});0&&(module.exports={managerApiModuleFactory});
1
+ "use strict";var m=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var A=(e,o)=>{for(var r in o)m(e,r,{get:o[r],enumerable:!0})},C=(e,o,r,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of c(o))!u.call(e,i)&&i!==r&&m(e,i,{get:()=>o[i],enumerable:!(a=S(o,i))||a.enumerable});return e};var M=e=>C(m({},"__esModule",{value:!0}),e);var D={};A(D,{managerApiModuleFactory:()=>l});module.exports=M(D);var n=require("inversify"),s=require("../../manager-api/data/AxiosManagerApiDataSource"),g=require("../../manager-api/service/DefaultManagerApiService"),f=require("../../manager-api/use-case/SetProviderUseCase"),p=require("../../../../src/di.stub"),t=require("./managerApiTypes");const l=({stub:e,config:o})=>new n.ContainerModule(({bind:r,rebindSync:a})=>{r(t.managerApiTypes.DmkConfig).toConstantValue(o),r(t.managerApiTypes.ManagerApiDataSource).to(s.AxiosManagerApiDataSource).inSingletonScope(),r(t.managerApiTypes.ManagerApiService).to(g.DefaultManagerApiService).inSingletonScope(),r(t.managerApiTypes.SetProviderUseCase).to(f.SetProviderUseCase),e&&(a(t.managerApiTypes.ManagerApiDataSource).to(p.StubUseCase),a(t.managerApiTypes.ManagerApiService).to(p.StubUseCase),a(t.managerApiTypes.SetProviderUseCase).to(p.StubUseCase))});0&&(module.exports={managerApiModuleFactory});
2
2
  //# sourceMappingURL=managerApiModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/manager-api/di/managerApiModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { AxiosManagerApiDataSource } from \"@internal/manager-api/data/AxiosManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { SetProviderUseCase } from \"@internal/manager-api/use-case/SetProviderUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { managerApiTypes } from \"./managerApiTypes\";\n\ntype FactoryProps = {\n stub?: boolean;\n config: DmkConfig;\n};\n\nexport const managerApiModuleFactory = ({ stub, config }: FactoryProps) =>\n new ContainerModule((bind, _unbind, _isBound, rebind) => {\n bind(managerApiTypes.DmkConfig).toConstantValue(config);\n\n bind(managerApiTypes.ManagerApiDataSource)\n .to(AxiosManagerApiDataSource)\n .inSingletonScope();\n bind(managerApiTypes.ManagerApiService)\n .to(DefaultManagerApiService)\n .inSingletonScope();\n bind(managerApiTypes.SetProviderUseCase).to(SetProviderUseCase);\n\n if (stub) {\n rebind(managerApiTypes.ManagerApiDataSource).to(StubUseCase);\n rebind(managerApiTypes.ManagerApiService).to(StubUseCase);\n rebind(managerApiTypes.SetProviderUseCase).to(StubUseCase);\n }\n });\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAGhCC,EAA0C,gEAC1CC,EAAyC,kEACzCC,EAAmC,6DACnCC,EAA4B,6BAE5BC,EAAgC,6BAOzB,MAAMP,EAA0B,CAAC,CAAE,KAAAQ,EAAM,OAAAC,CAAO,IACrD,IAAI,kBAAgB,CAACC,EAAMC,EAASC,EAAUC,IAAW,CACvDH,EAAK,kBAAgB,SAAS,EAAE,gBAAgBD,CAAM,EAEtDC,EAAK,kBAAgB,oBAAoB,EACtC,GAAG,2BAAyB,EAC5B,iBAAiB,EACpBA,EAAK,kBAAgB,iBAAiB,EACnC,GAAG,0BAAwB,EAC3B,iBAAiB,EACpBA,EAAK,kBAAgB,kBAAkB,EAAE,GAAG,oBAAkB,EAE1DF,IACFK,EAAO,kBAAgB,oBAAoB,EAAE,GAAG,aAAW,EAC3DA,EAAO,kBAAgB,iBAAiB,EAAE,GAAG,aAAW,EACxDA,EAAO,kBAAgB,kBAAkB,EAAE,GAAG,aAAW,EAE7D,CAAC",
6
- "names": ["managerApiModule_exports", "__export", "managerApiModuleFactory", "__toCommonJS", "import_inversify", "import_AxiosManagerApiDataSource", "import_DefaultManagerApiService", "import_SetProviderUseCase", "import_di", "import_managerApiTypes", "stub", "config", "bind", "_unbind", "_isBound", "rebind"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { AxiosManagerApiDataSource } from \"@internal/manager-api/data/AxiosManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { SetProviderUseCase } from \"@internal/manager-api/use-case/SetProviderUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { managerApiTypes } from \"./managerApiTypes\";\n\ntype FactoryProps = {\n stub?: boolean;\n config: DmkConfig;\n};\n\nexport const managerApiModuleFactory = ({ stub, config }: FactoryProps) =>\n new ContainerModule(({ bind, rebindSync }) => {\n bind(managerApiTypes.DmkConfig).toConstantValue(config);\n\n bind(managerApiTypes.ManagerApiDataSource)\n .to(AxiosManagerApiDataSource)\n .inSingletonScope();\n bind(managerApiTypes.ManagerApiService)\n .to(DefaultManagerApiService)\n .inSingletonScope();\n bind(managerApiTypes.SetProviderUseCase).to(SetProviderUseCase);\n\n if (stub) {\n rebindSync(managerApiTypes.ManagerApiDataSource).to(StubUseCase);\n rebindSync(managerApiTypes.ManagerApiService).to(StubUseCase);\n rebindSync(managerApiTypes.SetProviderUseCase).to(StubUseCase);\n }\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAGhCC,EAA0C,gEAC1CC,EAAyC,kEACzCC,EAAmC,6DACnCC,EAA4B,6BAE5BC,EAAgC,6BAOzB,MAAMP,EAA0B,CAAC,CAAE,KAAAQ,EAAM,OAAAC,CAAO,IACrD,IAAI,kBAAgB,CAAC,CAAE,KAAAC,EAAM,WAAAC,CAAW,IAAM,CAC5CD,EAAK,kBAAgB,SAAS,EAAE,gBAAgBD,CAAM,EAEtDC,EAAK,kBAAgB,oBAAoB,EACtC,GAAG,2BAAyB,EAC5B,iBAAiB,EACpBA,EAAK,kBAAgB,iBAAiB,EACnC,GAAG,0BAAwB,EAC3B,iBAAiB,EACpBA,EAAK,kBAAgB,kBAAkB,EAAE,GAAG,oBAAkB,EAE1DF,IACFG,EAAW,kBAAgB,oBAAoB,EAAE,GAAG,aAAW,EAC/DA,EAAW,kBAAgB,iBAAiB,EAAE,GAAG,aAAW,EAC5DA,EAAW,kBAAgB,kBAAkB,EAAE,GAAG,aAAW,EAEjE,CAAC",
6
+ "names": ["managerApiModule_exports", "__export", "managerApiModuleFactory", "__toCommonJS", "import_inversify", "import_AxiosManagerApiDataSource", "import_DefaultManagerApiService", "import_SetProviderUseCase", "import_di", "import_managerApiTypes", "stub", "config", "bind", "rebindSync"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var c=require("inversify"),u=require("../../manager-api/data/AxiosManagerApiDataSource"),l=require("../../manager-api/service/DefaultManagerApiService"),i=require("../../../../src/di.stub"),p=require("./managerApiModule"),r=require("./managerApiTypes");describe("managerApiModuleFactory",()=>{describe("Default",()=>{let e,t;beforeEach(()=>{t=(0,p.managerApiModuleFactory)({stub:!1,config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"}}),e=new c.Container,e.load(t)}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return none stubbed use cases",()=>{const o=e.get(r.managerApiTypes.ManagerApiDataSource);expect(o).toBeInstanceOf(u.AxiosManagerApiDataSource);const a=e.get(r.managerApiTypes.ManagerApiService);expect(a).toBeInstanceOf(l.DefaultManagerApiService);const n=e.get(r.managerApiTypes.DmkConfig);expect(n).toEqual({managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"})})}),describe("Stubbed",()=>{let e,t;beforeEach(()=>{t=(0,p.managerApiModuleFactory)({stub:!0,config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"}}),e=new c.Container,e.load(t)}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return stubbed use cases",()=>{const o=e.get(r.managerApiTypes.ManagerApiDataSource);expect(o).toBeInstanceOf(i.StubUseCase);const a=e.get(r.managerApiTypes.ManagerApiService);expect(a).toBeInstanceOf(i.StubUseCase);const n=e.get(r.managerApiTypes.DmkConfig);expect(n).toEqual({managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"})})})});
1
+ "use strict";var c=require("inversify"),u=require("../../manager-api/data/AxiosManagerApiDataSource"),l=require("../../manager-api/service/DefaultManagerApiService"),i=require("../../../../src/di.stub"),p=require("./managerApiModule"),r=require("./managerApiTypes");describe("managerApiModuleFactory",()=>{describe("Default",()=>{let e,t;beforeEach(()=>{t=(0,p.managerApiModuleFactory)({stub:!1,config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"}}),e=new c.Container,e.loadSync(t)}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return none stubbed use cases",()=>{const o=e.get(r.managerApiTypes.ManagerApiDataSource);expect(o).toBeInstanceOf(u.AxiosManagerApiDataSource);const a=e.get(r.managerApiTypes.ManagerApiService);expect(a).toBeInstanceOf(l.DefaultManagerApiService);const n=e.get(r.managerApiTypes.DmkConfig);expect(n).toEqual({managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"})})}),describe("Stubbed",()=>{let e,t;beforeEach(()=>{t=(0,p.managerApiModuleFactory)({stub:!0,config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"}}),e=new c.Container,e.loadSync(t)}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return stubbed use cases",()=>{const o=e.get(r.managerApiTypes.ManagerApiDataSource);expect(o).toBeInstanceOf(i.StubUseCase);const a=e.get(r.managerApiTypes.ManagerApiService);expect(a).toBeInstanceOf(i.StubUseCase);const n=e.get(r.managerApiTypes.DmkConfig);expect(n).toEqual({managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"})})})});
2
2
  //# sourceMappingURL=managerApiModule.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/manager-api/di/managerApiModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { AxiosManagerApiDataSource } from \"@internal/manager-api/data/AxiosManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { managerApiModuleFactory } from \"./managerApiModule\";\nimport { managerApiTypes } from \"./managerApiTypes\";\n\ndescribe(\"managerApiModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof managerApiModuleFactory>;\n beforeEach(() => {\n mod = managerApiModuleFactory({\n stub: false,\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n } as DmkConfig,\n });\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return none stubbed use cases\", () => {\n const managerApiDataSource = container.get(\n managerApiTypes.ManagerApiDataSource,\n );\n expect(managerApiDataSource).toBeInstanceOf(AxiosManagerApiDataSource);\n\n const managerApiService = container.get(\n managerApiTypes.ManagerApiService,\n );\n expect(managerApiService).toBeInstanceOf(DefaultManagerApiService);\n\n const config = container.get(managerApiTypes.DmkConfig);\n expect(config).toEqual({\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n });\n });\n });\n\n describe(\"Stubbed\", () => {\n let container: Container;\n let mod: ReturnType<typeof managerApiModuleFactory>;\n beforeEach(() => {\n mod = managerApiModuleFactory({\n stub: true,\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n } as DmkConfig,\n });\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return stubbed use cases\", () => {\n const managerApiDataSource = container.get(\n managerApiTypes.ManagerApiDataSource,\n );\n expect(managerApiDataSource).toBeInstanceOf(StubUseCase);\n\n const managerApiService = container.get(\n managerApiTypes.ManagerApiService,\n );\n expect(managerApiService).toBeInstanceOf(StubUseCase);\n\n const config = container.get(managerApiTypes.DmkConfig);\n expect(config).toEqual({\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n });\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA0B,qBAG1BC,EAA0C,gEAC1CC,EAAyC,kEACzCC,EAA4B,6BAE5BC,EAAwC,8BACxCC,EAAgC,6BAEhC,SAAS,0BAA2B,IAAM,CACxC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,2BAAwB,CAC5B,KAAM,GACN,OAAQ,CACN,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CACF,CAAC,EACDD,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,uCAAwC,IAAM,CAC/C,MAAMC,EAAuBF,EAAU,IACrC,kBAAgB,oBAClB,EACA,OAAOE,CAAoB,EAAE,eAAe,2BAAyB,EAErE,MAAMC,EAAoBH,EAAU,IAClC,kBAAgB,iBAClB,EACA,OAAOG,CAAiB,EAAE,eAAe,0BAAwB,EAEjE,MAAMC,EAASJ,EAAU,IAAI,kBAAgB,SAAS,EACtD,OAAOI,CAAM,EAAE,QAAQ,CACrB,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CAAC,CACH,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,IAAIJ,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,2BAAwB,CAC5B,KAAM,GACN,OAAQ,CACN,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CACF,CAAC,EACDD,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,MAAMC,EAAuBF,EAAU,IACrC,kBAAgB,oBAClB,EACA,OAAOE,CAAoB,EAAE,eAAe,aAAW,EAEvD,MAAMC,EAAoBH,EAAU,IAClC,kBAAgB,iBAClB,EACA,OAAOG,CAAiB,EAAE,eAAe,aAAW,EAEpD,MAAMC,EAASJ,EAAU,IAAI,kBAAgB,SAAS,EACtD,OAAOI,CAAM,EAAE,QAAQ,CACrB,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { AxiosManagerApiDataSource } from \"@internal/manager-api/data/AxiosManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { managerApiModuleFactory } from \"./managerApiModule\";\nimport { managerApiTypes } from \"./managerApiTypes\";\n\ndescribe(\"managerApiModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof managerApiModuleFactory>;\n beforeEach(() => {\n mod = managerApiModuleFactory({\n stub: false,\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n } as DmkConfig,\n });\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return none stubbed use cases\", () => {\n const managerApiDataSource = container.get(\n managerApiTypes.ManagerApiDataSource,\n );\n expect(managerApiDataSource).toBeInstanceOf(AxiosManagerApiDataSource);\n\n const managerApiService = container.get(\n managerApiTypes.ManagerApiService,\n );\n expect(managerApiService).toBeInstanceOf(DefaultManagerApiService);\n\n const config = container.get(managerApiTypes.DmkConfig);\n expect(config).toEqual({\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n });\n });\n });\n\n describe(\"Stubbed\", () => {\n let container: Container;\n let mod: ReturnType<typeof managerApiModuleFactory>;\n beforeEach(() => {\n mod = managerApiModuleFactory({\n stub: true,\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n } as DmkConfig,\n });\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return stubbed use cases\", () => {\n const managerApiDataSource = container.get(\n managerApiTypes.ManagerApiDataSource,\n );\n expect(managerApiDataSource).toBeInstanceOf(StubUseCase);\n\n const managerApiService = container.get(\n managerApiTypes.ManagerApiService,\n );\n expect(managerApiService).toBeInstanceOf(StubUseCase);\n\n const config = container.get(managerApiTypes.DmkConfig);\n expect(config).toEqual({\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n });\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA0B,qBAG1BC,EAA0C,gEAC1CC,EAAyC,kEACzCC,EAA4B,6BAE5BC,EAAwC,8BACxCC,EAAgC,6BAEhC,SAAS,0BAA2B,IAAM,CACxC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,2BAAwB,CAC5B,KAAM,GACN,OAAQ,CACN,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CACF,CAAC,EACDD,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,uCAAwC,IAAM,CAC/C,MAAMC,EAAuBF,EAAU,IACrC,kBAAgB,oBAClB,EACA,OAAOE,CAAoB,EAAE,eAAe,2BAAyB,EAErE,MAAMC,EAAoBH,EAAU,IAClC,kBAAgB,iBAClB,EACA,OAAOG,CAAiB,EAAE,eAAe,0BAAwB,EAEjE,MAAMC,EAASJ,EAAU,IAAI,kBAAgB,SAAS,EACtD,OAAOI,CAAM,EAAE,QAAQ,CACrB,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CAAC,CACH,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,IAAIJ,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,2BAAwB,CAC5B,KAAM,GACN,OAAQ,CACN,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CACF,CAAC,EACDD,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,MAAMC,EAAuBF,EAAU,IACrC,kBAAgB,oBAClB,EACA,OAAOE,CAAoB,EAAE,eAAe,aAAW,EAEvD,MAAMC,EAAoBH,EAAU,IAClC,kBAAgB,iBAClB,EACA,OAAOG,CAAiB,EAAE,eAAe,aAAW,EAEpD,MAAMC,EAASJ,EAAU,IAAI,kBAAgB,SAAS,EACtD,OAAOI,CAAM,EAAE,QAAQ,CACrB,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_inversify", "import_AxiosManagerApiDataSource", "import_DefaultManagerApiService", "import_di", "import_managerApiModule", "import_managerApiTypes", "container", "mod", "managerApiDataSource", "managerApiService", "config"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var C=(o,e)=>{for(var r in e)u(o,r,{get:e[r],enumerable:!0})},s=(o,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of l(e))!p.call(o,n)&&n!==r&&u(o,n,{get:()=>e[n],enumerable:!(a=f(e,n))||a.enumerable});return o};var S=o=>s(u({},"__esModule",{value:!0}),o);var h={};C(h,{secureChannelModuleFactory:()=>D});module.exports=S(h);var c=require("inversify"),i=require("../../secure-channel/data/DefaultSecureChannelDataSource"),m=require("../../secure-channel/service/DefaultSecureChannelService"),t=require("./secureChannelTypes");const D=({stub:o,config:e})=>new c.ContainerModule((r,a,n,y)=>{r(t.secureChannelTypes.DmkConfig).toConstantValue(e),r(t.secureChannelTypes.SecureChannelDataSource).to(i.DefaultSecureChannelDataSource),r(t.secureChannelTypes.SecureChannelService).to(m.DefaultSecureChannelService)});0&&(module.exports={secureChannelModuleFactory});
1
+ "use strict";var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var C=(o,e)=>{for(var r in e)a(o,r,{get:e[r],enumerable:!0})},s=(o,e,r,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of i(e))!p.call(o,t)&&t!==r&&a(o,t,{get:()=>e[t],enumerable:!(c=l(e,t))||c.enumerable});return o};var S=o=>s(a({},"__esModule",{value:!0}),o);var h={};C(h,{secureChannelModuleFactory:()=>D});module.exports=S(h);var u=require("inversify"),m=require("../../secure-channel/data/DefaultSecureChannelDataSource"),f=require("../../secure-channel/service/DefaultSecureChannelService"),n=require("./secureChannelTypes");const D=({stub:o,config:e})=>new u.ContainerModule(({bind:r})=>{r(n.secureChannelTypes.DmkConfig).toConstantValue(e),r(n.secureChannelTypes.SecureChannelDataSource).to(m.DefaultSecureChannelDataSource),r(n.secureChannelTypes.SecureChannelService).to(f.DefaultSecureChannelService)});0&&(module.exports={secureChannelModuleFactory});
2
2
  //# sourceMappingURL=secureChannelModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/secure-channel/di/secureChannelModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\n\nimport { secureChannelTypes } from \"./secureChannelTypes\";\n\ntype FactoryProps = {\n stub?: boolean;\n config: DmkConfig;\n};\n\nexport const secureChannelModuleFactory = ({ stub, config }: FactoryProps) =>\n new ContainerModule((bind, _unbind, _isBound, _rebind) => {\n bind(secureChannelTypes.DmkConfig).toConstantValue(config);\n\n bind(secureChannelTypes.SecureChannelDataSource).to(\n DefaultSecureChannelDataSource,\n );\n bind(secureChannelTypes.SecureChannelService).to(\n DefaultSecureChannelService,\n );\n\n if (stub) {\n /* empty */\n }\n });\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAGhCC,EAA+C,wEAC/CC,EAA4C,wEAE5CC,EAAmC,gCAO5B,MAAML,EAA6B,CAAC,CAAE,KAAAM,EAAM,OAAAC,CAAO,IACxD,IAAI,kBAAgB,CAACC,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAK,qBAAmB,SAAS,EAAE,gBAAgBD,CAAM,EAEzDC,EAAK,qBAAmB,uBAAuB,EAAE,GAC/C,gCACF,EACAA,EAAK,qBAAmB,oBAAoB,EAAE,GAC5C,6BACF,CAKF,CAAC",
6
- "names": ["secureChannelModule_exports", "__export", "secureChannelModuleFactory", "__toCommonJS", "import_inversify", "import_DefaultSecureChannelDataSource", "import_DefaultSecureChannelService", "import_secureChannelTypes", "stub", "config", "bind", "_unbind", "_isBound", "_rebind"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\n\nimport { secureChannelTypes } from \"./secureChannelTypes\";\n\ntype FactoryProps = {\n stub?: boolean;\n config: DmkConfig;\n};\n\nexport const secureChannelModuleFactory = ({ stub, config }: FactoryProps) =>\n new ContainerModule(({ bind }) => {\n bind(secureChannelTypes.DmkConfig).toConstantValue(config);\n\n bind(secureChannelTypes.SecureChannelDataSource).to(\n DefaultSecureChannelDataSource,\n );\n bind(secureChannelTypes.SecureChannelService).to(\n DefaultSecureChannelService,\n );\n\n if (stub) {\n /* empty */\n }\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAGhCC,EAA+C,wEAC/CC,EAA4C,wEAE5CC,EAAmC,gCAO5B,MAAML,EAA6B,CAAC,CAAE,KAAAM,EAAM,OAAAC,CAAO,IACxD,IAAI,kBAAgB,CAAC,CAAE,KAAAC,CAAK,IAAM,CAChCA,EAAK,qBAAmB,SAAS,EAAE,gBAAgBD,CAAM,EAEzDC,EAAK,qBAAmB,uBAAuB,EAAE,GAC/C,gCACF,EACAA,EAAK,qBAAmB,oBAAoB,EAAE,GAC5C,6BACF,CAKF,CAAC",
6
+ "names": ["secureChannelModule_exports", "__export", "secureChannelModuleFactory", "__toCommonJS", "import_inversify", "import_DefaultSecureChannelDataSource", "import_DefaultSecureChannelService", "import_secureChannelTypes", "stub", "config", "bind"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=require("inversify"),r=require("../../secure-channel/data/DefaultSecureChannelDataSource"),c=require("../../secure-channel/service/DefaultSecureChannelService"),a=require("./secureChannelModule"),t=require("./secureChannelTypes");describe("secureChannelModuleFactory default use case",()=>{const u={webSocketUrl:"http://fake-websocket.url"};let e,o;beforeEach(()=>{o=(0,a.secureChannelModuleFactory)({stub:!1,config:u}),e=new n.Container,e.load(o)}),it("the secure channel module should be defined",()=>{expect(o).toBeDefined()}),it("should return default use cases instead of stub",()=>{const l=e.get(t.secureChannelTypes.DmkConfig);expect(l).toEqual({webSocketUrl:"http://fake-websocket.url"});const s=e.get(t.secureChannelTypes.SecureChannelDataSource);expect(s).toBeInstanceOf(r.DefaultSecureChannelDataSource);const f=e.get(t.secureChannelTypes.SecureChannelService);expect(f).toBeInstanceOf(c.DefaultSecureChannelService)})});
1
+ "use strict";var n=require("inversify"),c=require("../../secure-channel/data/DefaultSecureChannelDataSource"),r=require("../../secure-channel/service/DefaultSecureChannelService"),a=require("./secureChannelModule"),t=require("./secureChannelTypes");describe("secureChannelModuleFactory default use case",()=>{const u={webSocketUrl:"http://fake-websocket.url"};let e,o;beforeEach(()=>{o=(0,a.secureChannelModuleFactory)({stub:!1,config:u}),e=new n.Container,e.loadSync(o)}),it("the secure channel module should be defined",()=>{expect(o).toBeDefined()}),it("should return default use cases instead of stub",()=>{const l=e.get(t.secureChannelTypes.DmkConfig);expect(l).toEqual({webSocketUrl:"http://fake-websocket.url"});const s=e.get(t.secureChannelTypes.SecureChannelDataSource);expect(s).toBeInstanceOf(c.DefaultSecureChannelDataSource);const f=e.get(t.secureChannelTypes.SecureChannelService);expect(f).toBeInstanceOf(r.DefaultSecureChannelService)})});
2
2
  //# sourceMappingURL=secureChannelModule.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/secure-channel/di/secureChannelModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { type DmkConfig } from \"@api/index\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\n\nimport { secureChannelModuleFactory } from \"./secureChannelModule\";\nimport { secureChannelTypes } from \"./secureChannelTypes\";\n\ndescribe(\"secureChannelModuleFactory default use case\", () => {\n const mockDmkConfig = {\n webSocketUrl: \"http://fake-websocket.url\",\n } as DmkConfig;\n\n let container: Container;\n let mod: ReturnType<typeof secureChannelModuleFactory>;\n\n beforeEach(() => {\n mod = secureChannelModuleFactory({\n stub: false,\n config: mockDmkConfig,\n });\n container = new Container();\n container.load(mod);\n });\n\n it(\"the secure channel module should be defined\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return default use cases instead of stub\", () => {\n const config = container.get(secureChannelTypes.DmkConfig);\n expect(config).toEqual({\n webSocketUrl: \"http://fake-websocket.url\",\n });\n\n const secureChannelDataSource = container.get(\n secureChannelTypes.SecureChannelDataSource,\n );\n expect(secureChannelDataSource).toBeInstanceOf(\n DefaultSecureChannelDataSource,\n );\n\n const secureChannelService = container.get(\n secureChannelTypes.SecureChannelService,\n );\n expect(secureChannelService).toBeInstanceOf(DefaultSecureChannelService);\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA0B,qBAG1BC,EAA+C,wEAC/CC,EAA4C,wEAE5CC,EAA2C,iCAC3CC,EAAmC,gCAEnC,SAAS,8CAA+C,IAAM,CAC5D,MAAMC,EAAgB,CACpB,aAAc,2BAChB,EAEA,IAAIC,EACAC,EAEJ,WAAW,IAAM,CACfA,KAAM,8BAA2B,CAC/B,KAAM,GACN,OAAQF,CACV,CAAC,EACDC,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,8CAA+C,IAAM,CACtD,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,kDAAmD,IAAM,CAC1D,MAAMC,EAASF,EAAU,IAAI,qBAAmB,SAAS,EACzD,OAAOE,CAAM,EAAE,QAAQ,CACrB,aAAc,2BAChB,CAAC,EAED,MAAMC,EAA0BH,EAAU,IACxC,qBAAmB,uBACrB,EACA,OAAOG,CAAuB,EAAE,eAC9B,gCACF,EAEA,MAAMC,EAAuBJ,EAAU,IACrC,qBAAmB,oBACrB,EACA,OAAOI,CAAoB,EAAE,eAAe,6BAA2B,CACzE,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { type DmkConfig } from \"@api/index\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\n\nimport { secureChannelModuleFactory } from \"./secureChannelModule\";\nimport { secureChannelTypes } from \"./secureChannelTypes\";\n\ndescribe(\"secureChannelModuleFactory default use case\", () => {\n const mockDmkConfig = {\n webSocketUrl: \"http://fake-websocket.url\",\n } as DmkConfig;\n\n let container: Container;\n let mod: ReturnType<typeof secureChannelModuleFactory>;\n\n beforeEach(() => {\n mod = secureChannelModuleFactory({\n stub: false,\n config: mockDmkConfig,\n });\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"the secure channel module should be defined\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return default use cases instead of stub\", () => {\n const config = container.get(secureChannelTypes.DmkConfig);\n expect(config).toEqual({\n webSocketUrl: \"http://fake-websocket.url\",\n });\n\n const secureChannelDataSource = container.get(\n secureChannelTypes.SecureChannelDataSource,\n );\n expect(secureChannelDataSource).toBeInstanceOf(\n DefaultSecureChannelDataSource,\n );\n\n const secureChannelService = container.get(\n secureChannelTypes.SecureChannelService,\n );\n expect(secureChannelService).toBeInstanceOf(DefaultSecureChannelService);\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA0B,qBAG1BC,EAA+C,wEAC/CC,EAA4C,wEAE5CC,EAA2C,iCAC3CC,EAAmC,gCAEnC,SAAS,8CAA+C,IAAM,CAC5D,MAAMC,EAAgB,CACpB,aAAc,2BAChB,EAEA,IAAIC,EACAC,EAEJ,WAAW,IAAM,CACfA,KAAM,8BAA2B,CAC/B,KAAM,GACN,OAAQF,CACV,CAAC,EACDC,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,8CAA+C,IAAM,CACtD,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,kDAAmD,IAAM,CAC1D,MAAMC,EAASF,EAAU,IAAI,qBAAmB,SAAS,EACzD,OAAOE,CAAM,EAAE,QAAQ,CACrB,aAAc,2BAChB,CAAC,EAED,MAAMC,EAA0BH,EAAU,IACxC,qBAAmB,uBACrB,EACA,OAAOG,CAAuB,EAAE,eAC9B,gCACF,EAEA,MAAMC,EAAuBJ,EAAU,IACrC,qBAAmB,oBACrB,EACA,OAAOI,CAAoB,EAAE,eAAe,6BAA2B,CACzE,CAAC,CACH,CAAC",
6
6
  "names": ["import_inversify", "import_DefaultSecureChannelDataSource", "import_DefaultSecureChannelService", "import_secureChannelModule", "import_secureChannelTypes", "mockDmkConfig", "container", "mod", "config", "secureChannelDataSource", "secureChannelService"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var t=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var E=(o,r)=>{for(var e in r)t(o,e,{get:r[e],enumerable:!0})},s=(o,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of l(r))!a.call(o,n)&&n!==e&&t(o,n,{get:()=>r[n],enumerable:!(i=c(r,n))||i.enumerable});return o};var u=o=>s(t({},"__esModule",{value:!0}),o);var p={};E(p,{SecureChannelError:()=>m,WebSocketConnectionError:()=>k});module.exports=u(p);class k{constructor(r){this.error=r;this.originalError=r}_tag="WebSocketConnectionError";originalError}class m{constructor(r){this.error=r;this.originalError=r}_tag="SecureChannelError";originalError}0&&(module.exports={SecureChannelError,WebSocketConnectionError});
1
+ "use strict";var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var p=(n,r)=>{for(var t in r)l(n,t,{get:r[t],enumerable:!0})},d=(n,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of i(r))!E.call(n,s)&&s!==t&&l(n,s,{get:()=>r[s],enumerable:!(a=u(r,s))||a.enumerable});return n};var D=n=>d(l({},"__esModule",{value:!0}),n);var m={};p(m,{SecureChannelError:()=>A,SecureChannelErrorType:()=>c,WebSocketConnectionError:()=>y});module.exports=D(m);var o=require("../../../api/device-action/os/Errors"),c=(e=>(e[e.AppAlreadyInstalled=0]="AppAlreadyInstalled",e[e.DeviceLocked=1]="DeviceLocked",e[e.OutOfMemory=2]="OutOfMemory",e[e.RefusedByUser=3]="RefusedByUser",e[e.Unknown=4]="Unknown",e))(c||{});class y{constructor(r){this.error=r;this.originalError=r}_tag="WebSocketConnectionError";originalError}class A{constructor(r,t=4){this.error=r;this.errorType=t;this.originalError=r}_tag="SecureChannelError";originalError;mapDAErrors(){switch(this.errorType){case 1:return new o.DeviceLockedError;case 3:return new o.RefusedByUserDAError;default:return this}}mapInstallDAErrors(){switch(this.errorType){case 1:return new o.DeviceLockedError;case 3:return new o.RefusedByUserDAError;case 0:return new o.AppAlreadyInstalledDAError;case 2:return new o.OutOfMemoryDAError;default:return this}}}0&&(module.exports={SecureChannelError,SecureChannelErrorType,WebSocketConnectionError});
2
2
  //# sourceMappingURL=Errors.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/secure-channel/model/Errors.ts"],
4
- "sourcesContent": ["import { type DmkError } from \"@api/Error\";\n\nexport class WebSocketConnectionError implements DmkError {\n _tag = \"WebSocketConnectionError\";\n originalError?: unknown;\n\n constructor(public readonly error: unknown) {\n this.originalError = error;\n }\n}\n\nexport class SecureChannelError implements DmkError {\n _tag = \"SecureChannelError\";\n originalError?: unknown;\n\n constructor(public readonly error: unknown) {\n this.originalError = error;\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,EAAA,6BAAAC,IAAA,eAAAC,EAAAJ,GAEO,MAAMG,CAA6C,CAIxD,YAA4BE,EAAgB,CAAhB,WAAAA,EAC1B,KAAK,cAAgBA,CACvB,CALA,KAAO,2BACP,aAKF,CAEO,MAAMH,CAAuC,CAIlD,YAA4BG,EAAgB,CAAhB,WAAAA,EAC1B,KAAK,cAAgBA,CACvB,CALA,KAAO,qBACP,aAKF",
6
- "names": ["Errors_exports", "__export", "SecureChannelError", "WebSocketConnectionError", "__toCommonJS", "error"]
4
+ "sourcesContent": ["import {\n AppAlreadyInstalledDAError,\n DeviceLockedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n} from \"@api/device-action/os/Errors\";\nimport type { DmkError } from \"@api/Error\";\n\nexport enum SecureChannelErrorType {\n AppAlreadyInstalled,\n DeviceLocked,\n OutOfMemory,\n RefusedByUser,\n Unknown,\n}\n\n/**\n * Errors that can possibly occur during a secure channel operation\n */\nexport type SecureChannelDAErrors =\n | SecureChannelError\n | DeviceLockedError\n | RefusedByUserDAError;\n\n/**\n * Errors that can possibly occur during a secure channel install operation\n * such as installApp or installFirmware\n */\nexport type SecureChannelInstallDAErrors =\n | SecureChannelError\n | AppAlreadyInstalledDAError\n | OutOfMemoryDAError\n | DeviceLockedError\n | RefusedByUserDAError;\n\nexport class WebSocketConnectionError implements DmkError {\n _tag = \"WebSocketConnectionError\";\n originalError?: unknown;\n\n constructor(public readonly error: unknown) {\n this.originalError = error;\n }\n}\n\nexport class SecureChannelError implements DmkError {\n _tag = \"SecureChannelError\";\n originalError?: unknown;\n\n constructor(\n public readonly error: unknown,\n public readonly errorType: SecureChannelErrorType = SecureChannelErrorType.Unknown,\n ) {\n this.originalError = error;\n }\n\n mapDAErrors(): SecureChannelDAErrors {\n switch (this.errorType) {\n case SecureChannelErrorType.DeviceLocked:\n return new DeviceLockedError();\n case SecureChannelErrorType.RefusedByUser:\n return new RefusedByUserDAError();\n default:\n return this;\n }\n }\n\n mapInstallDAErrors(): SecureChannelInstallDAErrors {\n switch (this.errorType) {\n case SecureChannelErrorType.DeviceLocked:\n return new DeviceLockedError();\n case SecureChannelErrorType.RefusedByUser:\n return new RefusedByUserDAError();\n case SecureChannelErrorType.AppAlreadyInstalled:\n return new AppAlreadyInstalledDAError();\n case SecureChannelErrorType.OutOfMemory:\n return new OutOfMemoryDAError();\n default:\n return this;\n }\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,EAAA,2BAAAC,EAAA,6BAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAKO,wCAGKH,OACVA,IAAA,6CACAA,IAAA,+BACAA,IAAA,6BACAA,IAAA,iCACAA,IAAA,qBALUA,OAAA,IA2BL,MAAMC,CAA6C,CAIxD,YAA4BG,EAAgB,CAAhB,WAAAA,EAC1B,KAAK,cAAgBA,CACvB,CALA,KAAO,2BACP,aAKF,CAEO,MAAML,CAAuC,CAIlD,YACkBK,EACAC,EAAoC,EACpD,CAFgB,WAAAD,EACA,eAAAC,EAEhB,KAAK,cAAgBD,CACvB,CARA,KAAO,qBACP,cASA,aAAqC,CACnC,OAAQ,KAAK,UAAW,CACtB,IAAK,GACH,OAAO,IAAI,oBACb,IAAK,GACH,OAAO,IAAI,uBACb,QACE,OAAO,IACX,CACF,CAEA,oBAAmD,CACjD,OAAQ,KAAK,UAAW,CACtB,IAAK,GACH,OAAO,IAAI,oBACb,IAAK,GACH,OAAO,IAAI,uBACb,IAAK,GACH,OAAO,IAAI,6BACb,IAAK,GACH,OAAO,IAAI,qBACb,QACE,OAAO,IACX,CACF,CACF",
6
+ "names": ["Errors_exports", "__export", "SecureChannelError", "SecureChannelErrorType", "WebSocketConnectionError", "__toCommonJS", "import_Errors", "error", "errorType"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var f=(e,o)=>{for(var t in o)r(e,t,{get:o[t],enumerable:!0})},y=(e,o,t,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of m(o))!c.call(e,n)&&n!==t&&r(e,n,{get:()=>o[n],enumerable:!(s=u(o,n))||s.enumerable});return e};var b=e=>y(r({},"__esModule",{value:!0}),e);var C={};f(C,{sendModuleFactory:()=>A});module.exports=b(C);var d=require("inversify"),i=require("../../send/use-case/SendApduUseCase"),p=require("../../../../src/di.stub"),a=require("./sendTypes");const A=({stub:e=!1})=>new d.ContainerModule((o,t,s,n,_,l,S)=>{o(a.sendTypes.SendApduUseCase).to(i.SendApduUseCase),e&&n(a.sendTypes.SendApduUseCase).to(p.StubUseCase)});0&&(module.exports={sendModuleFactory});
1
+ "use strict";var t=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var y=(o,e)=>{for(var s in e)t(o,s,{get:e[s],enumerable:!0})},C=(o,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!i.call(o,r)&&r!==s&&t(o,r,{get:()=>e[r],enumerable:!(a=u(e,r))||a.enumerable});return o};var c=o=>C(t({},"__esModule",{value:!0}),o);var S={};y(S,{sendModuleFactory:()=>l});module.exports=c(S);var d=require("inversify"),n=require("../../send/use-case/SendApduUseCase"),m=require("../../../../src/di.stub"),p=require("./sendTypes");const l=({stub:o=!1})=>new d.ContainerModule(({bind:e,rebindSync:s})=>{e(p.sendTypes.SendApduUseCase).to(n.SendApduUseCase),o&&s(p.sendTypes.SendApduUseCase).to(m.StubUseCase)});0&&(module.exports={sendModuleFactory});
2
2
  //# sourceMappingURL=sendModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/send/di/sendModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { SendApduUseCase } from \"@internal/send/use-case/SendApduUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { sendTypes } from \"./sendTypes\";\n\ntype FactoryProps = {\n stub: boolean;\n};\n\nexport const sendModuleFactory = ({ stub = false }: FactoryProps) =>\n new ContainerModule(\n (\n bind,\n _unbind,\n _isBound,\n rebind,\n _unbindAsync,\n _onActivation,\n _onDeactivation,\n ) => {\n bind(sendTypes.SendApduUseCase).to(SendApduUseCase);\n if (stub) {\n rebind(sendTypes.SendApduUseCase).to(StubUseCase);\n }\n },\n );\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAgC,mDAChCC,EAA4B,6BAE5BC,EAA0B,uBAMnB,MAAML,EAAoB,CAAC,CAAE,KAAAM,EAAO,EAAM,IAC/C,IAAI,kBACF,CACEC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,IACG,CACHN,EAAK,YAAU,eAAe,EAAE,GAAG,iBAAe,EAC9CD,GACFI,EAAO,YAAU,eAAe,EAAE,GAAG,aAAW,CAEpD,CACF",
6
- "names": ["sendModule_exports", "__export", "sendModuleFactory", "__toCommonJS", "import_inversify", "import_SendApduUseCase", "import_di", "import_sendTypes", "stub", "bind", "_unbind", "_isBound", "rebind", "_unbindAsync", "_onActivation", "_onDeactivation"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { SendApduUseCase } from \"@internal/send/use-case/SendApduUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { sendTypes } from \"./sendTypes\";\n\ntype FactoryProps = {\n stub: boolean;\n};\n\nexport const sendModuleFactory = ({ stub = false }: FactoryProps) =>\n new ContainerModule(({ bind, rebindSync }) => {\n bind(sendTypes.SendApduUseCase).to(SendApduUseCase);\n if (stub) {\n rebindSync(sendTypes.SendApduUseCase).to(StubUseCase);\n }\n });\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAgC,mDAChCC,EAA4B,6BAE5BC,EAA0B,uBAMnB,MAAML,EAAoB,CAAC,CAAE,KAAAM,EAAO,EAAM,IAC/C,IAAI,kBAAgB,CAAC,CAAE,KAAAC,EAAM,WAAAC,CAAW,IAAM,CAC5CD,EAAK,YAAU,eAAe,EAAE,GAAG,iBAAe,EAC9CD,GACFE,EAAW,YAAU,eAAe,EAAE,GAAG,aAAW,CAExD,CAAC",
6
+ "names": ["sendModule_exports", "__export", "sendModuleFactory", "__toCommonJS", "import_inversify", "import_SendApduUseCase", "import_di", "import_sendTypes", "stub", "bind", "rebindSync"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var t=require("inversify"),r=require("./sendModule");describe("sendModuleFactory",()=>{describe("Default",()=>{let o,e;beforeEach(()=>{e=(0,r.sendModuleFactory)({stub:!1}),o=new t.Container,o.load(e)}),it("should return the config module",()=>{expect(e).toBeDefined()})})});
1
+ "use strict";var t=require("inversify"),r=require("./sendModule");describe("sendModuleFactory",()=>{describe("Default",()=>{let o,e;beforeEach(()=>{e=(0,r.sendModuleFactory)({stub:!1}),o=new t.Container,o.loadSync(e)}),it("should return the config module",()=>{expect(e).toBeDefined()})})});
2
2
  //# sourceMappingURL=sendModule.test.js.map