@ledgerhq/device-management-kit 0.0.0-multisig-20250925175241 → 0.0.0-ng5-ble-ids-20260105102514

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 (391) hide show
  1. package/lib/cjs/package.json +42 -37
  2. package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
  3. package/lib/cjs/src/api/DeviceManagementKit.js.map +2 -2
  4. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  5. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +2 -2
  6. package/lib/cjs/src/api/command/Command.js +1 -1
  7. package/lib/cjs/src/api/command/Command.js.map +1 -1
  8. package/lib/cjs/src/api/command/Errors.js +1 -1
  9. package/lib/cjs/src/api/command/Errors.js.map +3 -3
  10. package/lib/cjs/src/api/command/model/CommandResult.js +1 -1
  11. package/lib/cjs/src/api/command/model/CommandResult.js.map +2 -2
  12. package/lib/cjs/src/api/command/os/CloseAppCommand.js +1 -1
  13. package/lib/cjs/src/api/command/os/CloseAppCommand.js.map +2 -2
  14. package/lib/cjs/src/api/command/os/CloseAppCommand.test.js +1 -1
  15. package/lib/cjs/src/api/command/os/CloseAppCommand.test.js.map +2 -2
  16. package/lib/cjs/src/api/command/os/GetAppAndVersionCommand.js +1 -1
  17. package/lib/cjs/src/api/command/os/GetAppAndVersionCommand.js.map +2 -2
  18. package/lib/cjs/src/api/command/os/GetAppAndVersionCommand.test.js +1 -1
  19. package/lib/cjs/src/api/command/os/GetAppAndVersionCommand.test.js.map +2 -2
  20. package/lib/cjs/src/api/command/os/GetBatteryStatusCommand.js +1 -1
  21. package/lib/cjs/src/api/command/os/GetBatteryStatusCommand.js.map +2 -2
  22. package/lib/cjs/src/api/command/os/GetBatteryStatusCommand.test.js +1 -1
  23. package/lib/cjs/src/api/command/os/GetBatteryStatusCommand.test.js.map +3 -3
  24. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js +1 -1
  25. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js.map +2 -2
  26. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js +1 -1
  27. package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js.map +2 -2
  28. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js +1 -1
  29. package/lib/cjs/src/api/command/os/GetOsVersionCommand.js.map +2 -2
  30. package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js +1 -1
  31. package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js.map +2 -2
  32. package/lib/cjs/src/api/command/os/ListAppsCommand.js +1 -1
  33. package/lib/cjs/src/api/command/os/ListAppsCommand.js.map +2 -2
  34. package/lib/cjs/src/api/command/os/ListAppsCommand.test.js +1 -1
  35. package/lib/cjs/src/api/command/os/ListAppsCommand.test.js.map +2 -2
  36. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.js +1 -1
  37. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.js.map +2 -2
  38. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.test.js +1 -1
  39. package/lib/cjs/src/api/command/os/ListLanguagePackCommand.test.js.map +2 -2
  40. package/lib/cjs/src/api/command/os/LoadCertificateCommand.js +1 -1
  41. package/lib/cjs/src/api/command/os/LoadCertificateCommand.js.map +2 -2
  42. package/lib/cjs/src/api/command/os/LoadCertificateCommand.test.js +1 -1
  43. package/lib/cjs/src/api/command/os/LoadCertificateCommand.test.js.map +3 -3
  44. package/lib/cjs/src/api/command/os/OpenAppCommand.js +1 -1
  45. package/lib/cjs/src/api/command/os/OpenAppCommand.js.map +2 -2
  46. package/lib/cjs/src/api/command/os/OpenAppCommand.test.js +1 -1
  47. package/lib/cjs/src/api/command/os/OpenAppCommand.test.js.map +2 -2
  48. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
  49. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js.map +2 -2
  50. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
  51. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  52. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  53. package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  54. package/lib/cjs/src/api/device-action/os/Errors.js +1 -1
  55. package/lib/cjs/src/api/device-action/os/Errors.js.map +3 -3
  56. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
  57. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
  58. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js +1 -1
  59. package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +1 -1
  60. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
  61. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +2 -2
  62. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -1
  63. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +1 -1
  64. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
  65. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +2 -2
  66. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -1
  67. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +1 -1
  68. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  69. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  70. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +1 -1
  71. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +2 -2
  72. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +1 -1
  73. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +2 -2
  74. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
  75. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js.map +2 -2
  76. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js +1 -1
  77. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +2 -2
  78. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js +1 -1
  79. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js.map +3 -3
  80. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js +1 -1
  81. package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +3 -3
  82. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  83. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js.map +3 -3
  84. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.js +1 -1
  85. package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.js.map +3 -3
  86. package/lib/cjs/src/api/device-model/model/DeviceModel.js +1 -1
  87. package/lib/cjs/src/api/device-model/model/DeviceModel.js.map +3 -3
  88. package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js +1 -1
  89. package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
  90. package/lib/cjs/src/api/index.js +1 -1
  91. package/lib/cjs/src/api/index.js.map +2 -2
  92. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.js +1 -1
  93. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.js.map +3 -3
  94. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
  95. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  96. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +1 -1
  97. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
  98. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
  99. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +1 -1
  100. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
  101. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
  102. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
  103. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
  104. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
  105. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +2 -2
  106. package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +1 -1
  107. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  108. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  109. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
  110. package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
  111. package/lib/cjs/src/api/secure-channel/task/types.js +1 -1
  112. package/lib/cjs/src/api/secure-channel/task/types.js.map +2 -2
  113. package/lib/cjs/src/api/secure-channel/utils.js +1 -1
  114. package/lib/cjs/src/api/secure-channel/utils.js.map +3 -3
  115. package/lib/cjs/src/api/secure-channel/utils.test.js +1 -1
  116. package/lib/cjs/src/api/secure-channel/utils.test.js.map +3 -3
  117. package/lib/cjs/src/api/transport/model/ConnectedDevice.js +1 -1
  118. package/lib/cjs/src/api/transport/model/ConnectedDevice.js.map +3 -3
  119. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.js +1 -1
  120. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.js.map +3 -3
  121. package/lib/cjs/src/internal/crypto/CryptoService.js +2 -0
  122. package/lib/cjs/src/internal/crypto/CryptoService.js.map +7 -0
  123. package/lib/cjs/src/internal/crypto/NobleCryptoService.js +2 -0
  124. package/lib/cjs/src/internal/crypto/NobleCryptoService.js.map +7 -0
  125. package/lib/cjs/src/internal/crypto/NobleCryptoService.test.js +2 -0
  126. package/lib/cjs/src/internal/crypto/NobleCryptoService.test.js.map +7 -0
  127. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  128. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
  129. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.js +1 -1
  130. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.js.map +3 -3
  131. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
  132. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
  133. package/lib/cjs/src/internal/device-session/service/DeviceSessionService.js +1 -1
  134. package/lib/cjs/src/internal/device-session/service/DeviceSessionService.js.map +1 -1
  135. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  136. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  137. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  138. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
  139. package/lib/cjs/src/internal/discovery/di/discoveryTypes.js +1 -1
  140. package/lib/cjs/src/internal/discovery/di/discoveryTypes.js.map +2 -2
  141. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  142. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  143. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  144. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  145. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.js +1 -1
  146. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.js.map +3 -3
  147. package/lib/cjs/src/internal/discovery/use-case/ReconnectUseCase.js +2 -0
  148. package/lib/cjs/src/internal/discovery/use-case/ReconnectUseCase.js.map +7 -0
  149. package/lib/cjs/src/internal/discovery/use-case/ReconnectUseCase.test.js +2 -0
  150. package/lib/cjs/src/internal/discovery/use-case/ReconnectUseCase.test.js.map +7 -0
  151. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
  152. package/lib/esm/package.json +42 -37
  153. package/lib/esm/src/api/DeviceManagementKit.js +1 -1
  154. package/lib/esm/src/api/DeviceManagementKit.js.map +2 -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/command/Errors.js +1 -1
  158. package/lib/esm/src/api/command/Errors.js.map +3 -3
  159. package/lib/esm/src/api/command/model/CommandResult.js.map +2 -2
  160. package/lib/esm/src/api/command/os/CloseAppCommand.js +1 -1
  161. package/lib/esm/src/api/command/os/CloseAppCommand.js.map +2 -2
  162. package/lib/esm/src/api/command/os/CloseAppCommand.test.js +1 -1
  163. package/lib/esm/src/api/command/os/CloseAppCommand.test.js.map +2 -2
  164. package/lib/esm/src/api/command/os/GetAppAndVersionCommand.js +1 -1
  165. package/lib/esm/src/api/command/os/GetAppAndVersionCommand.js.map +2 -2
  166. package/lib/esm/src/api/command/os/GetAppAndVersionCommand.test.js +1 -1
  167. package/lib/esm/src/api/command/os/GetAppAndVersionCommand.test.js.map +2 -2
  168. package/lib/esm/src/api/command/os/GetBatteryStatusCommand.js +1 -1
  169. package/lib/esm/src/api/command/os/GetBatteryStatusCommand.js.map +2 -2
  170. package/lib/esm/src/api/command/os/GetBatteryStatusCommand.test.js +1 -1
  171. package/lib/esm/src/api/command/os/GetBatteryStatusCommand.test.js.map +3 -3
  172. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js +1 -1
  173. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js.map +2 -2
  174. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js +1 -1
  175. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js.map +2 -2
  176. package/lib/esm/src/api/command/os/GetOsVersionCommand.js +1 -1
  177. package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +2 -2
  178. package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js +1 -1
  179. package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js.map +2 -2
  180. package/lib/esm/src/api/command/os/ListAppsCommand.js +1 -1
  181. package/lib/esm/src/api/command/os/ListAppsCommand.js.map +2 -2
  182. package/lib/esm/src/api/command/os/ListAppsCommand.test.js +1 -1
  183. package/lib/esm/src/api/command/os/ListAppsCommand.test.js.map +2 -2
  184. package/lib/esm/src/api/command/os/ListLanguagePackCommand.js +1 -1
  185. package/lib/esm/src/api/command/os/ListLanguagePackCommand.js.map +2 -2
  186. package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js +1 -1
  187. package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js.map +2 -2
  188. package/lib/esm/src/api/command/os/LoadCertificateCommand.js +1 -1
  189. package/lib/esm/src/api/command/os/LoadCertificateCommand.js.map +2 -2
  190. package/lib/esm/src/api/command/os/LoadCertificateCommand.test.js +1 -1
  191. package/lib/esm/src/api/command/os/LoadCertificateCommand.test.js.map +3 -3
  192. package/lib/esm/src/api/command/os/OpenAppCommand.js +1 -1
  193. package/lib/esm/src/api/command/os/OpenAppCommand.js.map +2 -2
  194. package/lib/esm/src/api/command/os/OpenAppCommand.test.js +1 -1
  195. package/lib/esm/src/api/command/os/OpenAppCommand.test.js.map +2 -2
  196. package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
  197. package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js.map +2 -2
  198. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
  199. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  200. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  201. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  202. package/lib/esm/src/api/device-action/os/Errors.js +1 -1
  203. package/lib/esm/src/api/device-action/os/Errors.js.map +3 -3
  204. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
  205. package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
  206. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
  207. package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +2 -2
  208. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
  209. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +2 -2
  210. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  211. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  212. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js +1 -1
  213. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +3 -3
  214. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +1 -1
  215. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +3 -3
  216. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
  217. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js.map +3 -3
  218. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js +1 -1
  219. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +3 -3
  220. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js +1 -1
  221. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js.map +3 -3
  222. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js +1 -1
  223. package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +3 -3
  224. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
  225. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js.map +3 -3
  226. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.js +1 -1
  227. package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.js.map +3 -3
  228. package/lib/esm/src/api/device-model/model/DeviceModel.js +1 -1
  229. package/lib/esm/src/api/device-model/model/DeviceModel.js.map +3 -3
  230. package/lib/esm/src/api/device-model/model/DeviceModel.stub.js +1 -1
  231. package/lib/esm/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
  232. package/lib/esm/src/api/index.js +1 -1
  233. package/lib/esm/src/api/index.js.map +3 -3
  234. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.js +1 -1
  235. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.js.map +3 -3
  236. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
  237. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  238. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
  239. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
  240. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
  241. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
  242. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
  243. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
  244. package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +2 -2
  245. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
  246. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
  247. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
  248. package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
  249. package/lib/esm/src/api/secure-channel/task/types.js +1 -1
  250. package/lib/esm/src/api/secure-channel/task/types.js.map +2 -2
  251. package/lib/esm/src/api/secure-channel/utils.js +1 -1
  252. package/lib/esm/src/api/secure-channel/utils.js.map +3 -3
  253. package/lib/esm/src/api/secure-channel/utils.test.js +1 -1
  254. package/lib/esm/src/api/secure-channel/utils.test.js.map +3 -3
  255. package/lib/esm/src/api/transport/model/ConnectedDevice.js +1 -1
  256. package/lib/esm/src/api/transport/model/ConnectedDevice.js.map +3 -3
  257. package/lib/esm/src/api/transport/model/TransportConnectedDevice.js +1 -1
  258. package/lib/esm/src/api/transport/model/TransportConnectedDevice.js.map +3 -3
  259. package/lib/esm/src/internal/crypto/CryptoService.js +1 -0
  260. package/lib/esm/src/internal/crypto/CryptoService.js.map +7 -0
  261. package/lib/esm/src/internal/crypto/NobleCryptoService.js +2 -0
  262. package/lib/esm/src/internal/crypto/NobleCryptoService.js.map +7 -0
  263. package/lib/esm/src/internal/crypto/NobleCryptoService.test.js +2 -0
  264. package/lib/esm/src/internal/crypto/NobleCryptoService.test.js.map +7 -0
  265. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  266. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
  267. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.js +1 -1
  268. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.js.map +3 -3
  269. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
  270. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
  271. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  272. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  273. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  274. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
  275. package/lib/esm/src/internal/discovery/di/discoveryTypes.js +1 -1
  276. package/lib/esm/src/internal/discovery/di/discoveryTypes.js.map +2 -2
  277. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  278. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  279. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  280. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  281. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.js +1 -1
  282. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.js.map +3 -3
  283. package/lib/esm/src/internal/discovery/use-case/ReconnectUseCase.js +2 -0
  284. package/lib/esm/src/internal/discovery/use-case/ReconnectUseCase.js.map +7 -0
  285. package/lib/esm/src/internal/discovery/use-case/ReconnectUseCase.test.js +2 -0
  286. package/lib/esm/src/internal/discovery/use-case/ReconnectUseCase.test.js.map +7 -0
  287. package/lib/types/src/api/DeviceManagementKit.d.ts +12 -0
  288. package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
  289. package/lib/types/src/api/command/Command.d.ts +4 -0
  290. package/lib/types/src/api/command/Command.d.ts.map +1 -1
  291. package/lib/types/src/api/command/Errors.d.ts +5 -0
  292. package/lib/types/src/api/command/Errors.d.ts.map +1 -1
  293. package/lib/types/src/api/command/model/CommandResult.d.ts +3 -3
  294. package/lib/types/src/api/command/model/CommandResult.d.ts.map +1 -1
  295. package/lib/types/src/api/command/os/CloseAppCommand.d.ts +1 -0
  296. package/lib/types/src/api/command/os/CloseAppCommand.d.ts.map +1 -1
  297. package/lib/types/src/api/command/os/GetAppAndVersionCommand.d.ts +1 -0
  298. package/lib/types/src/api/command/os/GetAppAndVersionCommand.d.ts.map +1 -1
  299. package/lib/types/src/api/command/os/GetBatteryStatusCommand.d.ts +1 -0
  300. package/lib/types/src/api/command/os/GetBatteryStatusCommand.d.ts.map +1 -1
  301. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts +1 -0
  302. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts.map +1 -1
  303. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +1 -0
  304. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
  305. package/lib/types/src/api/command/os/ListAppsCommand.d.ts +1 -0
  306. package/lib/types/src/api/command/os/ListAppsCommand.d.ts.map +1 -1
  307. package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts +1 -0
  308. package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts.map +1 -1
  309. package/lib/types/src/api/command/os/LoadCertificateCommand.d.ts +1 -0
  310. package/lib/types/src/api/command/os/LoadCertificateCommand.d.ts.map +1 -1
  311. package/lib/types/src/api/command/os/OpenAppCommand.d.ts +1 -0
  312. package/lib/types/src/api/command/os/OpenAppCommand.d.ts.map +1 -1
  313. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +2 -1
  314. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
  315. package/lib/types/src/api/device-action/os/Errors.d.ts +5 -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 +1 -0
  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/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -1
  321. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +3 -2
  322. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -1
  323. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -1
  324. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +1 -0
  325. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -1
  326. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts +2 -2
  327. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -1
  328. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts.map +1 -1
  329. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts +4 -3
  330. package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts.map +1 -1
  331. package/lib/types/src/api/device-model/data/StaticDeviceModelDataSource.d.ts +3 -0
  332. package/lib/types/src/api/device-model/data/StaticDeviceModelDataSource.d.ts.map +1 -1
  333. package/lib/types/src/api/device-model/model/DeviceModel.d.ts +44 -20
  334. package/lib/types/src/api/device-model/model/DeviceModel.d.ts.map +1 -1
  335. package/lib/types/src/api/device-model/model/DeviceModel.stub.d.ts.map +1 -1
  336. package/lib/types/src/api/index.d.ts +1 -1
  337. package/lib/types/src/api/index.d.ts.map +1 -1
  338. package/lib/types/src/api/logger-subscriber/service/ConsoleLogger.d.ts +1 -0
  339. package/lib/types/src/api/logger-subscriber/service/ConsoleLogger.d.ts.map +1 -1
  340. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -1
  341. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +1 -0
  342. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -1
  343. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -1
  344. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts +1 -0
  345. package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts.map +1 -1
  346. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -1
  347. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts +1 -0
  348. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts.map +1 -1
  349. package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts.map +1 -1
  350. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts +1 -0
  351. package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -1
  352. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +4 -0
  353. package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -1
  354. package/lib/types/src/api/secure-channel/task/types.d.ts +7 -0
  355. package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -1
  356. package/lib/types/src/api/secure-channel/utils.d.ts +18 -1
  357. package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -1
  358. package/lib/types/src/api/transport/model/ConnectedDevice.d.ts +3 -2
  359. package/lib/types/src/api/transport/model/ConnectedDevice.d.ts.map +1 -1
  360. package/lib/types/src/api/transport/model/TransportConnectedDevice.d.ts +3 -1
  361. package/lib/types/src/api/transport/model/TransportConnectedDevice.d.ts.map +1 -1
  362. package/lib/types/src/internal/crypto/CryptoService.d.ts +12 -0
  363. package/lib/types/src/internal/crypto/CryptoService.d.ts.map +1 -0
  364. package/lib/types/src/internal/crypto/NobleCryptoService.d.ts +8 -0
  365. package/lib/types/src/internal/crypto/NobleCryptoService.d.ts.map +1 -0
  366. package/lib/types/src/internal/crypto/NobleCryptoService.test.d.ts +2 -0
  367. package/lib/types/src/internal/crypto/NobleCryptoService.test.d.ts.map +1 -0
  368. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  369. package/lib/types/src/internal/device-session/service/DefaultDeviceSessionService.d.ts +7 -5
  370. package/lib/types/src/internal/device-session/service/DefaultDeviceSessionService.d.ts.map +1 -1
  371. package/lib/types/src/internal/device-session/service/DeviceSessionService.d.ts +28 -1
  372. package/lib/types/src/internal/device-session/service/DeviceSessionService.d.ts.map +1 -1
  373. package/lib/types/src/internal/discovery/di/discoveryModule.d.ts.map +1 -1
  374. package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts +1 -0
  375. package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts.map +1 -1
  376. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts +3 -2
  377. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts.map +1 -1
  378. package/lib/types/src/internal/discovery/use-case/DisconnectUseCase.d.ts.map +1 -1
  379. package/lib/types/src/internal/discovery/use-case/ReconnectUseCase.d.ts +32 -0
  380. package/lib/types/src/internal/discovery/use-case/ReconnectUseCase.d.ts.map +1 -0
  381. package/lib/types/src/internal/discovery/use-case/ReconnectUseCase.test.d.ts +2 -0
  382. package/lib/types/src/internal/discovery/use-case/ReconnectUseCase.test.d.ts.map +1 -0
  383. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +1 -1
  384. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  385. package/package.json +30 -25
  386. package/lib/cjs/src/api/device-model/model/DeviceModel.test.js +0 -2
  387. package/lib/cjs/src/api/device-model/model/DeviceModel.test.js.map +0 -7
  388. package/lib/esm/src/api/device-model/model/DeviceModel.test.js +0 -2
  389. package/lib/esm/src/api/device-model/model/DeviceModel.test.js.map +0 -7
  390. package/lib/types/src/api/device-model/model/DeviceModel.test.d.ts +0 -2
  391. package/lib/types/src/api/device-model/model/DeviceModel.test.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/api/secure-channel/utils.ts"],
4
- "sourcesContent": ["import { type SecureChannelEventPayload } from \"./task/types\";\nimport { GENUINE_DEVICE_RESULT } from \"./constants\";\n\n/**\n * Checks if the given APDU command will request permission.\n *\n * This method checks if the first byte of the APDU command is `0xe0` and the second byte is `0x51`.\n *\n * @param apdu - The APDU command as a Uint8Array.\n * @returns `true` if the APDU command will request permission, otherwise `false`.\n */\nexport function willRequestPermission(apdu: Uint8Array): boolean {\n return apdu[0] === 0xe0 && apdu[1] === 0x51;\n}\n\n/**\n * Checks if the device is genuine.\n *\n * @param payload - The payload of the result secure channel event.\n * The payload has already been stringified, so that the type check is not necessary.\n * @returns `true` if the device is genuine, otherwise `false`.\n */\nexport function isDeviceGenuine(payload: SecureChannelEventPayload[\"Result\"]) {\n return payload === GENUINE_DEVICE_RESULT;\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,0BAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAsC,uBAU/B,SAASF,EAAsBG,EAA2B,CAC/D,OAAOA,EAAK,CAAC,IAAM,KAAQA,EAAK,CAAC,IAAM,EACzC,CASO,SAASJ,EAAgBK,EAA8C,CAC5E,OAAOA,IAAY,uBACrB",
6
- "names": ["utils_exports", "__export", "isDeviceGenuine", "willRequestPermission", "__toCommonJS", "import_constants", "apdu", "payload"]
4
+ "sourcesContent": ["import { ApduParser } from \"@api/apdu/utils/ApduParser\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { GENUINE_DEVICE_RESULT } from \"@api/secure-channel/constants\";\nimport { type SecureChannelEventPayload } from \"@api/secure-channel/task/types\";\n\n/**\n * Checks if the given APDU command will request permission.\n *\n * This method checks if the first byte of the APDU command is `0xe0` and the second byte is `0x51`.\n *\n * @param apdu - The APDU command as a Uint8Array.\n * @returns `true` if the APDU command will request permission, otherwise `false`.\n */\nexport function willRequestPermission(apdu: Uint8Array): boolean {\n return apdu[0] === 0xe0 && apdu[1] === 0x51;\n}\n\n/**\n * Checks if the given APDU command is a GetCertificate command.\n *\n * This method checks if the first byte of the APDU command is `0xe0` and the second byte is `0x52`.\n *\n * @param apdu - The APDU command as a Uint8Array.\n * @returns `true` if the APDU command is a GetCertificate command, otherwise `false`.\n */\nexport function isGetCertificateApdu(apdu: Uint8Array): boolean {\n return apdu[0] === 0xe0 && apdu[1] === 0x52;\n}\n\n/**\n * Extract the public key from a GetCertificate response.\n *\n * @param apduResponse - The APDU response containing the certificate data.\n * @returns The extracted public key as a Uint8Array, or null if extraction fails.\n */\nexport function extractPublicKey(\n apduResponse: ApduResponse,\n): Uint8Array | null {\n try {\n const parser = new ApduParser(apduResponse);\n\n // Skip header (length-value encoded)\n const header = parser.extractFieldLVEncoded();\n if (!header) {\n return null;\n }\n\n // Extract public key (length-value encoded)\n const publicKey = parser.extractFieldLVEncoded();\n return publicKey ?? null;\n } catch (_error) {\n return null;\n }\n}\n\n/**\n * Checks if the device is genuine.\n *\n * @param payload - The payload of the result secure channel event.\n * The payload has already been stringified, so that the type check is not necessary.\n * @returns `true` if the device is genuine, otherwise `false`.\n */\nexport function isDeviceGenuine(payload: SecureChannelEventPayload[\"Result\"]) {\n return payload === GENUINE_DEVICE_RESULT;\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,oBAAAC,EAAA,yBAAAC,EAAA,0BAAAC,IAAA,eAAAC,EAAAN,GAAA,IAAAO,EAA2B,sCAE3BC,EAAsC,yCAW/B,SAASH,EAAsBI,EAA2B,CAC/D,OAAOA,EAAK,CAAC,IAAM,KAAQA,EAAK,CAAC,IAAM,EACzC,CAUO,SAASL,EAAqBK,EAA2B,CAC9D,OAAOA,EAAK,CAAC,IAAM,KAAQA,EAAK,CAAC,IAAM,EACzC,CAQO,SAASP,EACdQ,EACmB,CACnB,GAAI,CACF,MAAMC,EAAS,IAAI,aAAWD,CAAY,EAI1C,OADeC,EAAO,sBAAsB,EAM1BA,EAAO,sBAAsB,GAC3B,KALX,IAMX,MAAiB,CACf,OAAO,IACT,CACF,CASO,SAASR,EAAgBS,EAA8C,CAC5E,OAAOA,IAAY,uBACrB",
6
+ "names": ["utils_exports", "__export", "extractPublicKey", "isDeviceGenuine", "isGetCertificateApdu", "willRequestPermission", "__toCommonJS", "import_ApduParser", "import_constants", "apdu", "apduResponse", "parser", "payload"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./utils");describe("willRequestPermission",()=>{it("should return true if the APDU is a permission request",()=>{const i=new Uint8Array([224,81,0,0,0]);expect((0,e.willRequestPermission)(i)).toBe(!0)}),it("should return false if the APDU is not a permission request",()=>{const i=new Uint8Array([224,82,0,0,0]);expect((0,e.willRequestPermission)(i)).toBe(!1)})});describe("isDeviceGenuine",()=>{it("should return true if the device is genuine",()=>{expect((0,e.isDeviceGenuine)("0000")).toBe(!0)}),it("should return false if the device is not genuine",()=>{expect((0,e.isDeviceGenuine)("not genuine")).toBe(!1)})});
1
+ "use strict";var n=require("../device-session/ApduResponse"),e=require("./utils");describe("willRequestPermission",()=>{it("should return true if the APDU is a permission request",()=>{const x=new Uint8Array([224,81,0,0,0]);expect((0,e.willRequestPermission)(x)).toBe(!0)}),it("should return false if the APDU is not a permission request",()=>{const x=new Uint8Array([224,82,0,0,0]);expect((0,e.willRequestPermission)(x)).toBe(!1)})});describe("isGetCertificateApdu",()=>{it("should return true if the APDU is a GetCertificate command",()=>{const x=new Uint8Array([224,82,0,0,0]);expect((0,e.isGetCertificateApdu)(x)).toBe(!0)}),it("should return true for GetCertificate with different P1 and P2",()=>{const x=new Uint8Array([224,82,128,1,0]);expect((0,e.isGetCertificateApdu)(x)).toBe(!0)}),it("should return false if the APDU is not a GetCertificate command",()=>{const x=new Uint8Array([224,81,0,0,0]);expect((0,e.isGetCertificateApdu)(x)).toBe(!1)})});describe("extractPublicKey",()=>{it("should extract public key from a valid GetCertificate response",()=>{const x=new Uint8Array([7,74,7,161,82,230,187,193,65,4,28,116,122,78,8,27,92,30,208,39,252,175,128,218,218,31,132,252,142,67,96,203,83,196,182,158,99,203,145,183,202,211,21,99,104,89,27,251,5,143,114,15,151,175,196,115,249,120,85,251,150,228,84,212,128,24,22,0,52,159,216,220,18,81,70,48,68,2,32,126,60,221,29,21,8,246,141,22,99,74,58,30,225,151,196,80,201,23,101,229,226,72,36,23,178,94,227,160,25,129,200,2,32,89,121,93,9,41,199,216,75,173,173,229,5,14,59,33,25,125,170,255,163,41,234,7,213,180,41,28,166,233,42,114,217]),i=new n.ApduResponse({statusCode:new Uint8Array([144,0]),data:x}),t=(0,e.extractPublicKey)(i);expect(t).not.toBeNull(),expect(t?.length).toBe(65),expect(t?.[0]).toBe(4),expect(t?.[64]).toBe(81)}),it("should return null for invalid response with missing header",()=>{const x=new n.ApduResponse({statusCode:new Uint8Array([144,0]),data:new Uint8Array([])}),i=(0,e.extractPublicKey)(x);expect(i).toBeNull()}),it("should return null for invalid response with missing public key",()=>{const x=new Uint8Array([7,74,7,161,82,230,187,193]),i=new n.ApduResponse({statusCode:new Uint8Array([144,0]),data:x}),t=(0,e.extractPublicKey)(i);expect(t).toBeNull()})});describe("isDeviceGenuine",()=>{it("should return true if the device is genuine",()=>{expect((0,e.isDeviceGenuine)("0000")).toBe(!0)}),it("should return false if the device is not genuine",()=>{expect((0,e.isDeviceGenuine)("not genuine")).toBe(!1)})});
2
2
  //# sourceMappingURL=utils.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/api/secure-channel/utils.test.ts"],
4
- "sourcesContent": ["import { isDeviceGenuine, willRequestPermission } from \"./utils\";\n\ndescribe(\"willRequestPermission\", () => {\n it(\"should return true if the APDU is a permission request\", () => {\n const apdu = new Uint8Array([0xe0, 0x51, 0x00, 0x00, 0x00]);\n expect(willRequestPermission(apdu)).toBe(true);\n });\n it(\"should return false if the APDU is not a permission request\", () => {\n const apdu = new Uint8Array([0xe0, 0x52, 0x00, 0x00, 0x00]);\n expect(willRequestPermission(apdu)).toBe(false);\n });\n});\n\ndescribe(\"isDeviceGenuine\", () => {\n it(\"should return true if the device is genuine\", () => {\n const payload = \"0000\";\n expect(isDeviceGenuine(payload)).toBe(true);\n });\n it(\"should return false if the device is not genuine\", () => {\n const payload = \"not genuine\";\n expect(isDeviceGenuine(payload)).toBe(false);\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAAuD,mBAEvD,SAAS,wBAAyB,IAAM,CACtC,GAAG,yDAA0D,IAAM,CACjE,MAAMC,EAAO,IAAI,WAAW,CAAC,IAAM,GAAM,EAAM,EAAM,CAAI,CAAC,EAC1D,UAAO,yBAAsBA,CAAI,CAAC,EAAE,KAAK,EAAI,CAC/C,CAAC,EACD,GAAG,8DAA+D,IAAM,CACtE,MAAMA,EAAO,IAAI,WAAW,CAAC,IAAM,GAAM,EAAM,EAAM,CAAI,CAAC,EAC1D,UAAO,yBAAsBA,CAAI,CAAC,EAAE,KAAK,EAAK,CAChD,CAAC,CACH,CAAC,EAED,SAAS,kBAAmB,IAAM,CAChC,GAAG,8CAA+C,IAAM,CAEtD,UAAO,mBADS,MACc,CAAC,EAAE,KAAK,EAAI,CAC5C,CAAC,EACD,GAAG,mDAAoD,IAAM,CAE3D,UAAO,mBADS,aACc,CAAC,EAAE,KAAK,EAAK,CAC7C,CAAC,CACH,CAAC",
6
- "names": ["import_utils", "apdu"]
4
+ "sourcesContent": ["import { ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport {\n extractPublicKey,\n isDeviceGenuine,\n isGetCertificateApdu,\n willRequestPermission,\n} from \"./utils\";\n\ndescribe(\"willRequestPermission\", () => {\n it(\"should return true if the APDU is a permission request\", () => {\n const apdu = new Uint8Array([0xe0, 0x51, 0x00, 0x00, 0x00]);\n expect(willRequestPermission(apdu)).toBe(true);\n });\n it(\"should return false if the APDU is not a permission request\", () => {\n const apdu = new Uint8Array([0xe0, 0x52, 0x00, 0x00, 0x00]);\n expect(willRequestPermission(apdu)).toBe(false);\n });\n});\n\ndescribe(\"isGetCertificateApdu\", () => {\n it(\"should return true if the APDU is a GetCertificate command\", () => {\n const apdu = new Uint8Array([0xe0, 0x52, 0x00, 0x00, 0x00]);\n expect(isGetCertificateApdu(apdu)).toBe(true);\n });\n it(\"should return true for GetCertificate with different P1 and P2\", () => {\n const apdu = new Uint8Array([0xe0, 0x52, 0x80, 0x01, 0x00]);\n expect(isGetCertificateApdu(apdu)).toBe(true);\n });\n it(\"should return false if the APDU is not a GetCertificate command\", () => {\n const apdu = new Uint8Array([0xe0, 0x51, 0x00, 0x00, 0x00]);\n expect(isGetCertificateApdu(apdu)).toBe(false);\n });\n});\n\ndescribe(\"extractPublicKey\", () => {\n it(\"should extract public key from a valid GetCertificate response\", () => {\n const responseData = new Uint8Array([\n 0x07, 0x4a, 0x07, 0xa1, 0x52, 0xe6, 0xbb, 0xc1, 0x41, 0x04, 0x1c, 0x74,\n 0x7a, 0x4e, 0x08, 0x1b, 0x5c, 0x1e, 0xd0, 0x27, 0xfc, 0xaf, 0x80, 0xda,\n 0xda, 0x1f, 0x84, 0xfc, 0x8e, 0x43, 0x60, 0xcb, 0x53, 0xc4, 0xb6, 0x9e,\n 0x63, 0xcb, 0x91, 0xb7, 0xca, 0xd3, 0x15, 0x63, 0x68, 0x59, 0x1b, 0xfb,\n 0x05, 0x8f, 0x72, 0x0f, 0x97, 0xaf, 0xc4, 0x73, 0xf9, 0x78, 0x55, 0xfb,\n 0x96, 0xe4, 0x54, 0xd4, 0x80, 0x18, 0x16, 0x00, 0x34, 0x9f, 0xd8, 0xdc,\n 0x12, 0x51, 0x46, 0x30, 0x44, 0x02, 0x20, 0x7e, 0x3c, 0xdd, 0x1d, 0x15,\n 0x08, 0xf6, 0x8d, 0x16, 0x63, 0x4a, 0x3a, 0x1e, 0xe1, 0x97, 0xc4, 0x50,\n 0xc9, 0x17, 0x65, 0xe5, 0xe2, 0x48, 0x24, 0x17, 0xb2, 0x5e, 0xe3, 0xa0,\n 0x19, 0x81, 0xc8, 0x02, 0x20, 0x59, 0x79, 0x5d, 0x09, 0x29, 0xc7, 0xd8,\n 0x4b, 0xad, 0xad, 0xe5, 0x05, 0x0e, 0x3b, 0x21, 0x19, 0x7d, 0xaa, 0xff,\n 0xa3, 0x29, 0xea, 0x07, 0xd5, 0xb4, 0x29, 0x1c, 0xa6, 0xe9, 0x2a, 0x72,\n 0xd9,\n ]);\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: responseData,\n });\n\n const publicKey = extractPublicKey(response);\n\n expect(publicKey).not.toBeNull();\n expect(publicKey?.length).toBe(65);\n expect(publicKey?.[0]).toBe(0x04);\n expect(publicKey?.[64]).toBe(0x51);\n });\n\n it(\"should return null for invalid response with missing header\", () => {\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: new Uint8Array([]),\n });\n\n const publicKey = extractPublicKey(response);\n\n expect(publicKey).toBeNull();\n });\n\n it(\"should return null for invalid response with missing public key\", () => {\n const responseData = new Uint8Array([\n 0x07, 0x4a, 0x07, 0xa1, 0x52, 0xe6, 0xbb, 0xc1,\n ]);\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: responseData,\n });\n\n const publicKey = extractPublicKey(response);\n\n expect(publicKey).toBeNull();\n });\n});\n\ndescribe(\"isDeviceGenuine\", () => {\n it(\"should return true if the device is genuine\", () => {\n const payload = \"0000\";\n expect(isDeviceGenuine(payload)).toBe(true);\n });\n it(\"should return false if the device is not genuine\", () => {\n const payload = \"not genuine\";\n expect(isDeviceGenuine(payload)).toBe(false);\n });\n});\n"],
5
+ "mappings": "aAAA,IA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IAAM,CAC1E,MAAMF,EAAe,IAAI,WAAW,CAClC,EAAM,GAAM,EAAM,IAAM,GAAM,IAAM,IAAM,GAC5C,CAAC,EAEKC,EAAW,IAAI,eAAa,CAChC,WAAY,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,EACvC,KAAMD,CACR,CAAC,EAEKE,KAAY,oBAAiBD,CAAQ,EAE3C,OAAOC,CAAS,EAAE,SAAS,CAC7B,CAAC,CACH,CAAC,EAED,SAAS,kBAAmB,IAAM,CAChC,GAAG,8CAA+C,IAAM,CAEtD,UAAO,mBADS,MACc,CAAC,EAAE,KAAK,EAAI,CAC5C,CAAC,EACD,GAAG,mDAAoD,IAAM,CAE3D,UAAO,mBADS,aACc,CAAC,EAAE,KAAK,EAAK,CAC7C,CAAC,CACH,CAAC",
6
+ "names": ["import_ApduResponse", "import_utils", "apdu", "responseData", "response", "publicKey"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var l=(o,e)=>{for(var i in e)d(o,i,{get:e[i],enumerable:!0})},y=(o,e,i,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of s(e))!p.call(o,n)&&n!==i&&d(o,n,{get:()=>e[n],enumerable:!(t=r(e,n))||t.enumerable});return o};var a=o=>y(d({},"__esModule",{value:!0}),o);var D={};l(D,{ConnectedDevice:()=>v});module.exports=a(D);class v{id;sessionId;modelId;name;type;constructor({transportConnectedDevice:{id:e,deviceModel:{id:i,productName:t},type:n},sessionId:c}){this.id=e,this.sessionId=c,this.modelId=i,this.name=t,this.type=n}}0&&(module.exports={ConnectedDevice});
1
+ "use strict";var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var y=(o,e)=>{for(var t in e)r(o,t,{get:e[t],enumerable:!0})},v=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of l(e))!a.call(o,n)&&n!==t&&r(o,n,{get:()=>e[n],enumerable:!(i=p(e,n))||i.enumerable});return o};var D=o=>v(r({},"__esModule",{value:!0}),o);var m={};y(m,{ConnectedDevice:()=>I});module.exports=D(m);class I{id;sessionId;modelId;name;type;transport;constructor({transportConnectedDevice:{id:e,deviceModel:{id:t,productName:i},type:n,transport:d,name:s},sessionId:c}){this.id=e,this.sessionId=c,this.modelId=t,this.name=s??i,this.type=n,this.transport=d}}0&&(module.exports={ConnectedDevice});
2
2
  //# sourceMappingURL=ConnectedDevice.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/transport/model/ConnectedDevice.ts"],
4
- "sourcesContent": ["import { type DeviceId, type DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type ConnectionType } from \"@api/discovery/ConnectionType\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport { type DeviceSessionId } from \"@api/types\";\n\ntype ConnectedDeviceConstructorArgs = {\n readonly sessionId: DeviceSessionId;\n readonly transportConnectedDevice: TransportConnectedDevice;\n};\n\nexport class ConnectedDevice {\n public readonly id: DeviceId;\n public readonly sessionId: DeviceSessionId;\n public readonly modelId: DeviceModelId;\n public readonly name: string;\n public readonly type: ConnectionType;\n\n constructor({\n transportConnectedDevice: {\n id,\n deviceModel: { id: deviceModelId, productName: deviceName },\n type,\n },\n sessionId,\n }: ConnectedDeviceConstructorArgs) {\n this.id = id;\n this.sessionId = sessionId;\n this.modelId = deviceModelId;\n this.name = deviceName;\n this.type = type;\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAUO,MAAME,CAAgB,CACX,GACA,UACA,QACA,KACA,KAEhB,YAAY,CACV,yBAA0B,CACxB,GAAAE,EACA,YAAa,CAAE,GAAIC,EAAe,YAAaC,CAAW,EAC1D,KAAAC,CACF,EACA,UAAAC,CACF,EAAmC,CACjC,KAAK,GAAKJ,EACV,KAAK,UAAYI,EACjB,KAAK,QAAUH,EACf,KAAK,KAAOC,EACZ,KAAK,KAAOC,CACd,CACF",
6
- "names": ["ConnectedDevice_exports", "__export", "ConnectedDevice", "__toCommonJS", "id", "deviceModelId", "deviceName", "type", "sessionId"]
4
+ "sourcesContent": ["import { type DeviceId, type DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type ConnectionType } from \"@api/discovery/ConnectionType\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport { type DeviceSessionId, type TransportIdentifier } from \"@api/types\";\n\ntype ConnectedDeviceConstructorArgs = {\n readonly sessionId: DeviceSessionId;\n readonly transportConnectedDevice: TransportConnectedDevice;\n};\n\nexport class ConnectedDevice {\n public readonly id: DeviceId;\n public readonly sessionId: DeviceSessionId;\n public readonly modelId: DeviceModelId;\n public readonly name: string;\n public readonly type: ConnectionType;\n public readonly transport: TransportIdentifier;\n\n constructor({\n transportConnectedDevice: {\n id,\n deviceModel: { id: deviceModelId, productName },\n type,\n transport,\n name,\n },\n sessionId,\n }: ConnectedDeviceConstructorArgs) {\n this.id = id;\n this.sessionId = sessionId;\n this.modelId = deviceModelId;\n this.name = name ?? productName;\n this.type = type;\n this.transport = transport;\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAUO,MAAME,CAAgB,CACX,GACA,UACA,QACA,KACA,KACA,UAEhB,YAAY,CACV,yBAA0B,CACxB,GAAAE,EACA,YAAa,CAAE,GAAIC,EAAe,YAAAC,CAAY,EAC9C,KAAAC,EACA,UAAAC,EACA,KAAAC,CACF,EACA,UAAAC,CACF,EAAmC,CACjC,KAAK,GAAKN,EACV,KAAK,UAAYM,EACjB,KAAK,QAAUL,EACf,KAAK,KAAOI,GAAQH,EACpB,KAAK,KAAOC,EACZ,KAAK,UAAYC,CACnB,CACF",
6
+ "names": ["ConnectedDevice_exports", "__export", "ConnectedDevice", "__toCommonJS", "id", "deviceModelId", "productName", "type", "transport", "name", "sessionId"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var r in e)p(t,r,{get:e[r],enumerable:!0})},l=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of c(e))!s.call(t,o)&&o!==r&&p(t,o,{get:()=>e[o],enumerable:!(n=d(e,o))||n.enumerable});return t};var a=t=>l(p({},"__esModule",{value:!0}),t);var T={};y(T,{TransportConnectedDevice:()=>u});module.exports=a(T);class u{id;deviceModel;sendApdu;type;transport;constructor({id:e,deviceModel:r,type:n,transport:o,sendApdu:i}){this.id=e,this.deviceModel=r,this.sendApdu=i,this.type=n,this.transport=o}}0&&(module.exports={TransportConnectedDevice});
1
+ "use strict";var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var a=(t,e)=>{for(var r in e)p(t,r,{get:e[r],enumerable:!0})},l=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of s(e))!y.call(t,n)&&n!==r&&p(t,n,{get:()=>e[n],enumerable:!(o=c(e,n))||o.enumerable});return t};var u=t=>l(p({},"__esModule",{value:!0}),t);var T={};a(T,{TransportConnectedDevice:()=>m});module.exports=u(T);class m{id;deviceModel;sendApdu;type;transport;name;constructor({id:e,deviceModel:r,type:o,transport:n,sendApdu:i,name:d}){this.id=e,this.deviceModel=r,this.sendApdu=i,this.type=o,this.transport=n,this.name=d}}0&&(module.exports={TransportConnectedDevice});
2
2
  //# sourceMappingURL=TransportConnectedDevice.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/transport/model/TransportConnectedDevice.ts"],
4
- "sourcesContent": ["import { type DeviceId } from \"@api/device/DeviceModel\";\nimport { type TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nimport { type ConnectionType } from \"@api/discovery/ConnectionType\";\nimport { type SendApduFnType } from \"@api/transport/model/DeviceConnection\";\nimport { type TransportIdentifier } from \"@api/transport/model/TransportIdentifier\";\n\n/**\n * The internal connected device.\n */\nexport type ConnectedDeviceConstructorArgs = {\n id: DeviceId;\n deviceModel: TransportDeviceModel;\n type: ConnectionType;\n transport: TransportIdentifier;\n sendApdu: SendApduFnType;\n};\n\nexport class TransportConnectedDevice {\n public readonly id: DeviceId;\n public readonly deviceModel: TransportDeviceModel;\n public readonly sendApdu: SendApduFnType;\n public readonly type: ConnectionType;\n public readonly transport: TransportIdentifier;\n\n constructor({\n id,\n deviceModel,\n type,\n transport,\n sendApdu,\n }: ConnectedDeviceConstructorArgs) {\n this.id = id;\n this.deviceModel = deviceModel;\n this.sendApdu = sendApdu;\n this.type = type;\n this.transport = transport;\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAiBO,MAAME,CAAyB,CACpB,GACA,YACA,SACA,KACA,UAEhB,YAAY,CACV,GAAAE,EACA,YAAAC,EACA,KAAAC,EACA,UAAAC,EACA,SAAAC,CACF,EAAmC,CACjC,KAAK,GAAKJ,EACV,KAAK,YAAcC,EACnB,KAAK,SAAWG,EAChB,KAAK,KAAOF,EACZ,KAAK,UAAYC,CACnB,CACF",
6
- "names": ["TransportConnectedDevice_exports", "__export", "TransportConnectedDevice", "__toCommonJS", "id", "deviceModel", "type", "transport", "sendApdu"]
4
+ "sourcesContent": ["import { type DeviceId } from \"@api/device/DeviceModel\";\nimport { type TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nimport { type ConnectionType } from \"@api/discovery/ConnectionType\";\nimport { type SendApduFnType } from \"@api/transport/model/DeviceConnection\";\nimport { type TransportIdentifier } from \"@api/transport/model/TransportIdentifier\";\n\n/**\n * The internal connected device.\n */\nexport type ConnectedDeviceConstructorArgs = {\n id: DeviceId;\n deviceModel: TransportDeviceModel;\n type: ConnectionType;\n transport: TransportIdentifier;\n sendApdu: SendApduFnType;\n name?: string;\n};\n\nexport class TransportConnectedDevice {\n public readonly id: DeviceId;\n public readonly deviceModel: TransportDeviceModel;\n public readonly sendApdu: SendApduFnType;\n public readonly type: ConnectionType;\n public readonly transport: TransportIdentifier;\n public readonly name?: string;\n\n constructor({\n id,\n deviceModel,\n type,\n transport,\n sendApdu,\n name,\n }: ConnectedDeviceConstructorArgs) {\n this.id = id;\n this.deviceModel = deviceModel;\n this.sendApdu = sendApdu;\n this.type = type;\n this.transport = transport;\n this.name = name;\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAkBO,MAAME,CAAyB,CACpB,GACA,YACA,SACA,KACA,UACA,KAEhB,YAAY,CACV,GAAAE,EACA,YAAAC,EACA,KAAAC,EACA,UAAAC,EACA,SAAAC,EACA,KAAAC,CACF,EAAmC,CACjC,KAAK,GAAKL,EACV,KAAK,YAAcC,EACnB,KAAK,SAAWG,EAChB,KAAK,KAAOF,EACZ,KAAK,UAAYC,EACjB,KAAK,KAAOE,CACd,CACF",
6
+ "names": ["TransportConnectedDevice_exports", "__export", "TransportConnectedDevice", "__toCommonJS", "id", "deviceModel", "type", "transport", "sendApdu", "name"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var p=(a,r,n,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of c(r))!o.call(a,t)&&t!==n&&i(a,t,{get:()=>r[t],enumerable:!(e=y(r,t))||e.enumerable});return a};var A=a=>p(i({},"__esModule",{value:!0}),a);var U={};module.exports=A(U);
2
+ //# sourceMappingURL=CryptoService.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/crypto/CryptoService.ts"],
4
+ "sourcesContent": ["/**\n * Simple crypto service abstraction for hashing operations\n */\nexport interface CryptoService {\n /**\n * Compute SHA3-256 hash of the input data\n * @param data - The input data to hash\n * @returns The SHA3-256 hash as a Uint8Array (32 bytes)\n */\n sha3_256(data: Uint8Array): Uint8Array;\n}\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["CryptoService_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var c=(e,r)=>{for(var o in r)i(e,o,{get:r[o],enumerable:!0})},n=(e,r,o,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of a(r))!s.call(e,t)&&t!==o&&i(e,t,{get:()=>r[t],enumerable:!(p=y(r,t))||p.enumerable});return e};var l=e=>n(i({},"__esModule",{value:!0}),e);var C={};c(C,{NobleCryptoService:()=>v});module.exports=l(C);var m=require("@noble/hashes/sha3");class v{sha3_256(r){return(0,m.sha3_256)(r)}}0&&(module.exports={NobleCryptoService});
2
+ //# sourceMappingURL=NobleCryptoService.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/crypto/NobleCryptoService.ts"],
4
+ "sourcesContent": ["import { sha3_256 } from \"@noble/hashes/sha3\";\n\nimport { type CryptoService } from \"./CryptoService\";\n\n/**\n * Noble implementation of the crypto service\n */\nexport class NobleCryptoService implements CryptoService {\n sha3_256(data: Uint8Array): Uint8Array {\n return sha3_256(data);\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyB,8BAOlB,MAAMF,CAA4C,CACvD,SAASG,EAA8B,CACrC,SAAO,YAASA,CAAI,CACtB,CACF",
6
+ "names": ["NobleCryptoService_exports", "__export", "NobleCryptoService", "__toCommonJS", "import_sha3", "data"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("./NobleCryptoService");describe("NobleCryptoService",()=>{let x;beforeEach(()=>{x=new e.NobleCryptoService}),describe("sha3_256",()=>{it("should compute SHA3-256 hash",()=>{const r=new Uint8Array([1,2,3,4]),c=x.sha3_256(r);expect(c).toStrictEqual(new Uint8Array([150,109,189,203,208,224,52,143,170,28,203,206,90,98,184,231,59,13,8,149,93,102,109,184,34,67,179,3,217,189,149,2]))})})});
2
+ //# sourceMappingURL=NobleCryptoService.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/crypto/NobleCryptoService.test.ts"],
4
+ "sourcesContent": ["import { NobleCryptoService } from \"./NobleCryptoService\";\n\ndescribe(\"NobleCryptoService\", () => {\n let cryptoService: NobleCryptoService;\n\n beforeEach(() => {\n cryptoService = new NobleCryptoService();\n });\n\n describe(\"sha3_256\", () => {\n it(\"should compute SHA3-256 hash\", () => {\n const input = new Uint8Array([0x01, 0x02, 0x03, 0x04]);\n const hash = cryptoService.sha3_256(input);\n\n expect(hash).toStrictEqual(\n new Uint8Array([\n 0x96, 0x6d, 0xbd, 0xcb, 0xd0, 0xe0, 0x34, 0x8f, 0xaa, 0x1c, 0xcb,\n 0xce, 0x5a, 0x62, 0xb8, 0xe7, 0x3b, 0x0d, 0x08, 0x95, 0x5d, 0x66,\n 0x6d, 0xb8, 0x22, 0x43, 0xb3, 0x03, 0xd9, 0xbd, 0x95, 0x02,\n ]),\n );\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAAmC,gCAEnC,SAAS,qBAAsB,IAAM,CACnC,IAAIC,EAEJ,WAAW,IAAM,CACfA,EAAgB,IAAI,oBACtB,CAAC,EAED,SAAS,WAAY,IAAM,CACzB,GAAG,+BAAgC,IAAM,CACvC,MAAMC,EAAQ,IAAI,WAAW,CAAC,EAAM,EAAM,EAAM,CAAI,CAAC,EAC/CC,EAAOF,EAAc,SAASC,CAAK,EAEzC,OAAOC,CAAI,EAAE,cACX,IAAI,WAAW,CACb,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,GAAM,IAAM,IAAM,GAAM,IAC5D,IAAM,GAAM,GAAM,IAAM,IAAM,GAAM,GAAM,EAAM,IAAM,GAAM,IAC5D,IAAM,IAAM,GAAM,GAAM,IAAM,EAAM,IAAM,IAAM,IAAM,CACxD,CAAC,CACH,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_NobleCryptoService", "cryptoService", "input", "hash"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var b=(n,e)=>{for(var t in e)a(n,t,{get:e[t],enumerable:!0})},y=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of C(e))!R.call(n,i)&&i!==t&&a(n,i,{get:()=>e[i],enumerable:!(s=A(e,i))||s.enumerable});return n};var T=n=>y(a({},"__esModule",{value:!0}),n);var I={};b(I,{DeviceSession:()=>O});module.exports=T(I);var v=require("rxjs"),d=require("uuid"),h=require("../../../api/command/utils/CommandUtils"),p=require("../../../api/device/DeviceStatus"),S=require("../../../api/device-session/DeviceSessionState"),u=require("../../device-session/data/DeviceSessionRefresherConst"),m=require("../../device-session/service/MutexService"),D=require("../../device-session/service/RefresherService"),l=require("./DevicePinger"),o=require("./DeviceSessionEventDispatcher"),_=require("./DeviceSessionRefresher"),f=require("./DeviceSessionStateHandler");class O{_id;_connectedDevice;_deviceState;_managerApiService;_secureChannelService;_logger;_refresherOptions;_pinger;_deviceSessionRefresher;_refresherService;_commandMutex=new m.MutexService;_sessionEventDispatcher=new o.DeviceSessionEventDispatcher;constructor({connectedDevice:e,id:t=(0,d.v4)()},s,i,r,g){this._id=t,this._connectedDevice=e,this._logger=s("device-session"),this._managerApiService=i,this._secureChannelService=r,this._refresherOptions={...u.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,...g},this._deviceState=new v.BehaviorSubject({sessionStateType:S.DeviceSessionStateType.Connected,deviceStatus:p.DeviceStatus.CONNECTED,deviceModelId:this._connectedDevice.deviceModel.id}),this._pinger=new l.DevicePinger(s,e,this._sessionEventDispatcher,(c,E)=>this.sendCommand(c,E)),this._deviceSessionRefresher=new _.DeviceSessionRefresher(s,this._refresherOptions,this._sessionEventDispatcher,this._connectedDevice),new f.DeviceSessionStateHandler(s,this._sessionEventDispatcher,this._connectedDevice,this._deviceState,c=>this.setDeviceSessionState(c)),this._refresherService=new D.RefresherService(s,{start:()=>this._deviceSessionRefresher.restartRefresher(),stop:()=>this._deviceSessionRefresher.stopRefresher()})}async initialiseSession(){try{await this._pinger.ping()}catch(e){throw this._logger.error("Error while initialising session",{data:{error:e}}),e}finally{this._refresherOptions.isRefresherDisabled||this._deviceSessionRefresher.startRefresher()}}get id(){return this._id}get connectedDevice(){return this._connectedDevice}get state(){return this._deviceState.asObservable()}getDeviceSessionState(){return this._deviceState.getValue()}setDeviceSessionState(e){this._deviceState.next(e)}async sendApdu(e,t={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){const s=await this._commandMutex.lock();try{this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_BUSY});const i=await this._connectedDevice.sendApdu(e,t.triggersDisconnection,t.abortTimeout);return i.ifRight(r=>{h.CommandUtils.isLockedDeviceResponse(r)?this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_LOCKED}):this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_CONNECTED})}).ifLeft(()=>{this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_CONNECTED})}),i}finally{s()}}async sendCommand(e,t){const s=e.getApdu();return(await this.sendApdu(s.getRawApdu(),{isPolling:!1,triggersDisconnection:e.triggersDisconnection??!1,abortTimeout:t})).caseOf({Left:r=>{throw r},Right:r=>e.parseResponse(r,this._connectedDevice.deviceModel.id)})}executeDeviceAction(e){const{observable:t,cancel:s}=e._execute({sendApdu:async i=>this.sendApdu(i),sendCommand:async(i,r)=>this.sendCommand(i,r),getDeviceModel:()=>this._connectedDevice.deviceModel,getDeviceSessionState:()=>this._deviceState.getValue(),getDeviceSessionStateObservable:()=>this.state,setDeviceSessionState:i=>(this.setDeviceSessionState(i),this._deviceState.getValue()),disableRefresher:i=>this._refresherService.disableRefresher(i),getManagerApiService:()=>this._managerApiService,getSecureChannelService:()=>this._secureChannelService});return{observable:t,cancel:s}}close(){this._updateDeviceStatus(p.DeviceStatus.NOT_CONNECTED),this._deviceState.complete(),this._deviceSessionRefresher.stopRefresher()}disableRefresher(e){return this._refresherService.disableRefresher(e)}_updateDeviceStatus(e){const t=this._deviceState.getValue();this._deviceState.next({...t,deviceStatus:e})}}0&&(module.exports={DeviceSession});
1
+ "use strict";var p=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var i in e)p(n,i,{get:e[i],enumerable:!0})},T=(n,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of R(e))!A.call(n,t)&&t!==i&&p(n,t,{get:()=>e[t],enumerable:!(s=C(e,t))||s.enumerable});return n};var O=n=>T(p({},"__esModule",{value:!0}),n);var x={};y(x,{DeviceSession:()=>I});module.exports=O(x);var h=require("rxjs"),S=require("uuid"),u=require("../../../api/command/utils/CommandUtils"),d=require("../../../api/device/DeviceStatus"),m=require("../../../api/device-session/DeviceSessionState"),a=require("../../../api/index"),l=require("../../device-session/data/DeviceSessionRefresherConst"),D=require("../../device-session/service/MutexService"),_=require("../../device-session/service/RefresherService"),g=require("./DevicePinger"),o=require("./DeviceSessionEventDispatcher"),f=require("./DeviceSessionRefresher"),E=require("./DeviceSessionStateHandler");class I{_id;_connectedDevice;_deviceState;_managerApiService;_secureChannelService;_logger;_refresherOptions;_pinger;_deviceSessionRefresher;_refresherService;_commandMutex=new D.MutexService;_sessionEventDispatcher=new o.DeviceSessionEventDispatcher;constructor({connectedDevice:e,id:i=(0,S.v4)()},s,t,r,c){this._id=i,this._connectedDevice=e,this._logger=s("device-session"),this._managerApiService=t,this._secureChannelService=r,this._refresherOptions={...l.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,...c},this._deviceState=new h.BehaviorSubject({sessionStateType:m.DeviceSessionStateType.Connected,deviceStatus:d.DeviceStatus.CONNECTED,deviceModelId:this._connectedDevice.deviceModel.id}),this._pinger=new g.DevicePinger(s,e,this._sessionEventDispatcher,(v,b)=>this.sendCommand(v,b)),this._deviceSessionRefresher=new f.DeviceSessionRefresher(s,this._refresherOptions,this._sessionEventDispatcher,this._connectedDevice),new E.DeviceSessionStateHandler(s,this._sessionEventDispatcher,this._connectedDevice,this._deviceState,v=>this.setDeviceSessionState(v)),this._refresherService=new _.RefresherService(s,{start:()=>this._deviceSessionRefresher.restartRefresher(),stop:()=>this._deviceSessionRefresher.stopRefresher()})}async initialiseSession(){try{await this._pinger.ping()}catch(e){throw this._logger.error("Error while initialising session",{data:{error:e}}),e}finally{this._refresherOptions.isRefresherDisabled||this._deviceSessionRefresher.startRefresher()}}get id(){return this._id}get connectedDevice(){return this._connectedDevice}get state(){return this._deviceState.asObservable()}getDeviceSessionState(){return this._deviceState.getValue()}setDeviceSessionState(e){this._deviceState.next(e)}async sendApdu(e,i={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){const s=await this._commandMutex.lock();try{this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_BUSY}),this._logger.debug(`[exchange] => ${(0,a.bufferToHexaString)(e,!1)}`);const t=await this._connectedDevice.sendApdu(e,i.triggersDisconnection,i.abortTimeout);return t.ifRight(r=>{this._logger.debug(`[exchange] <= ${(0,a.bufferToHexaString)(r.data,!1)}${(0,a.bufferToHexaString)(r.statusCode,!1)}`),u.CommandUtils.isLockedDeviceResponse(r)?this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_LOCKED}):this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_CONNECTED})}).ifLeft(()=>{this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_CONNECTED})}),t}finally{s()}}async sendCommand(e,i){this._logger.debug(`[sendCommand] ${e.name}`);const s=e.getApdu();return(await this.sendApdu(s.getRawApdu(),{isPolling:!1,triggersDisconnection:e.triggersDisconnection??!1,abortTimeout:i})).caseOf({Left:r=>{throw this._logger.error("[sendCommand] error",{data:{err:r}}),r},Right:r=>{const c=e.parseResponse(r,this._connectedDevice.deviceModel.id);return this._logger.debug("[sendCommand] result",{data:{result:c}}),c}})}executeDeviceAction(e){const{observable:i,cancel:s}=e._execute({sendApdu:async t=>this.sendApdu(t),sendCommand:async(t,r)=>this.sendCommand(t,r),getDeviceModel:()=>this._connectedDevice.deviceModel,getDeviceSessionState:()=>this._deviceState.getValue(),getDeviceSessionStateObservable:()=>this.state,setDeviceSessionState:t=>(this.setDeviceSessionState(t),this._deviceState.getValue()),disableRefresher:t=>this._refresherService.disableRefresher(t),getManagerApiService:()=>this._managerApiService,getSecureChannelService:()=>this._secureChannelService});return{observable:i,cancel:s}}close(){this._updateDeviceStatus(d.DeviceStatus.NOT_CONNECTED),this._deviceState.complete(),this._deviceSessionRefresher.stopRefresher()}disableRefresher(e){return this._refresherService.disableRefresher(e)}_updateDeviceStatus(e){const i=this._deviceState.getValue();this._deviceState.next({...i,deviceStatus:e})}}0&&(module.exports={DeviceSession});
2
2
  //# sourceMappingURL=DeviceSession.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/model/DeviceSession.ts"],
4
- "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { BehaviorSubject, type Observable } from \"rxjs\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"@api/device-action/DeviceAction\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceSessionId } from \"@api/device-session/types\";\nimport { type DmkError } from \"@api/Error\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { MutexService } from \"@internal/device-session/service/MutexService\";\nimport { RefresherService } from \"@internal/device-session/service/RefresherService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { DevicePinger } from \"./DevicePinger\";\nimport {\n DeviceSessionEventDispatcher,\n SessionEvents,\n} from \"./DeviceSessionEventDispatcher\";\nimport { DeviceSessionRefresher } from \"./DeviceSessionRefresher\";\nimport { DeviceSessionStateHandler } from \"./DeviceSessionStateHandler\";\n\nexport type SessionConstructorArgs = {\n connectedDevice: TransportConnectedDevice;\n id?: DeviceSessionId;\n};\n\nexport type DeviceSessionRefresherOptions = {\n isRefresherDisabled: boolean;\n pollingInterval?: number;\n};\n\ntype SendApduOptions = {\n isPolling?: boolean;\n triggersDisconnection?: boolean;\n abortTimeout?: number;\n};\n\n/**\n * Represents a session with a device.\n */\nexport class DeviceSession {\n private readonly _id: DeviceSessionId;\n private readonly _connectedDevice: TransportConnectedDevice;\n private readonly _deviceState: BehaviorSubject<DeviceSessionState>;\n private readonly _managerApiService: ManagerApiService;\n private readonly _secureChannelService: SecureChannelService;\n private readonly _logger: LoggerPublisherService;\n private readonly _refresherOptions: DeviceSessionRefresherOptions;\n private _pinger: DevicePinger;\n private _deviceSessionRefresher: DeviceSessionRefresher;\n private readonly _refresherService: RefresherService;\n private _commandMutex = new MutexService();\n private _sessionEventDispatcher = new DeviceSessionEventDispatcher();\n\n constructor(\n { connectedDevice, id = uuidv4() }: SessionConstructorArgs,\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n managerApiService: ManagerApiService,\n secureChannelService: SecureChannelService,\n deviceSessionRefresherOptions: DeviceSessionRefresherOptions | undefined,\n ) {\n this._id = id;\n this._connectedDevice = connectedDevice;\n this._logger = loggerModuleFactory(\"device-session\");\n this._managerApiService = managerApiService;\n this._secureChannelService = secureChannelService;\n this._refresherOptions = {\n ...DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n ...deviceSessionRefresherOptions,\n };\n this._deviceState = new BehaviorSubject<DeviceSessionState>({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: this._connectedDevice.deviceModel.id,\n });\n\n this._pinger = new DevicePinger(\n loggerModuleFactory,\n connectedDevice,\n this._sessionEventDispatcher,\n (command, abortTimeout) => this.sendCommand(command, abortTimeout),\n );\n this._deviceSessionRefresher = new DeviceSessionRefresher(\n loggerModuleFactory,\n this._refresherOptions,\n this._sessionEventDispatcher,\n this._connectedDevice,\n );\n new DeviceSessionStateHandler(\n loggerModuleFactory,\n this._sessionEventDispatcher,\n this._connectedDevice,\n this._deviceState,\n (state) => this.setDeviceSessionState(state),\n );\n\n this._refresherService = new RefresherService(loggerModuleFactory, {\n start: () => this._deviceSessionRefresher.restartRefresher(),\n stop: () => this._deviceSessionRefresher.stopRefresher(),\n });\n }\n\n public async initialiseSession(): Promise<void> {\n try {\n await this._pinger.ping();\n } catch (error) {\n this._logger.error(\"Error while initialising session\", {\n data: { error },\n });\n throw error;\n } finally {\n if (!this._refresherOptions.isRefresherDisabled) {\n this._deviceSessionRefresher.startRefresher();\n }\n }\n }\n\n public get id(): DeviceSessionId {\n return this._id;\n }\n\n public get connectedDevice(): TransportConnectedDevice {\n return this._connectedDevice;\n }\n\n public get state(): Observable<DeviceSessionState> {\n return this._deviceState.asObservable();\n }\n\n public getDeviceSessionState(): DeviceSessionState {\n return this._deviceState.getValue();\n }\n\n public setDeviceSessionState(state: DeviceSessionState): void {\n this._deviceState.next(state);\n }\n\n public async sendApdu(\n rawApdu: Uint8Array,\n options: SendApduOptions = {\n isPolling: false,\n triggersDisconnection: false,\n abortTimeout: undefined,\n },\n ): Promise<Either<DmkError, ApduResponse>> {\n const release = await this._commandMutex.lock();\n\n try {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_BUSY,\n });\n const result = await this._connectedDevice.sendApdu(\n rawApdu,\n options.triggersDisconnection,\n options.abortTimeout,\n );\n\n result\n .ifRight((response: ApduResponse) => {\n if (CommandUtils.isLockedDeviceResponse(response)) {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_LOCKED,\n });\n } else {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n }\n })\n .ifLeft(() => {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n });\n return result;\n } finally {\n release();\n }\n }\n\n public async sendCommand<Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n abortTimeout?: number,\n ): Promise<CommandResult<Response, ErrorStatusCodes>> {\n const apdu = command.getApdu();\n\n const response = await this.sendApdu(apdu.getRawApdu(), {\n isPolling: false,\n triggersDisconnection: command.triggersDisconnection ?? false,\n abortTimeout,\n });\n\n return response.caseOf({\n Left: (err) => {\n throw err;\n },\n Right: (r) =>\n command.parseResponse(r, this._connectedDevice.deviceModel.id),\n });\n }\n\n public executeDeviceAction<\n Output,\n Input,\n E extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n >(\n deviceAction: DeviceAction<Output, Input, E, IntermediateValue>,\n ): ExecuteDeviceActionReturnType<Output, E, IntermediateValue> {\n const { observable, cancel } = deviceAction._execute({\n sendApdu: async (apdu: Uint8Array) => this.sendApdu(apdu),\n sendCommand: async <Response, ErrorStatusCodes, Args>(\n command: Command<Response, ErrorStatusCodes, Args>,\n abortTimeout?: number,\n ) => this.sendCommand(command, abortTimeout),\n getDeviceModel: () => this._connectedDevice.deviceModel,\n getDeviceSessionState: () => this._deviceState.getValue(),\n getDeviceSessionStateObservable: () => this.state,\n setDeviceSessionState: (state: DeviceSessionState) => {\n this.setDeviceSessionState(state);\n return this._deviceState.getValue();\n },\n disableRefresher: (blockerId: string) =>\n this._refresherService.disableRefresher(blockerId),\n getManagerApiService: () => this._managerApiService,\n getSecureChannelService: () => this._secureChannelService,\n });\n return { observable, cancel };\n }\n\n public close(): void {\n this._updateDeviceStatus(DeviceStatus.NOT_CONNECTED);\n this._deviceState.complete();\n this._deviceSessionRefresher.stopRefresher();\n }\n\n public disableRefresher(id: string): () => void {\n return this._refresherService.disableRefresher(id);\n }\n\n private _updateDeviceStatus(deviceStatus: DeviceStatus): void {\n const state = this._deviceState.getValue();\n this._deviceState.next({ ...state, deviceStatus });\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAiD,gBACjDC,EAA6B,gBAI7BC,EAA6B,2CAC7BC,EAA6B,oCAO7BC,EAGO,kDAKPC,EAAyD,qEACzDC,EAA6B,yDAC7BC,EAAiC,6DAIjCC,EAA6B,0BAC7BC,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AAK,SAASA,CAAI,EACxD,YAAa,MACXT,EACAC,IACG,KAAK,YAAYD,EAASC,CAAY,EAC3C,eAAgB,IAAM,KAAK,iBAAiB,YAC5C,sBAAuB,IAAM,KAAK,aAAa,SAAS,EACxD,gCAAiC,IAAM,KAAK,MAC5C,sBAAwBC,IACtB,KAAK,sBAAsBA,CAAK,EACzB,KAAK,aAAa,SAAS,GAEpC,iBAAmBY,GACjB,KAAK,kBAAkB,iBAAiBA,CAAS,EACnD,qBAAsB,IAAM,KAAK,mBACjC,wBAAyB,IAAM,KAAK,qBACtC,CAAC,EACD,MAAO,CAAE,WAAAF,EAAY,OAAAC,CAAO,CAC9B,CAEO,OAAc,CACnB,KAAK,oBAAoB,eAAa,aAAa,EACnD,KAAK,aAAa,SAAS,EAC3B,KAAK,wBAAwB,cAAc,CAC7C,CAEO,iBAAiBnB,EAAwB,CAC9C,OAAO,KAAK,kBAAkB,iBAAiBA,CAAE,CACnD,CAEQ,oBAAoBqB,EAAkC,CAC5D,MAAMb,EAAQ,KAAK,aAAa,SAAS,EACzC,KAAK,aAAa,KAAK,CAAE,GAAGA,EAAO,aAAAa,CAAa,CAAC,CACnD,CACF",
6
- "names": ["DeviceSession_exports", "__export", "DeviceSession", "__toCommonJS", "import_rxjs", "import_uuid", "import_CommandUtils", "import_DeviceStatus", "import_DeviceSessionState", "import_DeviceSessionRefresherConst", "import_MutexService", "import_RefresherService", "import_DevicePinger", "import_DeviceSessionEventDispatcher", "import_DeviceSessionRefresher", "import_DeviceSessionStateHandler", "connectedDevice", "id", "uuidv4", "loggerModuleFactory", "managerApiService", "secureChannelService", "deviceSessionRefresherOptions", "command", "abortTimeout", "state", "error", "rawApdu", "options", "release", "result", "response", "apdu", "err", "deviceAction", "observable", "cancel", "blockerId", "deviceStatus"]
4
+ "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { BehaviorSubject, type Observable } from \"rxjs\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"@api/device-action/DeviceAction\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceSessionId } from \"@api/device-session/types\";\nimport { type DmkError } from \"@api/Error\";\nimport { bufferToHexaString } from \"@api/index\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { MutexService } from \"@internal/device-session/service/MutexService\";\nimport { RefresherService } from \"@internal/device-session/service/RefresherService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { DevicePinger } from \"./DevicePinger\";\nimport {\n DeviceSessionEventDispatcher,\n SessionEvents,\n} from \"./DeviceSessionEventDispatcher\";\nimport { DeviceSessionRefresher } from \"./DeviceSessionRefresher\";\nimport { DeviceSessionStateHandler } from \"./DeviceSessionStateHandler\";\n\nexport type SessionConstructorArgs = {\n connectedDevice: TransportConnectedDevice;\n id?: DeviceSessionId;\n};\n\nexport type DeviceSessionRefresherOptions = {\n isRefresherDisabled: boolean;\n pollingInterval?: number;\n};\n\ntype SendApduOptions = {\n isPolling?: boolean;\n triggersDisconnection?: boolean;\n abortTimeout?: number;\n};\n\n/**\n * Represents a session with a device.\n */\nexport class DeviceSession {\n private readonly _id: DeviceSessionId;\n private readonly _connectedDevice: TransportConnectedDevice;\n private readonly _deviceState: BehaviorSubject<DeviceSessionState>;\n private readonly _managerApiService: ManagerApiService;\n private readonly _secureChannelService: SecureChannelService;\n private readonly _logger: LoggerPublisherService;\n private readonly _refresherOptions: DeviceSessionRefresherOptions;\n private _pinger: DevicePinger;\n private _deviceSessionRefresher: DeviceSessionRefresher;\n private readonly _refresherService: RefresherService;\n private _commandMutex = new MutexService();\n private _sessionEventDispatcher = new DeviceSessionEventDispatcher();\n\n constructor(\n { connectedDevice, id = uuidv4() }: SessionConstructorArgs,\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n managerApiService: ManagerApiService,\n secureChannelService: SecureChannelService,\n deviceSessionRefresherOptions: DeviceSessionRefresherOptions | undefined,\n ) {\n this._id = id;\n this._connectedDevice = connectedDevice;\n this._logger = loggerModuleFactory(\"device-session\");\n this._managerApiService = managerApiService;\n this._secureChannelService = secureChannelService;\n this._refresherOptions = {\n ...DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n ...deviceSessionRefresherOptions,\n };\n this._deviceState = new BehaviorSubject<DeviceSessionState>({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: this._connectedDevice.deviceModel.id,\n });\n\n this._pinger = new DevicePinger(\n loggerModuleFactory,\n connectedDevice,\n this._sessionEventDispatcher,\n (command, abortTimeout) => this.sendCommand(command, abortTimeout),\n );\n this._deviceSessionRefresher = new DeviceSessionRefresher(\n loggerModuleFactory,\n this._refresherOptions,\n this._sessionEventDispatcher,\n this._connectedDevice,\n );\n new DeviceSessionStateHandler(\n loggerModuleFactory,\n this._sessionEventDispatcher,\n this._connectedDevice,\n this._deviceState,\n (state) => this.setDeviceSessionState(state),\n );\n\n this._refresherService = new RefresherService(loggerModuleFactory, {\n start: () => this._deviceSessionRefresher.restartRefresher(),\n stop: () => this._deviceSessionRefresher.stopRefresher(),\n });\n }\n\n public async initialiseSession(): Promise<void> {\n try {\n await this._pinger.ping();\n } catch (error) {\n this._logger.error(\"Error while initialising session\", {\n data: { error },\n });\n throw error;\n } finally {\n if (!this._refresherOptions.isRefresherDisabled) {\n this._deviceSessionRefresher.startRefresher();\n }\n }\n }\n\n public get id(): DeviceSessionId {\n return this._id;\n }\n\n public get connectedDevice(): TransportConnectedDevice {\n return this._connectedDevice;\n }\n\n public get state(): Observable<DeviceSessionState> {\n return this._deviceState.asObservable();\n }\n\n public getDeviceSessionState(): DeviceSessionState {\n return this._deviceState.getValue();\n }\n\n public setDeviceSessionState(state: DeviceSessionState): void {\n this._deviceState.next(state);\n }\n\n public async sendApdu(\n rawApdu: Uint8Array,\n options: SendApduOptions = {\n isPolling: false,\n triggersDisconnection: false,\n abortTimeout: undefined,\n },\n ): Promise<Either<DmkError, ApduResponse>> {\n const release = await this._commandMutex.lock();\n\n try {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_BUSY,\n });\n\n this._logger.debug(`[exchange] => ${bufferToHexaString(rawApdu, false)}`);\n const result = await this._connectedDevice.sendApdu(\n rawApdu,\n options.triggersDisconnection,\n options.abortTimeout,\n );\n\n result\n .ifRight((response: ApduResponse) => {\n this._logger.debug(\n `[exchange] <= ${bufferToHexaString(response.data, false)}${bufferToHexaString(response.statusCode, false)}`,\n );\n if (CommandUtils.isLockedDeviceResponse(response)) {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_LOCKED,\n });\n } else {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n }\n })\n .ifLeft(() => {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n });\n return result;\n } finally {\n release();\n }\n }\n\n public async sendCommand<Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n abortTimeout?: number,\n ): Promise<CommandResult<Response, ErrorStatusCodes>> {\n this._logger.debug(`[sendCommand] ${command.name}`);\n const apdu = command.getApdu();\n\n const response = await this.sendApdu(apdu.getRawApdu(), {\n isPolling: false,\n triggersDisconnection: command.triggersDisconnection ?? false,\n abortTimeout,\n });\n\n return response.caseOf({\n Left: (err) => {\n this._logger.error(\"[sendCommand] error\", { data: { err } });\n throw err;\n },\n Right: (r) => {\n const result = command.parseResponse(\n r,\n this._connectedDevice.deviceModel.id,\n );\n this._logger.debug(\"[sendCommand] result\", { data: { result } });\n return result;\n },\n });\n }\n\n public executeDeviceAction<\n Output,\n Input,\n E extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n >(\n deviceAction: DeviceAction<Output, Input, E, IntermediateValue>,\n ): ExecuteDeviceActionReturnType<Output, E, IntermediateValue> {\n const { observable, cancel } = deviceAction._execute({\n sendApdu: async (apdu: Uint8Array) => this.sendApdu(apdu),\n sendCommand: async <Response, ErrorStatusCodes, Args>(\n command: Command<Response, ErrorStatusCodes, Args>,\n abortTimeout?: number,\n ) => this.sendCommand(command, abortTimeout),\n getDeviceModel: () => this._connectedDevice.deviceModel,\n getDeviceSessionState: () => this._deviceState.getValue(),\n getDeviceSessionStateObservable: () => this.state,\n setDeviceSessionState: (state: DeviceSessionState) => {\n this.setDeviceSessionState(state);\n return this._deviceState.getValue();\n },\n disableRefresher: (blockerId: string) =>\n this._refresherService.disableRefresher(blockerId),\n getManagerApiService: () => this._managerApiService,\n getSecureChannelService: () => this._secureChannelService,\n });\n return { observable, cancel };\n }\n\n public close(): void {\n this._updateDeviceStatus(DeviceStatus.NOT_CONNECTED);\n this._deviceState.complete();\n this._deviceSessionRefresher.stopRefresher();\n }\n\n public disableRefresher(id: string): () => void {\n return this._refresherService.disableRefresher(id);\n }\n\n private _updateDeviceStatus(deviceStatus: DeviceStatus): void {\n const state = this._deviceState.getValue();\n this._deviceState.next({ ...state, deviceStatus });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAiD,gBACjDC,EAA6B,gB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GA,EAAO,aAAAa,CAAa,CAAC,CACnD,CACF",
6
+ "names": ["DeviceSession_exports", "__export", "DeviceSession", "__toCommonJS", "import_rxjs", "import_uuid", "import_CommandUtils", "import_DeviceStatus", "import_DeviceSessionState", "import_api", "import_DeviceSessionRefresherConst", "import_MutexService", "import_RefresherService", "import_DevicePinger", "import_DeviceSessionEventDispatcher", "import_DeviceSessionRefresher", "import_DeviceSessionStateHandler", "connectedDevice", "id", "uuidv4", "loggerModuleFactory", "managerApiService", "secureChannelService", "deviceSessionRefresherOptions", "command", "abortTimeout", "state", "error", "rawApdu", "options", "release", "result", "response", "apdu", "err", "deviceAction", "observable", "cancel", "blockerId", "deviceStatus"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var _=(o,e)=>{for(var i in e)n(o,i,{get:e[i],enumerable:!0})},p=(o,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of m(e))!f.call(o,t)&&t!==i&&n(o,t,{get:()=>e[t],enumerable:!(s=d(e,t))||s.enumerable});return o};var D=o=>p(n({},"__esModule",{value:!0}),o),l=(o,e,i,s)=>{for(var t=s>1?void 0:s?d(e,i):e,g=o.length-1,v;g>=0;g--)(v=o[g])&&(t=(s?v(e,i,t):v(t))||t);return s&&t&&n(e,i,t),t},u=(o,e)=>(i,s)=>e(i,s,o);var y={};_(y,{DefaultDeviceSessionService:()=>r});module.exports=D(y);var c=require("inversify"),a=require("purify-ts"),S=require("rxjs"),h=require("../../device-session/model/Errors"),b=require("../../logger-publisher/di/loggerTypes");let r=class{_sessions;_logger;_sessionsSubject;constructor(e){this._sessions=[],this._sessionsSubject=new S.ReplaySubject,this._logger=e("DeviceSessionService")}get sessionsObs(){return this._sessionsSubject.asObservable()}addDeviceSession(e){return this._sessions.find(s=>s.id===e.id)?(this._logger.warn("DeviceSession already exists",{data:{deviceSession:e}}),this):(this._sessions.push(e),this._sessionsSubject.next(e),this._logger.info("DeviceSession added",{data:{deviceSession:e}}),this)}removeDeviceSession(e){const i=this._sessions.find(s=>s.id===e);return i?(i.close(),this._sessions=this._sessions.filter(s=>s.id!==e),this._logger.info("DeviceSession removed",{data:{sessionId:e}}),this):(this._logger.warn("DeviceSession not found",{data:{sessionId:e}}),this)}getDeviceSessionById(e){return a.Maybe.fromNullable(this._sessions.find(s=>s.id===e)).toEither(new h.DeviceSessionNotFound)}getDeviceSessionByDeviceId(e){return a.Maybe.fromNullable(this._sessions.find(s=>s.connectedDevice.id===e)).toEither(new h.DeviceSessionNotFound)}getDeviceSessions(){return this._sessions}};r=l([(0,c.injectable)(),u(0,(0,c.inject)(b.loggerTypes.LoggerPublisherServiceFactory))],r);0&&(module.exports={DefaultDeviceSessionService});
1
+ "use strict";var n=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var f=(o,e)=>{for(var s in e)n(o,s,{get:e[s],enumerable:!0})},_=(o,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of D(e))!b.call(o,r)&&r!==s&&n(o,r,{get:()=>e[r],enumerable:!(i=S(e,r))||i.enumerable});return o};var p=o=>_(n({},"__esModule",{value:!0}),o),a=(o,e,s,i)=>{for(var r=i>1?void 0:i?S(e,s):e,v=o.length-1,h;v>=0;v--)(h=o[v])&&(r=(i?h(e,s,r):h(r))||r);return i&&r&&n(e,s,r),r},l=(o,e)=>(s,i)=>e(s,i,o);var y={};f(y,{DefaultDeviceSessionService:()=>t});module.exports=p(y);var c=require("inversify"),d=require("purify-ts"),u=require("rxjs"),g=require("../../device-session/model/Errors"),m=require("../../logger-publisher/di/loggerTypes");let t=class{_sessions;_sessionsSubject;_logger;constructor(e){this._sessions=[],this._sessionsSubject=new u.ReplaySubject,this._logger=e("DeviceSessionService")}get sessionsObs(){return this._sessionsSubject.asObservable()}addDeviceSession(e){return this._sessions.find(i=>i.id===e.id)?(this._logger.warn("DeviceSession already exists",{data:{deviceSession:e}}),this):(this._sessions.push(e),this._sessionsSubject.next(e),this._logger.info("DeviceSession added",{data:{sessionId:e.id}}),this)}removeDeviceSession(e){const s=this._sessions.find(i=>i.id===e);return s?(s.close(),this._sessions=this._sessions.filter(i=>i.id!==e),this._logger.info("DeviceSession removed",{data:{sessionId:e}}),this):(this._logger.warn("DeviceSession not found",{data:{sessionId:e}}),this)}getDeviceSessionById(e){return d.Maybe.fromNullable(this._sessions.find(s=>s.id===e)).toEither(new g.DeviceSessionNotFound)}getDeviceSessionsByDeviceId(e){return d.Maybe.fromPredicate(({length:s})=>s>0,this._sessions.filter(s=>s.connectedDevice.id===e)).toEither(new g.DeviceSessionNotFound)}getDeviceSessions(){return this._sessions}};t=a([(0,c.injectable)(),l(0,(0,c.inject)(m.loggerTypes.LoggerPublisherServiceFactory))],t);0&&(module.exports={DefaultDeviceSessionService});
2
2
  //# sourceMappingURL=DefaultDeviceSessionService.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/service/DefaultDeviceSessionService.ts"],
4
- "sourcesContent": ["import { inject, injectable } from \"inversify\";\nimport { Maybe } from \"purify-ts\";\nimport { Observable, ReplaySubject } from \"rxjs\";\n\nimport { LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { DeviceSession } from \"@internal/device-session/model/DeviceSession\";\nimport { DeviceSessionNotFound } from \"@internal/device-session/model/Errors\";\nimport { DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { loggerTypes } from \"@internal/logger-publisher/di/loggerTypes\";\n\n@injectable()\nexport class DefaultDeviceSessionService implements DeviceSessionService {\n private _sessions: DeviceSession[];\n private readonly _logger: LoggerPublisherService;\n private _sessionsSubject: ReplaySubject<DeviceSession>;\n\n constructor(\n @inject(loggerTypes.LoggerPublisherServiceFactory)\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n ) {\n this._sessions = [];\n this._sessionsSubject = new ReplaySubject();\n this._logger = loggerModuleFactory(\"DeviceSessionService\");\n }\n\n public get sessionsObs(): Observable<DeviceSession> {\n return this._sessionsSubject.asObservable();\n }\n\n addDeviceSession(deviceSession: DeviceSession) {\n const found = this._sessions.find((s) => s.id === deviceSession.id);\n if (found) {\n this._logger.warn(\"DeviceSession already exists\", {\n data: { deviceSession },\n });\n return this;\n }\n\n this._sessions.push(deviceSession);\n this._sessionsSubject.next(deviceSession);\n this._logger.info(\"DeviceSession added\", { data: { deviceSession } });\n return this;\n }\n\n removeDeviceSession(sessionId: string) {\n const found = this._sessions.find((s) => s.id === sessionId);\n if (found) {\n found.close();\n this._sessions = this._sessions.filter((s) => s.id !== sessionId);\n this._logger.info(\"DeviceSession removed\", { data: { sessionId } });\n return this;\n }\n\n this._logger.warn(\"DeviceSession not found\", { data: { sessionId } });\n return this;\n }\n\n getDeviceSessionById(sessionId: string) {\n const deviceSession = Maybe.fromNullable(\n this._sessions.find((s) => s.id === sessionId),\n );\n\n return deviceSession.toEither(new DeviceSessionNotFound());\n }\n\n getDeviceSessionByDeviceId(deviceId: string) {\n const deviceSession = Maybe.fromNullable(\n this._sessions.find((s) => s.connectedDevice.id === deviceId),\n );\n\n return deviceSession.toEither(new DeviceSessionNotFound());\n }\n\n getDeviceSessions() {\n return this._sessions;\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBACnCC,EAAsB,qBACtBC,EAA0C,gBAI1CC,EAAsC,iDAEtCC,EAA4B,qDAGrB,IAAMC,EAAN,KAAkE,CAC/D,UACS,QACT,iBAER,YAEEC,EACA,CACA,KAAK,UAAY,CAAC,EAClB,KAAK,iBAAmB,IAAI,gBAC5B,KAAK,QAAUA,EAAoB,sBAAsB,CAC3D,CAEA,IAAW,aAAyC,CAClD,OAAO,KAAK,iBAAiB,aAAa,CAC5C,CAEA,iBAAiBC,EAA8B,CAE7C,OADc,KAAK,UAAU,KAAM,GAAM,EAAE,KAAOA,EAAc,EAAE,GAEhE,KAAK,QAAQ,KAAK,+BAAgC,CAChD,KAAM,CAAE,cAAAA,CAAc,CACxB,CAAC,EACM,OAGT,KAAK,UAAU,KAAKA,CAAa,EACjC,KAAK,iBAAiB,KAAKA,CAAa,EACxC,KAAK,QAAQ,KAAK,sBAAuB,CAAE,KAAM,CAAE,cAAAA,CAAc,CAAE,CAAC,EAC7D,KACT,CAEA,oBAAoBC,EAAmB,CACrC,MAAMC,EAAQ,KAAK,UAAU,KAAM,GAAM,EAAE,KAAOD,CAAS,EAC3D,OAAIC,GACFA,EAAM,MAAM,EACZ,KAAK,UAAY,KAAK,UAAU,OAAQ,GAAM,EAAE,KAAOD,CAAS,EAChE,KAAK,QAAQ,KAAK,wBAAyB,CAAE,KAAM,CAAE,UAAAA,CAAU,CAAE,CAAC,EAC3D,OAGT,KAAK,QAAQ,KAAK,0BAA2B,CAAE,KAAM,CAAE,UAAAA,CAAU,CAAE,CAAC,EAC7D,KACT,CAEA,qBAAqBA,EAAmB,CAKtC,OAJsB,QAAM,aAC1B,KAAK,UAAU,KAAM,GAAM,EAAE,KAAOA,CAAS,CAC/C,EAEqB,SAAS,IAAI,uBAAuB,CAC3D,CAEA,2BAA2BE,EAAkB,CAK3C,OAJsB,QAAM,aAC1B,KAAK,UAAU,KAAM,GAAM,EAAE,gBAAgB,KAAOA,CAAQ,CAC9D,EAEqB,SAAS,IAAI,uBAAuB,CAC3D,CAEA,mBAAoB,CAClB,OAAO,KAAK,SACd,CACF,EAjEaL,EAANM,EAAA,IADN,cAAW,EAOPC,EAAA,eAAO,cAAY,6BAA6B,IANxCP",
6
- "names": ["DefaultDeviceSessionService_exports", "__export", "DefaultDeviceSessionService", "__toCommonJS", "import_inversify", "import_purify_ts", "import_rxjs", "import_Errors", "import_loggerTypes", "DefaultDeviceSessionService", "loggerModuleFactory", "deviceSession", "sessionId", "found", "deviceId", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\nimport { Either, Maybe } from \"purify-ts\";\nimport { Observable, ReplaySubject } from \"rxjs\";\n\nimport { LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { DeviceId } from \"@api/types\";\nimport { DeviceSession } from \"@internal/device-session/model/DeviceSession\";\nimport { DeviceSessionNotFound } from \"@internal/device-session/model/Errors\";\nimport { DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { loggerTypes } from \"@internal/logger-publisher/di/loggerTypes\";\n\n@injectable()\nexport class DefaultDeviceSessionService implements DeviceSessionService {\n private _sessions: DeviceSession[];\n private readonly _sessionsSubject: ReplaySubject<DeviceSession>;\n private readonly _logger: LoggerPublisherService;\n\n constructor(\n @inject(loggerTypes.LoggerPublisherServiceFactory)\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n ) {\n this._sessions = [];\n this._sessionsSubject = new ReplaySubject();\n this._logger = loggerModuleFactory(\"DeviceSessionService\");\n }\n\n public get sessionsObs(): Observable<DeviceSession> {\n return this._sessionsSubject.asObservable();\n }\n\n addDeviceSession(deviceSession: DeviceSession): DeviceSessionService {\n const found = this._sessions.find((s) => s.id === deviceSession.id);\n if (found) {\n this._logger.warn(\"DeviceSession already exists\", {\n data: { deviceSession },\n });\n return this;\n }\n this._sessions.push(deviceSession);\n this._sessionsSubject.next(deviceSession);\n this._logger.info(\"DeviceSession added\", {\n data: { sessionId: deviceSession.id },\n });\n return this;\n }\n\n removeDeviceSession(sessionId: string): DeviceSessionService {\n const found = this._sessions.find((s) => s.id === sessionId);\n if (found) {\n found.close();\n this._sessions = this._sessions.filter((s) => s.id !== sessionId);\n this._logger.info(\"DeviceSession removed\", { data: { sessionId } });\n return this;\n }\n this._logger.warn(\"DeviceSession not found\", { data: { sessionId } });\n return this;\n }\n\n getDeviceSessionById(\n sessionId: string,\n ): Either<DeviceSessionNotFound, DeviceSession> {\n return Maybe.fromNullable(\n this._sessions.find((s) => s.id === sessionId),\n ).toEither(new DeviceSessionNotFound());\n }\n\n getDeviceSessionsByDeviceId(\n deviceId: DeviceId,\n ): Either<DeviceSessionNotFound, DeviceSession[]> {\n return Maybe.fromPredicate(\n ({ length }) => length > 0,\n this._sessions.filter((s) => s.connectedDevice.id === deviceId),\n ).toEither(new DeviceSessionNotFound());\n }\n\n getDeviceSessions(): DeviceSession[] {\n return this._sessions;\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBACnCC,EAA8B,qBAC9BC,EAA0C,gBAK1CC,EAAsC,iDAEtCC,EAA4B,qDAGrB,IAAMC,EAAN,KAAkE,CAC/D,UACS,iBACA,QAEjB,YAEEC,EACA,CACA,KAAK,UAAY,CAAC,EAClB,KAAK,iBAAmB,IAAI,gBAC5B,KAAK,QAAUA,EAAoB,sBAAsB,CAC3D,CAEA,IAAW,aAAyC,CAClD,OAAO,KAAK,iBAAiB,aAAa,CAC5C,CAEA,iBAAiBC,EAAoD,CAEnE,OADc,KAAK,UAAU,KAAMC,GAAMA,EAAE,KAAOD,EAAc,EAAE,GAEhE,KAAK,QAAQ,KAAK,+BAAgC,CAChD,KAAM,CAAE,cAAAA,CAAc,CACxB,CAAC,EACM,OAET,KAAK,UAAU,KAAKA,CAAa,EACjC,KAAK,iBAAiB,KAAKA,CAAa,EACxC,KAAK,QAAQ,KAAK,sBAAuB,CACvC,KAAM,CAAE,UAAWA,EAAc,EAAG,CACtC,CAAC,EACM,KACT,CAEA,oBAAoBE,EAAyC,CAC3D,MAAMC,EAAQ,KAAK,UAAU,KAAMF,GAAMA,EAAE,KAAOC,CAAS,EAC3D,OAAIC,GACFA,EAAM,MAAM,EACZ,KAAK,UAAY,KAAK,UAAU,OAAQF,GAAMA,EAAE,KAAOC,CAAS,EAChE,KAAK,QAAQ,KAAK,wBAAyB,CAAE,KAAM,CAAE,UAAAA,CAAU,CAAE,CAAC,EAC3D,OAET,KAAK,QAAQ,KAAK,0BAA2B,CAAE,KAAM,CAAE,UAAAA,CAAU,CAAE,CAAC,EAC7D,KACT,CAEA,qBACEA,EAC8C,CAC9C,OAAO,QAAM,aACX,KAAK,UAAU,KAAM,GAAM,EAAE,KAAOA,CAAS,CAC/C,EAAE,SAAS,IAAI,uBAAuB,CACxC,CAEA,4BACEE,EACgD,CAChD,OAAO,QAAM,cACX,CAAC,CAAE,OAAAC,CAAO,IAAMA,EAAS,EACzB,KAAK,UAAU,OAAQ,GAAM,EAAE,gBAAgB,KAAOD,CAAQ,CAChE,EAAE,SAAS,IAAI,uBAAuB,CACxC,CAEA,mBAAqC,CACnC,OAAO,KAAK,SACd,CACF,EAlEaN,EAANQ,EAAA,IADN,cAAW,EAOPC,EAAA,eAAO,cAAY,6BAA6B,IANxCT",
6
+ "names": ["DefaultDeviceSessionService_exports", "__export", "DefaultDeviceSessionService", "__toCommonJS", "import_inversify", "import_purify_ts", "import_rxjs", "import_Errors", "import_loggerTypes", "DefaultDeviceSessionService", "loggerModuleFactory", "deviceSession", "s", "sessionId", "found", "deviceId", "length", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var r=require("purify-ts"),m=require("rxjs"),l=require("../../device-session/data/DeviceSessionRefresherConst"),v=require("../../device-session/model/DeviceSession.stub"),p=require("../../device-session/model/Errors"),D=require("../../logger-publisher/service/DefaultLoggerPublisherService"),f=require("../../manager-api/data/AxiosManagerApiDataSource"),g=require("../../manager-api/service/DefaultManagerApiService"),h=require("../../secure-channel/data/DefaultSecureChannelDataSource"),b=require("../../secure-channel/service/DefaultSecureChannelService"),E=require("./DefaultDeviceSessionService");vi.mock("@internal/logger-publisher/service/DefaultLoggerPublisherService");vi.mock("@internal/manager-api/data/AxiosManagerApiDataSource");let e,t,i,u,c,d,S;describe("DefaultDeviceSessionService",()=>{beforeEach(()=>{vi.restoreAllMocks(),t=new D.DefaultLoggerPublisherService([],"deviceSession"),e=new E.DefaultDeviceSessionService(()=>t),u=new f.AxiosManagerApiDataSource({}),c=new g.DefaultManagerApiService(u),d=new h.DefaultSecureChannelDataSource({}),S=new b.DefaultSecureChannelService(d),i=(0,v.deviceSessionStubBuilder)({},()=>t,c,S,l.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS)}),afterEach(()=>{i.close()}),it("should have an empty sessions list",()=>{expect(e.getDeviceSessions()).toEqual([])}),it("should add a deviceSession",()=>{e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])}),it("should not add a deviceSession if it already exists",()=>{e.addDeviceSession(i),e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])}),it("should remove a deviceSession",()=>{e.addDeviceSession(i),e.removeDeviceSession(i.id),expect(e.getDeviceSessions()).toEqual([])}),it("should not remove a deviceSession if it does not exist",()=>{e.removeDeviceSession(i.id),expect(e.getDeviceSessions()).toEqual([])}),it("should get a deviceSession",()=>{e.addDeviceSession(i),expect(e.getDeviceSessionById(i.id)).toEqual(r.Either.of(i))}),it("should not get a deviceSession if it does not exist",()=>{expect(e.getDeviceSessionById(i.id)).toEqual((0,r.Left)(new p.DeviceSessionNotFound))}),it("should get all sessions",()=>{e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])}),it("should retrieve sessionObs",()=>{expect(e.sessionsObs).toBeInstanceOf(m.Observable)}),it("should emit new session",()=>new Promise((s,o)=>{const n=e.sessionsObs.subscribe({next(a){try{expect(a).toStrictEqual(i),n.unsubscribe(),s()}catch(x){o(x)}}});e.addDeviceSession(i)})),it("should emit previous added session",()=>{const s=(0,v.deviceSessionStubBuilder)({id:"last-session"},()=>t,c,S,l.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS),o=[];e.addDeviceSession(i),e.addDeviceSession(s);const n=e.sessionsObs.subscribe({next(a){o.push(a)}});s.close(),expect(o).toEqual([i,s]),n.unsubscribe()})});
1
+ "use strict";var s=require("purify-ts"),f=require("rxjs"),u=require("../../../api/transport/model/TransportConnectedDevice.stub"),r=require("../../device-session/data/DeviceSessionRefresherConst"),a=require("../../device-session/model/DeviceSession.stub"),p=require("../../device-session/model/Errors"),h=require("../../logger-publisher/service/DefaultLoggerPublisherService"),b=require("../../manager-api/data/AxiosManagerApiDataSource"),x=require("../../manager-api/service/DefaultManagerApiService"),E=require("../../secure-channel/data/DefaultSecureChannelDataSource"),y=require("../../secure-channel/service/DefaultSecureChannelService"),I=require("./DefaultDeviceSessionService");vi.mock("@internal/logger-publisher/service/DefaultLoggerPublisherService");vi.mock("@internal/manager-api/data/AxiosManagerApiDataSource");let e,o,i,d,S,m,c,g,n;describe("DefaultDeviceSessionService",()=>{o=new h.DefaultLoggerPublisherService([],"deviceSession"),m=new b.AxiosManagerApiDataSource({}),c=new x.DefaultManagerApiService(m),g=new E.DefaultSecureChannelDataSource({}),n=new y.DefaultSecureChannelService(g),beforeEach(()=>{vi.restoreAllMocks(),e=new I.DefaultDeviceSessionService(()=>o),i=(0,a.deviceSessionStubBuilder)({},()=>o,c,n,r.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS)}),afterEach(()=>{i.close()}),it("should have an empty DeviceSession list",()=>{expect(e.getDeviceSessions()).toEqual([])}),describe("DeviceSessionService addDeviceSession",()=>{it("should add a DeviceSession if it does not already exist",()=>{e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])}),it("should not add a DeviceSession if it already exists",()=>{e.addDeviceSession(i),e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])})}),describe("DeviceSessionService removeDeviceSession",()=>{it("should remove the DeviceSession of given ID",()=>{e.addDeviceSession(i),e.removeDeviceSession(i.id),expect(e.getDeviceSessions()).toEqual([])}),it("should not remove the DeviceSession of given ID if it does not exist",()=>{e.addDeviceSession(i),e.removeDeviceSession("non-existent-id"),expect(e.getDeviceSessions()).toEqual([i])})}),describe("DeviceSessionService getDeviceSessionById",()=>{it("should get the DeviceSession of given ID if it exists",()=>{e.addDeviceSession(i),expect(e.getDeviceSessionById(i.id)).toEqual(s.Either.of(i))}),it("should not get the DeviceSession if it does not exist",()=>{e.addDeviceSession(i),expect(e.getDeviceSessionById("non-existent-id")).toEqual((0,s.Left)(new p.DeviceSessionNotFound))})}),describe("DeviceSessionService getDeviceSessionsByDeviceId",()=>{it("should not get device sessions by deviceId if none exist",()=>{e.addDeviceSession(i),expect(e.getDeviceSessionsByDeviceId("non-existent-device-id")).toEqual((0,s.Left)(new p.DeviceSessionNotFound))}),it("should get a single device session by deviceId",()=>{e.addDeviceSession(i),expect(e.getDeviceSessionsByDeviceId(i.connectedDevice.id)).toEqual(s.Either.of([i]))}),it("should get device sessions by deviceId",()=>{e.addDeviceSession(i),d=(0,a.deviceSessionStubBuilder)({connectedDevice:(0,u.connectedDeviceStubBuilder)({id:"device-1"}),id:"session-1"},()=>o,c,n,r.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS),S=(0,a.deviceSessionStubBuilder)({connectedDevice:(0,u.connectedDeviceStubBuilder)({id:"device-1"}),id:"session-2"},()=>o,c,n,r.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS),e.addDeviceSession(d),e.addDeviceSession(S),expect(e.getDeviceSessionsByDeviceId("device-1")).toEqual(s.Either.of([d,S])),d.close(),S.close()})}),it("should get all sessions",()=>{e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])}),it("should retrieve sessionObs",()=>{expect(e.sessionsObs).toBeInstanceOf(f.Observable)}),it("should emit new session",()=>new Promise((t,v)=>{const D=e.sessionsObs.subscribe({next(l){try{expect(l).toStrictEqual(i),D.unsubscribe(),t()}catch(A){v(A)}}});e.addDeviceSession(i)})),it("should emit previous added session",()=>{const t=(0,a.deviceSessionStubBuilder)({id:"last-session"},()=>o,c,n,r.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS),v=[];e.addDeviceSession(i),e.addDeviceSession(t);const D=e.sessionsObs.subscribe({next(l){v.push(l)}});t.close(),expect(v).toEqual([i,t]),D.unsubscribe()})});
2
2
  //# sourceMappingURL=DefaultDeviceSessionService.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/service/DefaultDeviceSessionService.test.ts"],
4
- "sourcesContent": ["import { Either, Left } from \"purify-ts\";\nimport { Observable } from \"rxjs\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { type DeviceSession } from \"@internal/device-session/model/DeviceSession\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DeviceSessionNotFound } from \"@internal/device-session/model/Errors\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport { AxiosManagerApiDataSource } from \"@internal/manager-api/data/AxiosManagerApiDataSource\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport type { ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { type SecureChannelDataSource } from \"@internal/secure-channel/data/SecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { DefaultDeviceSessionService } from \"./DefaultDeviceSessionService\";\n\nvi.mock(\"@internal/logger-publisher/service/DefaultLoggerPublisherService\");\nvi.mock(\"@internal/manager-api/data/AxiosManagerApiDataSource\");\n\nlet sessionService: DefaultDeviceSessionService;\nlet loggerService: DefaultLoggerPublisherService;\nlet deviceSession: DeviceSession;\nlet managerApiDataSource: ManagerApiDataSource;\nlet managerApi: ManagerApiService;\nlet secureChannelDataSource: SecureChannelDataSource;\nlet secureChannel: SecureChannelService;\n\ndescribe(\"DefaultDeviceSessionService\", () => {\n beforeEach(() => {\n vi.restoreAllMocks();\n loggerService = new DefaultLoggerPublisherService([], \"deviceSession\");\n sessionService = new DefaultDeviceSessionService(() => loggerService);\n managerApiDataSource = new AxiosManagerApiDataSource({} as DmkConfig);\n managerApi = new DefaultManagerApiService(managerApiDataSource);\n secureChannelDataSource = new DefaultSecureChannelDataSource(\n {} as DmkConfig,\n );\n secureChannel = new DefaultSecureChannelService(secureChannelDataSource);\n\n deviceSession = deviceSessionStubBuilder(\n {},\n () => loggerService,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n });\n\n afterEach(() => {\n deviceSession.close();\n });\n\n it(\"should have an empty sessions list\", () => {\n expect(sessionService.getDeviceSessions()).toEqual([]);\n });\n\n it(\"should add a deviceSession\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessions()).toEqual([deviceSession]);\n });\n\n it(\"should not add a deviceSession if it already exists\", () => {\n sessionService.addDeviceSession(deviceSession);\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessions()).toEqual([deviceSession]);\n });\n\n it(\"should remove a deviceSession\", () => {\n sessionService.addDeviceSession(deviceSession);\n sessionService.removeDeviceSession(deviceSession.id);\n expect(sessionService.getDeviceSessions()).toEqual([]);\n });\n\n it(\"should not remove a deviceSession if it does not exist\", () => {\n sessionService.removeDeviceSession(deviceSession.id);\n expect(sessionService.getDeviceSessions()).toEqual([]);\n });\n\n it(\"should get a deviceSession\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessionById(deviceSession.id)).toEqual(\n Either.of(deviceSession),\n );\n });\n\n it(\"should not get a deviceSession if it does not exist\", () => {\n expect(sessionService.getDeviceSessionById(deviceSession.id)).toEqual(\n Left(new DeviceSessionNotFound()),\n );\n });\n\n it(\"should get all sessions\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessions()).toEqual([deviceSession]);\n });\n\n it(\"should retrieve sessionObs\", () => {\n expect(sessionService.sessionsObs).toBeInstanceOf(\n Observable<DeviceSession>,\n );\n });\n\n it(\"should emit new session\", () =>\n new Promise<void>((resolve, reject) => {\n const subscription = sessionService.sessionsObs.subscribe({\n next(emittedDeviceSession) {\n try {\n expect(emittedDeviceSession).toStrictEqual(deviceSession);\n subscription.unsubscribe();\n resolve();\n } catch (error) {\n reject(error);\n }\n },\n });\n sessionService.addDeviceSession(deviceSession);\n }));\n\n it(\"should emit previous added session\", () => {\n const lastDeviceSession = deviceSessionStubBuilder(\n { id: \"last-session\" },\n () => loggerService,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n const emittedSessions: DeviceSession[] = [];\n sessionService.addDeviceSession(deviceSession);\n sessionService.addDeviceSession(lastDeviceSession);\n\n const subscription = sessionService.sessionsObs.subscribe({\n next(emittedDeviceSession) {\n emittedSessions.push(emittedDeviceSession);\n },\n });\n lastDeviceSession.close();\n expect(emittedSessions).toEqual([deviceSession, lastDeviceSession]);\n subscription.unsubscribe();\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA6B,qBAC7BC,EAA2B,gBAG3BC,EAAyD,qEAEzDC,EAAyC,6DACzCC,EAAsC,iDACtCC,EAA8C,4EAC9CC,EAA0C,gEAE1CC,EAAyC,kEAEzCC,EAA+C,wEAE/CC,EAA4C,wEAG5CC,EAA4C,yCAE5C,GAAG,KAAK,kEAAkE,EAC1E,GAAG,KAAK,sDAAsD,EAE9D,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEJ,SAAS,8BAA+B,IAAM,CAC5C,WAAW,IAAM,CACf,GAAG,gBAAgB,EACnBL,EAAgB,IAAI,gCAA8B,CAAC,EAAG,eAAe,EACrED,EAAiB,IAAI,8BAA4B,IAAMC,CAAa,EACpEE,EAAuB,IAAI,4BAA0B,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,CAClCF,EAAe,iBAAiBE,CAAa,EAC7C,OAAOF,EAAe,kBAAkB,CAAC,EAAE,QAAQ,CAACE,CAAa,CAAC,CACpE,CAAC,EAED,GAAG,6BAA8B,IAAM,CACrC,OAAOF,EAAe,WAAW,EAAE,eACjC,YACF,CACF,CAAC,EAED,GAAG,0BAA2B,IAC5B,IAAI,QAAc,CAACO,EAASC,IAAW,CACrC,MAAMC,EAAeT,EAAe,YAAY,UAAU,CACxD,KAAKU,EAAsB,CACzB,GAAI,CACF,OAAOA,CAAoB,EAAE,cAAcR,CAAa,EACxDO,EAAa,YAAY,EACzBF,EAAQ,CACV,OAASI,EAAO,CACdH,EAAOG,CAAK,CACd,CACF,CACF,CAAC,EACDX,EAAe,iBAAiBE,CAAa,CAC/C,CAAC,CAAC,EAEJ,GAAG,qCAAsC,IAAM,CAC7C,MAAMU,KAAoB,4BACxB,CAAE,GAAI,cAAe,EACrB,IAAMX,EACNG,EACAE,EACA,0CACF,EACMO,EAAmC,CAAC,EAC1Cb,EAAe,iBAAiBE,CAAa,EAC7CF,EAAe,iBAAiBY,CAAiB,EAEjD,MAAMH,EAAeT,EAAe,YAAY,UAAU,CACxD,KAAKU,EAAsB,CACzBG,EAAgB,KAAKH,CAAoB,CAC3C,CACF,CAAC,EACDE,EAAkB,MAAM,EACxB,OAAOC,CAAe,EAAE,QAAQ,CAACX,EAAeU,CAAiB,CAAC,EAClEH,EAAa,YAAY,CAC3B,CAAC,CACH,CAAC",
6
- "names": ["import_purify_ts", "import_rxjs", "import_DeviceSessionRefresherConst", "import_DeviceSession", "import_Errors", "import_DefaultLoggerPublisherService", "import_AxiosManagerApiDataSource", "import_DefaultManagerApiService", "import_DefaultSecureChannelDataSource", "import_DefaultSecureChannelService", "import_DefaultDeviceSessionService", "sessionService", "loggerService", "deviceSession", "managerApiDataSource", "managerApi", "secureChannelDataSource", "secureChannel", "resolve", "reject", "subscription", "emittedDeviceSession", "error", "lastDeviceSession", "emittedSessions"]
4
+ "sourcesContent": ["import { Either, Left } from \"purify-ts\";\nimport { Observable } from \"rxjs\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { type DeviceSession } from \"@internal/device-session/model/DeviceSession\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DeviceSessionNotFound } from \"@internal/device-session/model/Errors\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport { AxiosManagerApiDataSource } from \"@internal/manager-api/data/AxiosManagerApiDataSource\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport type { ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { type SecureChannelDataSource } from \"@internal/secure-channel/data/SecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { DefaultDeviceSessionService } from \"./DefaultDeviceSessionService\";\n\nvi.mock(\"@internal/logger-publisher/service/DefaultLoggerPublisherService\");\nvi.mock(\"@internal/manager-api/data/AxiosManagerApiDataSource\");\n\nlet sessionService: DefaultDeviceSessionService;\nlet loggerService: DefaultLoggerPublisherService;\nlet deviceSession: DeviceSession;\nlet deviceSession1: DeviceSession;\nlet deviceSession2: DeviceSession;\nlet managerApiDataSource: ManagerApiDataSource;\nlet managerApi: ManagerApiService;\nlet secureChannelDataSource: SecureChannelDataSource;\nlet secureChannel: SecureChannelService;\n\ndescribe(\"DefaultDeviceSessionService\", () => {\n // Initialize shared resources\n loggerService = new DefaultLoggerPublisherService([], \"deviceSession\");\n managerApiDataSource = new AxiosManagerApiDataSource({} as DmkConfig);\n managerApi = new DefaultManagerApiService(managerApiDataSource);\n secureChannelDataSource = new DefaultSecureChannelDataSource({} as DmkConfig);\n secureChannel = new DefaultSecureChannelService(secureChannelDataSource);\n\n beforeEach(() => {\n vi.restoreAllMocks();\n // Create a new instance before each test\n sessionService = new DefaultDeviceSessionService(() => loggerService);\n // Create a device session stub with default properties\n deviceSession = deviceSessionStubBuilder(\n {},\n () => loggerService,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n });\n\n afterEach(() => {\n deviceSession.close();\n });\n\n it(\"should have an empty DeviceSession list\", () => {\n expect(sessionService.getDeviceSessions()).toEqual([]);\n });\n\n describe(\"DeviceSessionService addDeviceSession\", () => {\n it(\"should add a DeviceSession if it does not already exist\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessions()).toEqual([deviceSession]);\n });\n it(\"should not add a DeviceSession if it already exists\", () => {\n sessionService.addDeviceSession(deviceSession);\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessions()).toEqual([deviceSession]);\n });\n });\n\n describe(\"DeviceSessionService removeDeviceSession\", () => {\n it(\"should remove the DeviceSession of given ID\", () => {\n sessionService.addDeviceSession(deviceSession);\n sessionService.removeDeviceSession(deviceSession.id);\n expect(sessionService.getDeviceSessions()).toEqual([]);\n });\n it(\"should not remove the DeviceSession of given ID if it does not exist\", () => {\n sessionService.addDeviceSession(deviceSession);\n sessionService.removeDeviceSession(\"non-existent-id\");\n expect(sessionService.getDeviceSessions()).toEqual([deviceSession]);\n });\n });\n\n describe(\"DeviceSessionService getDeviceSessionById\", () => {\n it(\"should get the DeviceSession of given ID if it exists\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessionById(deviceSession.id)).toEqual(\n Either.of(deviceSession),\n );\n });\n it(\"should not get the DeviceSession if it does not exist\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessionById(\"non-existent-id\")).toEqual(\n Left(new DeviceSessionNotFound()),\n );\n });\n });\n\n describe(\"DeviceSessionService getDeviceSessionsByDeviceId\", () => {\n it(\"should not get device sessions by deviceId if none exist\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(\n sessionService.getDeviceSessionsByDeviceId(\"non-existent-device-id\"),\n ).toEqual(Left(new DeviceSessionNotFound()));\n });\n it(\"should get a single device session by deviceId\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(\n sessionService.getDeviceSessionsByDeviceId(\n deviceSession.connectedDevice.id,\n ),\n ).toEqual(Either.of([deviceSession]));\n });\n it(\"should get device sessions by deviceId\", () => {\n sessionService.addDeviceSession(deviceSession);\n deviceSession1 = deviceSessionStubBuilder(\n {\n connectedDevice: connectedDeviceStubBuilder({ id: \"device-1\" }),\n id: \"session-1\",\n },\n () => loggerService,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n\n deviceSession2 = deviceSessionStubBuilder(\n {\n connectedDevice: connectedDeviceStubBuilder({ id: \"device-1\" }),\n id: \"session-2\",\n },\n () => loggerService,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n sessionService.addDeviceSession(deviceSession1);\n sessionService.addDeviceSession(deviceSession2);\n expect(sessionService.getDeviceSessionsByDeviceId(\"device-1\")).toEqual(\n Either.of([deviceSession1, deviceSession2]),\n );\n deviceSession1.close();\n deviceSession2.close();\n });\n });\n\n it(\"should get all sessions\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessions()).toEqual([deviceSession]);\n });\n\n it(\"should retrieve sessionObs\", () => {\n expect(sessionService.sessionsObs).toBeInstanceOf(\n Observable<DeviceSession>,\n );\n });\n\n it(\"should emit new session\", () =>\n new Promise<void>((resolve, reject) => {\n const subscription = sessionService.sessionsObs.subscribe({\n next(emittedDeviceSession) {\n try {\n expect(emittedDeviceSession).toStrictEqual(deviceSession);\n subscription.unsubscribe();\n resolve();\n } catch (error) {\n reject(error);\n }\n },\n });\n sessionService.addDeviceSession(deviceSession);\n }));\n\n it(\"should emit previous added session\", () => {\n const lastDeviceSession = deviceSessionStubBuilder(\n { id: \"last-session\" },\n () => loggerService,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n const emittedSessions: DeviceSession[] = [];\n sessionService.addDeviceSession(deviceSession);\n sessionService.addDeviceSession(lastDeviceSession);\n\n const subscription = sessionService.sessionsObs.subscribe({\n next(emittedDeviceSession) {\n emittedSessions.push(emittedDeviceSession);\n },\n });\n lastDeviceSession.close();\n expect(emittedSessions).toEqual([deviceSession, lastDeviceSession]);\n subscription.unsubscribe();\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA6B,qBAC7BC,EAA2B,gBAG3BC,EAA2C,8DAC3CC,EAAyD,qEAEzDC,EAAyC,6DACzCC,EAAsC,iDACtCC,EAA8C,4EAC9CC,EAA0C,gEAE1CC,EAAyC,kEAEzCC,EAA+C,wEAE/CC,EAA4C,wEAG5CC,EAA4C,yCAE5C,GAAG,KAAK,kEAAkE,EAC1E,GAAG,KAAK,sDAAsD,EAE9D,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEJ,SAAS,8BAA+B,IAAM,CAE5CP,EAAgB,IAAI,gCAA8B,CAAC,EAAG,eAAe,EACrEI,EAAuB,IAAI,4BAA0B,CAAC,CAAc,EACpEC,EAAa,IAAI,2BAAyBD,CAAoB,EAC9DE,EAA0B,IAAI,iCAA+B,CAAC,CAAc,EAC5EC,EAAgB,IAAI,8BAA4BD,CAAuB,EAEvE,WAAW,IAAM,CACf,GAAG,gBAAgB,EAEnBP,EAAiB,IAAI,8BAA4B,IAAMC,CAAa,EAEpEC,KAAgB,4BACd,CAAC,EACD,IAAMD,EACNK,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,EAAQ,CACV,OAASI,EAAO,CACdH,EAAOG,CAAK,CACd,CACF,CACF,CAAC,EACDb,EAAe,iBAAiBE,CAAa,CAC/C,CAAC,CAAC,EAEJ,GAAG,qCAAsC,IAAM,CAC7C,MAAMY,KAAoB,4BACxB,CAAE,GAAI,cAAe,EACrB,IAAMb,EACNK,EACAE,EACA,0CACF,EACMO,EAAmC,CAAC,EAC1Cf,EAAe,iBAAiBE,CAAa,EAC7CF,EAAe,iBAAiBc,CAAiB,EAEjD,MAAMH,EAAeX,EAAe,YAAY,UAAU,CACxD,KAAKY,EAAsB,CACzBG,EAAgB,KAAKH,CAAoB,CAC3C,CACF,CAAC,EACDE,EAAkB,MAAM,EACxB,OAAOC,CAAe,EAAE,QAAQ,CAACb,EAAeY,CAAiB,CAAC,EAClEH,EAAa,YAAY,CAC3B,CAAC,CACH,CAAC",
6
+ "names": ["import_purify_ts", "import_rxjs", "import_TransportConnectedDevice", "import_DeviceSessionRefresherConst", "import_DeviceSession", "import_Errors", "import_DefaultLoggerPublisherService", "import_AxiosManagerApiDataSource", "import_DefaultManagerApiService", "import_DefaultSecureChannelDataSource", "import_DefaultSecureChannelService", "import_DefaultDeviceSessionService", "sessionService", "loggerService", "deviceSession", "deviceSession1", "deviceSession2", "managerApiDataSource", "managerApi", "secureChannelDataSource", "secureChannel", "resolve", "reject", "subscription", "emittedDeviceSession", "error", "lastDeviceSession", "emittedSessions"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var t=Object.prototype.hasOwnProperty;var D=(i,e,v,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of c(e))!t.call(i,s)&&s!==v&&r(i,s,{get:()=>e[s],enumerable:!(o=n(e,s))||o.enumerable});return i};var S=i=>D(r({},"__esModule",{value:!0}),i);var m={};module.exports=S(m);
1
+ "use strict";var r=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var t=Object.prototype.hasOwnProperty;var D=(i,e,v,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of n(e))!t.call(i,s)&&s!==v&&r(i,s,{get:()=>e[s],enumerable:!(o=c(e,s))||o.enumerable});return i};var S=i=>D(r({},"__esModule",{value:!0}),i);var m={};module.exports=S(m);
2
2
  //# sourceMappingURL=DeviceSessionService.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/service/DeviceSessionService.ts"],
4
- "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport { type DmkError } from \"@api/Error\";\nimport { type DeviceSession } from \"@internal/device-session/model/DeviceSession\";\n\nexport interface DeviceSessionService {\n addDeviceSession(deviceSession: DeviceSession): DeviceSessionService;\n getDeviceSessionById(sessionId: string): Either<DmkError, DeviceSession>;\n getDeviceSessionByDeviceId(deviceId: string): Either<DmkError, DeviceSession>;\n removeDeviceSession(sessionId: string): DeviceSessionService;\n getDeviceSessions(): DeviceSession[];\n get sessionsObs(): Observable<DeviceSession>;\n}\n"],
4
+ "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { type Observable } from \"rxjs\";\n\nimport { type DmkError } from \"@api/Error\";\nimport { type DeviceId } from \"@api/types\";\nimport { type DeviceSession } from \"@internal/device-session/model/DeviceSession\";\n\nexport interface DeviceSessionService {\n /**\n * Add a device session.\n * @param deviceSession The device session to add.\n */\n addDeviceSession(deviceSession: DeviceSession): DeviceSessionService;\n\n /**\n * Get a device session by its ID.\n * @param sessionId The ID of the session to retrieve.\n * @returns The device session or an error if not found.\n */\n getDeviceSessionById(sessionId: string): Either<DmkError, DeviceSession>;\n\n /**\n * Get device sessions by device ID.\n * @param deviceId The ID of the device.\n * @returns The device sessions of the device or an error if not found.\n */\n getDeviceSessionsByDeviceId(\n deviceId: DeviceId,\n ): Either<DmkError, DeviceSession[]>;\n\n /**\n * Remove a device session by its ID.\n * @param sessionId The ID of the session to remove.\n */\n removeDeviceSession(sessionId: string): DeviceSessionService;\n\n /**\n * Get all device sessions.\n * @returns An array of device sessions.\n */\n getDeviceSessions(): DeviceSession[];\n\n /**\n * Get an observable of device sessions.\n * @returns An observable of device sessions.\n */\n get sessionsObs(): Observable<DeviceSession>;\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["DeviceSessionService_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
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});
1
+ "use strict";var C=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var A=(t,e)=>{for(var s in e)C(t,s,{get:e[s],enumerable:!0})},F=(t,e,s,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of g(e))!u.call(t,i)&&i!==s&&C(t,i,{get:()=>e[i],enumerable:!(c=T(e,i))||c.enumerable});return t};var G=t=>F(C({},"__esModule",{value:!0}),t);var P={};A(P,{discoveryModuleFactory:()=>M});module.exports=G(P);var r=require("inversify"),n=require("../../discovery/use-case/ConnectUseCase"),U=require("../../discovery/use-case/DisconnectUseCase"),m=require("../../discovery/use-case/GetConnectedDeviceUseCase"),v=require("../../discovery/use-case/ListConnectedDevicesUseCase"),D=require("../../discovery/use-case/ListenToAvailableDevicesUseCase"),p=require("../../discovery/use-case/ListenToConnectedDeviceUseCase"),f=require("../../discovery/use-case/ReconnectUseCase"),l=require("../../discovery/use-case/StartDiscoveringUseCase"),L=require("../../discovery/use-case/StopDiscoveringUseCase"),a=require("../../../../src/di.stub"),o=require("./discoveryTypes");const M=({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.ReconnectUseCase).to(f.ReconnectUseCase),e(o.discoveryTypes.StartDiscoveringUseCase).to(l.StartDiscoveringUseCase),e(o.discoveryTypes.StopDiscoveringUseCase).to(L.StopDiscoveringUseCase),e(o.discoveryTypes.GetConnectedDeviceUseCase).to(m.GetConnectedDeviceUseCase),e(o.discoveryTypes.ListenToAvailableDevicesUseCase).to(D.ListenToAvailableDevicesUseCase),e(o.discoveryTypes.ListenToConnectedDeviceUseCase).to(p.ListenToConnectedDeviceUseCase),e(o.discoveryTypes.ListConnectedDevicesUseCase).to(v.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, 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"]
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 { ReconnectUseCase } from \"@internal/discovery/use-case/ReconnectUseCase\";\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.ReconnectUseCase).to(ReconnectUseCase);\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,EAAiC,yDACjCC,EAAwC,gEACxCC,EAAuC,+DACvCC,EAA4B,6BAE5BC,EAA+B,4BAMxB,MAAMb,EAAyB,CAAC,CAAE,KAAAc,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,gBAAgB,EAAE,GAAG,kBAAgB,EACzDA,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_ReconnectUseCase", "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.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)})});
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/ReconnectUseCase"),C=require("../../discovery/use-case/StartDiscoveringUseCase"),d=require("../../discovery/use-case/StopDiscoveringUseCase"),U=require("../../logger-publisher/di/loggerModule"),v=require("../../manager-api/di/managerApiModule"),g=require("../../secure-channel/di/secureChannelModule"),u=require("../../transport/di/transportModule"),y=require("./discoveryModule"),o=require("./discoveryTypes");describe("discoveryModuleFactory",()=>{let e,t,s;beforeEach(()=>{t=(0,y.discoveryModuleFactory)({stub:!1}),e=new r.Container,s=new n.TransportMock,e.loadSync(t,(0,U.loggerModuleFactory)(),(0,c.deviceModelModuleFactory)({stub:!1}),(0,i.deviceSessionModuleFactory)(),(0,u.transportModuleFactory)({transports:[vi.fn().mockImplementation(()=>s)]}),(0,v.managerApiModuleFactory)({config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url"}}),(0,g.secureChannelModuleFactory)({config:{webSocketUrl:"http://fake-websocket.url"}}))}),it("should return the device module",()=>{expect(t).toBeDefined()}),it("should return none mocked use cases",()=>{const D=e.get(o.discoveryTypes.StartDiscoveringUseCase);expect(D).toBeInstanceOf(C.StartDiscoveringUseCase);const k=e.get(o.discoveryTypes.StopDiscoveringUseCase);expect(k).toBeInstanceOf(d.StopDiscoveringUseCase);const M=e.get(o.discoveryTypes.DisconnectUseCase);expect(M).toBeInstanceOf(m.DisconnectUseCase);const b=e.get(o.discoveryTypes.ConnectUseCase);expect(b).toBeInstanceOf(a.ConnectUseCase);const F=e.get(o.discoveryTypes.ListenToAvailableDevicesUseCase);expect(F).toBeInstanceOf(f.ListenToAvailableDevicesUseCase);const h=e.get(o.discoveryTypes.ListConnectedDevicesUseCase);expect(h).toBeInstanceOf(p.ListConnectedDevicesUseCase);const x=e.get(o.discoveryTypes.ReconnectUseCase);expect(x).toBeInstanceOf(l.ReconnectUseCase)})});
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.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
- "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"]
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 { ReconnectUseCase } from \"@internal/discovery/use-case/ReconnectUseCase\";\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 const reconnectUseCase = container.get(discoveryTypes.ReconnectUseCase);\n expect(reconnectUseCase).toBeInstanceOf(ReconnectUseCase);\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,EAAiC,yDACjCC,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,EACA,MAAMC,EAAmBT,EAAU,IAAI,iBAAe,gBAAgB,EACtE,OAAOS,CAAgB,EAAE,eAAe,kBAAgB,CAC1D,CAAC,CACH,CAAC",
6
+ "names": ["import_inversify", "import_TransportMock", "import_deviceModelModule", "import_deviceSessionModule", "import_ConnectUseCase", "import_DisconnectUseCase", "import_ListConnectedDevicesUseCase", "import_ListenToAvailableDevicesUseCase", "import_ReconnectUseCase", "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", "reconnectUseCase"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var r=(s,e)=>{for(var n in e)i(s,n,{get:e[n],enumerable:!0})},U=(s,e,n,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of C(e))!a.call(s,o)&&o!==n&&i(s,o,{get:()=>e[o],enumerable:!(c=t(e,o))||c.enumerable});return s};var v=s=>U(i({},"__esModule",{value:!0}),s);var l={};r(l,{discoveryTypes:()=>D});module.exports=v(l);const D={StartDiscoveringUseCase:Symbol.for("StartDiscoveringUseCase"),StopDiscoveringUseCase:Symbol.for("StopDiscoveringUseCase"),ConnectUseCase:Symbol.for("ConnectUseCase"),DisconnectUseCase:Symbol.for("DisconnectUseCase"),GetConnectedDeviceUseCase:Symbol.for("GetConnectedDeviceUseCase"),ListenToAvailableDevicesUseCase:Symbol.for("ListenToAvailableDevicesUseCase"),ListenToConnectedDeviceUseCase:Symbol.for("ListenToConnectedDeviceUseCase"),ListConnectedDevicesUseCase:Symbol.for("ListConnectedDevicesUseCase")};0&&(module.exports={discoveryTypes});
1
+ "use strict";var c=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var U=(s,e)=>{for(var n in e)c(s,n,{get:e[n],enumerable:!0})},r=(s,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of C(e))!a.call(s,o)&&o!==n&&c(s,o,{get:()=>e[o],enumerable:!(t=i(e,o))||t.enumerable});return s};var v=s=>r(c({},"__esModule",{value:!0}),s);var l={};U(l,{discoveryTypes:()=>D});module.exports=v(l);const D={StartDiscoveringUseCase:Symbol.for("StartDiscoveringUseCase"),StopDiscoveringUseCase:Symbol.for("StopDiscoveringUseCase"),ConnectUseCase:Symbol.for("ConnectUseCase"),DisconnectUseCase:Symbol.for("DisconnectUseCase"),GetConnectedDeviceUseCase:Symbol.for("GetConnectedDeviceUseCase"),ListenToAvailableDevicesUseCase:Symbol.for("ListenToAvailableDevicesUseCase"),ListenToConnectedDeviceUseCase:Symbol.for("ListenToConnectedDeviceUseCase"),ListConnectedDevicesUseCase:Symbol.for("ListConnectedDevicesUseCase"),ReconnectUseCase:Symbol.for("ReconnectUseCase")};0&&(module.exports={discoveryTypes});
2
2
  //# sourceMappingURL=discoveryTypes.js.map