@ledgerhq/device-management-kit 0.0.0-test-recursive-stack-20251002122259 → 0.0.0-test-attest-npmjs-1-20251120163531

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 (236) hide show
  1. package/lib/cjs/package.json +1 -1
  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/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  55. package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  56. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
  57. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js.map +2 -2
  58. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js +1 -1
  59. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +2 -2
  60. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  61. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +2 -2
  62. package/lib/cjs/src/api/index.js +1 -1
  63. package/lib/cjs/src/api/index.js.map +2 -2
  64. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.js +1 -1
  65. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.js.map +3 -3
  66. package/lib/cjs/src/api/transport/model/ConnectedDevice.js +1 -1
  67. package/lib/cjs/src/api/transport/model/ConnectedDevice.js.map +3 -3
  68. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.js +1 -1
  69. package/lib/cjs/src/api/transport/model/TransportConnectedDevice.js.map +3 -3
  70. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  71. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
  72. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.js +1 -1
  73. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.js.map +3 -3
  74. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
  75. package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
  76. package/lib/cjs/src/internal/device-session/service/DeviceSessionService.js +1 -1
  77. package/lib/cjs/src/internal/device-session/service/DeviceSessionService.js.map +1 -1
  78. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  79. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  80. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  81. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
  82. package/lib/cjs/src/internal/discovery/di/discoveryTypes.js +1 -1
  83. package/lib/cjs/src/internal/discovery/di/discoveryTypes.js.map +2 -2
  84. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  85. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  86. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  87. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  88. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.js +1 -1
  89. package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.js.map +3 -3
  90. package/lib/cjs/src/internal/discovery/use-case/ReconnectUseCase.js +2 -0
  91. package/lib/cjs/src/internal/discovery/use-case/ReconnectUseCase.js.map +7 -0
  92. package/lib/cjs/src/internal/discovery/use-case/ReconnectUseCase.test.js +2 -0
  93. package/lib/cjs/src/internal/discovery/use-case/ReconnectUseCase.test.js.map +7 -0
  94. package/lib/esm/package.json +1 -1
  95. package/lib/esm/src/api/DeviceManagementKit.js +1 -1
  96. package/lib/esm/src/api/DeviceManagementKit.js.map +2 -2
  97. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  98. package/lib/esm/src/api/DeviceManagementKit.test.js.map +2 -2
  99. package/lib/esm/src/api/command/Errors.js +1 -1
  100. package/lib/esm/src/api/command/Errors.js.map +3 -3
  101. package/lib/esm/src/api/command/model/CommandResult.js.map +2 -2
  102. package/lib/esm/src/api/command/os/CloseAppCommand.js +1 -1
  103. package/lib/esm/src/api/command/os/CloseAppCommand.js.map +2 -2
  104. package/lib/esm/src/api/command/os/CloseAppCommand.test.js +1 -1
  105. package/lib/esm/src/api/command/os/CloseAppCommand.test.js.map +2 -2
  106. package/lib/esm/src/api/command/os/GetAppAndVersionCommand.js +1 -1
  107. package/lib/esm/src/api/command/os/GetAppAndVersionCommand.js.map +2 -2
  108. package/lib/esm/src/api/command/os/GetAppAndVersionCommand.test.js +1 -1
  109. package/lib/esm/src/api/command/os/GetAppAndVersionCommand.test.js.map +2 -2
  110. package/lib/esm/src/api/command/os/GetBatteryStatusCommand.js +1 -1
  111. package/lib/esm/src/api/command/os/GetBatteryStatusCommand.js.map +2 -2
  112. package/lib/esm/src/api/command/os/GetBatteryStatusCommand.test.js +1 -1
  113. package/lib/esm/src/api/command/os/GetBatteryStatusCommand.test.js.map +3 -3
  114. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js +1 -1
  115. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js.map +2 -2
  116. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js +1 -1
  117. package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js.map +2 -2
  118. package/lib/esm/src/api/command/os/GetOsVersionCommand.js +1 -1
  119. package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +2 -2
  120. package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js +1 -1
  121. package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js.map +2 -2
  122. package/lib/esm/src/api/command/os/ListAppsCommand.js +1 -1
  123. package/lib/esm/src/api/command/os/ListAppsCommand.js.map +2 -2
  124. package/lib/esm/src/api/command/os/ListAppsCommand.test.js +1 -1
  125. package/lib/esm/src/api/command/os/ListAppsCommand.test.js.map +2 -2
  126. package/lib/esm/src/api/command/os/ListLanguagePackCommand.js +1 -1
  127. package/lib/esm/src/api/command/os/ListLanguagePackCommand.js.map +2 -2
  128. package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js +1 -1
  129. package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js.map +2 -2
  130. package/lib/esm/src/api/command/os/LoadCertificateCommand.js +1 -1
  131. package/lib/esm/src/api/command/os/LoadCertificateCommand.js.map +2 -2
  132. package/lib/esm/src/api/command/os/LoadCertificateCommand.test.js +1 -1
  133. package/lib/esm/src/api/command/os/LoadCertificateCommand.test.js.map +3 -3
  134. package/lib/esm/src/api/command/os/OpenAppCommand.js +1 -1
  135. package/lib/esm/src/api/command/os/OpenAppCommand.js.map +2 -2
  136. package/lib/esm/src/api/command/os/OpenAppCommand.test.js +1 -1
  137. package/lib/esm/src/api/command/os/OpenAppCommand.test.js.map +2 -2
  138. package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
  139. package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js.map +2 -2
  140. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
  141. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  142. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
  143. package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
  144. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
  145. package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
  146. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
  147. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js.map +3 -3
  148. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js +1 -1
  149. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +3 -3
  150. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  151. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +2 -2
  152. package/lib/esm/src/api/index.js +1 -1
  153. package/lib/esm/src/api/index.js.map +3 -3
  154. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.js +1 -1
  155. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.js.map +3 -3
  156. package/lib/esm/src/api/transport/model/ConnectedDevice.js +1 -1
  157. package/lib/esm/src/api/transport/model/ConnectedDevice.js.map +3 -3
  158. package/lib/esm/src/api/transport/model/TransportConnectedDevice.js +1 -1
  159. package/lib/esm/src/api/transport/model/TransportConnectedDevice.js.map +3 -3
  160. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  161. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
  162. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.js +1 -1
  163. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.js.map +3 -3
  164. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
  165. package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +3 -3
  166. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  167. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  168. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  169. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
  170. package/lib/esm/src/internal/discovery/di/discoveryTypes.js +1 -1
  171. package/lib/esm/src/internal/discovery/di/discoveryTypes.js.map +2 -2
  172. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  173. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  174. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
  175. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js.map +3 -3
  176. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.js +1 -1
  177. package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.js.map +3 -3
  178. package/lib/esm/src/internal/discovery/use-case/ReconnectUseCase.js +2 -0
  179. package/lib/esm/src/internal/discovery/use-case/ReconnectUseCase.js.map +7 -0
  180. package/lib/esm/src/internal/discovery/use-case/ReconnectUseCase.test.js +2 -0
  181. package/lib/esm/src/internal/discovery/use-case/ReconnectUseCase.test.js.map +7 -0
  182. package/lib/types/src/api/DeviceManagementKit.d.ts +12 -0
  183. package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
  184. package/lib/types/src/api/command/Command.d.ts +4 -0
  185. package/lib/types/src/api/command/Command.d.ts.map +1 -1
  186. package/lib/types/src/api/command/Errors.d.ts +5 -0
  187. package/lib/types/src/api/command/Errors.d.ts.map +1 -1
  188. package/lib/types/src/api/command/model/CommandResult.d.ts +3 -3
  189. package/lib/types/src/api/command/model/CommandResult.d.ts.map +1 -1
  190. package/lib/types/src/api/command/os/CloseAppCommand.d.ts +1 -0
  191. package/lib/types/src/api/command/os/CloseAppCommand.d.ts.map +1 -1
  192. package/lib/types/src/api/command/os/GetAppAndVersionCommand.d.ts +1 -0
  193. package/lib/types/src/api/command/os/GetAppAndVersionCommand.d.ts.map +1 -1
  194. package/lib/types/src/api/command/os/GetBatteryStatusCommand.d.ts +1 -0
  195. package/lib/types/src/api/command/os/GetBatteryStatusCommand.d.ts.map +1 -1
  196. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts +1 -0
  197. package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts.map +1 -1
  198. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +1 -0
  199. package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
  200. package/lib/types/src/api/command/os/ListAppsCommand.d.ts +1 -0
  201. package/lib/types/src/api/command/os/ListAppsCommand.d.ts.map +1 -1
  202. package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts +1 -0
  203. package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts.map +1 -1
  204. package/lib/types/src/api/command/os/LoadCertificateCommand.d.ts +1 -0
  205. package/lib/types/src/api/command/os/LoadCertificateCommand.d.ts.map +1 -1
  206. package/lib/types/src/api/command/os/OpenAppCommand.d.ts +1 -0
  207. package/lib/types/src/api/command/os/OpenAppCommand.d.ts.map +1 -1
  208. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +2 -1
  209. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
  210. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts.map +1 -1
  211. package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts.map +1 -1
  212. package/lib/types/src/api/index.d.ts +1 -1
  213. package/lib/types/src/api/index.d.ts.map +1 -1
  214. package/lib/types/src/api/logger-subscriber/service/ConsoleLogger.d.ts +1 -0
  215. package/lib/types/src/api/logger-subscriber/service/ConsoleLogger.d.ts.map +1 -1
  216. package/lib/types/src/api/transport/model/ConnectedDevice.d.ts +3 -2
  217. package/lib/types/src/api/transport/model/ConnectedDevice.d.ts.map +1 -1
  218. package/lib/types/src/api/transport/model/TransportConnectedDevice.d.ts +3 -1
  219. package/lib/types/src/api/transport/model/TransportConnectedDevice.d.ts.map +1 -1
  220. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  221. package/lib/types/src/internal/device-session/service/DefaultDeviceSessionService.d.ts +7 -5
  222. package/lib/types/src/internal/device-session/service/DefaultDeviceSessionService.d.ts.map +1 -1
  223. package/lib/types/src/internal/device-session/service/DeviceSessionService.d.ts +28 -1
  224. package/lib/types/src/internal/device-session/service/DeviceSessionService.d.ts.map +1 -1
  225. package/lib/types/src/internal/discovery/di/discoveryModule.d.ts.map +1 -1
  226. package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts +1 -0
  227. package/lib/types/src/internal/discovery/di/discoveryTypes.d.ts.map +1 -1
  228. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts +3 -2
  229. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts.map +1 -1
  230. package/lib/types/src/internal/discovery/use-case/DisconnectUseCase.d.ts.map +1 -1
  231. package/lib/types/src/internal/discovery/use-case/ReconnectUseCase.d.ts +32 -0
  232. package/lib/types/src/internal/discovery/use-case/ReconnectUseCase.d.ts.map +1 -0
  233. package/lib/types/src/internal/discovery/use-case/ReconnectUseCase.test.d.ts +2 -0
  234. package/lib/types/src/internal/discovery/use-case/ReconnectUseCase.test.d.ts.map +1 -0
  235. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  236. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/xstate-utils/XStateDeviceAction.ts"],
4
- "sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { Observable, ReplaySubject, share } from \"rxjs\";\nimport {\n createActor,\n type SnapshotFrom,\n type StateMachine,\n type StateSchema,\n} from \"xstate\";\n\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\nimport { type StateMachineTypes } from \"./StateMachineTypes\";\n\nexport type DeviceActionStateMachine<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> = StateMachine<\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"context\"], // context\n /**\n * The following usages `any` are OK because this is just a wrapper around the\n * state machine and we are not directly going to use these types.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any, // event\n any, // children\n any, // actor\n any, // action\n any, // guard\n any, // delay\n any, // state value\n any, // tag\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"input\"],\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"output\"],\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any,\n any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateSchema\n>;\n\n/**\n * A DeviceAction that uses an XState state machine to execute.\n * It maps the state machine snapshots to the DeviceActionState.\n * This class is abstract and should be extended to implement the state machine.\n */\nexport abstract class XStateDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> implements DeviceAction<Output, Input, Error, IntermediateValue>\n{\n readonly input: Input;\n readonly inspect: boolean = false;\n\n /**\n *\n * @param input The input for the DeviceAction\n * @param inspect If true, the state machine will be inspected in the browser\n */\n constructor(args: { input: Input; inspect?: boolean }) {\n this.input = args.input;\n this.inspect = Boolean(args.inspect);\n }\n\n protected abstract makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >;\n\n _execute(\n internalApi: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const stateMachine = this.makeStateMachine(internalApi);\n\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n // inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n protected _subscribeToStateMachine(\n stateMachine: DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n // inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n private _exhaustiveMatchingGuard(status: never): never {\n console.log(\"_exhaustiveMatchingGuard status\", status);\n throw new Error(`Unhandled status: ${status}`);\n }\n}\n"],
5
- "mappings": "AACA,OAAS,cAAAA,EAAY,iBAAAC,EAAe,SAAAC,MAAa,OACjD,OACE,eAAAC,MAIK,SAQP,OAEE,sBAAAC,MACK,6CA2DA,MAAeC,CAOtB,CACW,MACA,QAAmB,GAO5B,YAAYC,EAA2C,CACrD,KAAK,MAAQA,EAAK,MAClB,KAAK,QAAU,EAAQA,EAAK,OAC9B,CAYA,SACEC,EACiE,CACjE,MAAMC,EAAe,KAAK,iBAAiBD,CAAW,EAEhDE,EAAQN,EAAYK,EAAc,CACtC,MAAO,KAAK,KAGd,CAAC,EAQKE,EAAU,IAAIT,EAIdU,EACJC,GACG,CACH,KAAM,CAAE,QAAAC,EAAS,OAAAC,EAAQ,OAAAC,EAAQ,MAAAC,CAAM,EAAIJ,EAC3C,OAAQE,EAAQ,CACd,IAAK,SACH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,OACHE,EAAO,OAAO,CACZ,KAAOE,GAAQ,CACbP,EAAQ,KAAK,CACX,OAAQN,EAAmB,MAC3B,MAAOa,CACT,CAAC,CACH,EACA,MAAQC,GAAW,CACjBR,EAAQ,KAAK,CACX,OAAQN,EAAmB,UAC3B,OAAQc,CACV,CAAC,CACH,CACF,CAAC,EACDR,EAAQ,SAAS,EACjB,MACF,IAAK,QAEHA,EAAQ,MAAMM,CAAK,EACnBN,EAAQ,SAAS,EACjB,MACF,IAAK,UACHA,EAAQ,KAAK,CACX,OAAQN,EAAmB,OAC7B,CAAC,EACDM,EAAQ,SAAS,EACjB,MACF,QACE,KAAK,yBAAyBI,CAAM,CACxC,CACF,EAEMK,EAAa,IAAInB,EAEpBoB,GAAe,CAChB,MAAMC,EAAsBX,EAAQ,UAAUU,CAAU,EACxD,MAAO,IAAM,CACXE,EAAkB,YAAY,EAC9BD,EAAoB,YAAY,EAChCZ,EAAM,KAAK,CACb,CACF,CAAC,EAEKa,EAAoBb,EAAM,UAAUE,CAAmB,EAC7D,OAAAF,EAAM,MAAM,EAEL,CACL,WAAYU,EAAW,KAAKjB,EAAM,CAAC,EACnC,OAAQ,IAAM,CACZO,EAAM,KAAK,EACXa,EAAkB,YAAY,EAC9BX,EAAoBF,EAAM,YAAY,CAAC,CACzC,CACF,CACF,CAEQ,yBAAyBK,EAAsB,CACrD,cAAQ,IAAI,kCAAmCA,CAAM,EAC/C,IAAI,MAAM,qBAAqBA,CAAM,EAAE,CAC/C,CACF",
4
+ "sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { Observable, ReplaySubject, share } from \"rxjs\";\nimport {\n createActor,\n type SnapshotFrom,\n type StateMachine,\n type StateSchema,\n} from \"xstate\";\n\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\nimport { type StateMachineTypes } from \"./StateMachineTypes\";\n\nexport type DeviceActionStateMachine<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> = StateMachine<\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"context\"], // context\n /**\n * The following usages `any` are OK because this is just a wrapper around the\n * state machine and we are not directly going to use these types.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any, // event\n any, // children\n any, // actor\n any, // action\n any, // guard\n any, // delay\n any, // state value\n any, // tag\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"input\"],\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"output\"],\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any,\n any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateSchema\n>;\n\n/**\n * A DeviceAction that uses an XState state machine to execute.\n * It maps the state machine snapshots to the DeviceActionState.\n * This class is abstract and should be extended to implement the state machine.\n */\nexport abstract class XStateDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> implements DeviceAction<Output, Input, Error, IntermediateValue>\n{\n readonly input: Input;\n readonly inspect: boolean = false;\n\n /**\n *\n * @param input The input for the DeviceAction\n * @param inspect If true, the state machine will be inspected in the browser\n */\n constructor(args: { input: Input; inspect?: boolean }) {\n this.input = args.input;\n this.inspect = Boolean(args.inspect);\n }\n\n protected abstract makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >;\n\n _execute(\n internalApi: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const stateMachine = this.makeStateMachine(internalApi);\n return this._subscribeToStateMachine(stateMachine);\n }\n\n protected _subscribeToStateMachine(\n stateMachine: DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n // inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n private _exhaustiveMatchingGuard(status: never): never {\n console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,CAAU,EACxD,MAAO,IAAM,CACXE,EAAkB,YAAY,EAC9BD,EAAoB,YAAY,EAChCZ,EAAM,KAAK,CACb,CACF,CAAC,EAEKa,EAAoBb,EAAM,UAAUE,CAAmB,EAC7D,OAAAF,EAAM,MAAM,EAEL,CACL,WAAYU,EAAW,KAAKjB,EAAM,CAAC,EACnC,OAAQ,IAAM,CACZO,EAAM,KAAK,EACXa,EAAkB,YAAY,EAC9BX,EAAoBF,EAAM,YAAY,CAAC,CACzC,CACF,CACF,CAEQ,yBAAyBK,EAAsB,CACrD,cAAQ,IAAI,kCAAmCA,CAAM,EAC/C,IAAI,MAAM,qBAAqBA,CAAM,EAAE,CAC/C,CACF",
6
6
  "names": ["Observable", "ReplaySubject", "share", "createActor", "DeviceActionStatus", "XStateDeviceAction", "args", "internalApi", "stateMachine", "actor", "subject", "handleActorSnapshot", "snapshot", "context", "status", "output", "error", "err", "result", "observable", "subscriber", "subjectSubscription", "actorSubscription"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Apdu as o}from"./apdu/model/Apdu";import{APDU_MAX_PAYLOAD as p,ApduBuilder as i}from"./apdu/utils/ApduBuilder";import{ApduParser as m}from"./apdu/utils/ApduParser";export*from"./apdu/utils/AppBuilderError";import{ByteArrayBuilder as c}from"./apdu/utils/ByteArrayBuilder";import{ByteArrayParser as x}from"./apdu/utils/ByteArrayParser";import{InvalidStatusWordError as d}from"./command/Errors";import{CommandResultFactory as l,CommandResultStatus as u,isSuccessCommandResult as v}from"./command/model/CommandResult";import{CloseAppCommand as C}from"./command/os/CloseAppCommand";import{GetAppAndVersionCommand as L}from"./command/os/GetAppAndVersionCommand";import{BatteryStatusType as B,GetBatteryStatusCommand as E}from"./command/os/GetBatteryStatusCommand";import{GetOsVersionCommand as M}from"./command/os/GetOsVersionCommand";import{ListAppsCommand as I}from"./command/os/ListAppsCommand";import{LoadCertificateCommand as b}from"./command/os/LoadCertificateCommand";import{OpenAppCommand as T}from"./command/os/OpenAppCommand";import{isCommandErrorCode as P}from"./command/utils/CommandErrors";import{CommandUtils as k}from"./command/utils/CommandUtils";import{GlobalCommandError as _,GlobalCommandErrorHandler as F}from"./command/utils/GlobalCommandError";import{DeviceModel as w,DeviceModelId as K,LEDGER_VENDOR_ID as X}from"./device/DeviceModel";import{DeviceStatus as N}from"./device/DeviceStatus";import{DeviceActionStatus as j}from"./device-action/model/DeviceActionState";import{UserInteractionRequired as J}from"./device-action/model/UserInteractionRequired";import{CallTaskInAppDeviceAction as Z}from"./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction";import{AppAlreadyInstalledDAError as ee,DeviceLockedError as re,OutOfMemoryDAError as oe,RefusedByUserDAError as te,UnknownDAError as pe,UnsupportedFirmwareDAError as ie}from"./device-action/os/Errors";import{GetDeviceMetadataDeviceAction as me}from"./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction";import{GetDeviceStatusDeviceAction as se}from"./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction";import{GoToDashboardDeviceAction as fe}from"./device-action/os/GoToDashboard/GoToDashboardDeviceAction";import{InstallOrUpdateAppsDeviceAction as Ae}from"./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction";import{ListAppsDeviceAction as De}from"./device-action/os/ListApps/ListAppsDeviceAction";import{ListAppsWithMetadataDeviceAction as ue}from"./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction";import{OpenAppDeviceAction as Se}from"./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction";import{OpenAppWithDependenciesDeviceAction as ye}from"./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction";import{SendCommandInAppDeviceAction as ge}from"./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction";import{XStateDeviceAction as Ee}from"./device-action/xstate-utils/XStateDeviceAction";import{StaticDeviceModelDataSource as Me}from"./device-model/data/StaticDeviceModelDataSource";import{BleDeviceInfos as Ie}from"./device-model/model/BleDeviceInfos";import{TransportDeviceModel as be}from"./device-model/model/DeviceModel";import{ApduResponse as Te}from"./device-session/ApduResponse";export*from"./device-session/data/FramerConst";import{DeviceSessionStateType as Ve}from"./device-session/DeviceSessionState";import{GenuineCheckDeviceAction as We}from"./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction";import{InstallAppDeviceAction as Fe}from"./secure-channel/device-action/InstallApp/InstallAppDeviceAction";import{ListInstalledAppsDeviceAction as we}from"./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction";import{UninstallAppDeviceAction as Xe}from"./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction";import{SecureChannelError as Ne}from"../internal/secure-channel/model/Errors";import{defaultApduReceiverServiceStubBuilder as je}from"./device-session/service/DefaultApduReceiverService.stub";import{defaultApduSenderServiceStubBuilder as Je}from"./device-session/service/DefaultApduSenderService.stub";import{FramerUtils as Ze}from"./device-session/utils/FramerUtils";import{DeviceManagementKit as er}from"./DeviceManagementKit";import{DeviceManagementKitBuilder as or}from"./DeviceManagementKitBuilder";export*from"./Error";import{LogLevel as ir}from"./logger-subscriber/model/LogLevel";import{ConsoleLogger as mr}from"./logger-subscriber/service/ConsoleLogger";import{WebLogsExporterLogger as sr}from"./logger-subscriber/service/WebLogsExporterLogger";import{ConnectedDevice as fr}from"./transport/model/ConnectedDevice";import{DeviceConnectionStateMachine as Ar}from"./transport/model/DeviceConnectionStateMachine";export*from"./transport/model/Errors";import{TransportConnectedDevice as lr}from"./transport/model/TransportConnectedDevice";import{connectedDeviceStubBuilder as vr}from"./transport/model/TransportConnectedDevice.stub";export*from"./types";import{base64StringToBuffer as yr,isBase64String as Lr}from"./utils/Base64String";import{bufferToHexaString as Br,hexaStringToBuffer as Er,isHexaString as Gr}from"./utils/HexaString";export{p as APDU_MAX_PAYLOAD,o as Apdu,i as ApduBuilder,m as ApduParser,Te as ApduResponse,ee as AppAlreadyInstalledDAError,B as BatteryStatusType,Ie as BleDeviceInfos,c as ByteArrayBuilder,x as ByteArrayParser,Z as CallTaskInAppDeviceAction,C as CloseAppCommand,l as CommandResultFactory,u as CommandResultStatus,k as CommandUtils,fr as ConnectedDevice,mr as ConsoleLogger,j as DeviceActionStatus,Ar as DeviceConnectionStateMachine,re as DeviceLockedError,er as DeviceManagementKit,or as DeviceManagementKitBuilder,w as DeviceModel,K as DeviceModelId,Ve as DeviceSessionStateType,N as DeviceStatus,Ze as FramerUtils,We as GenuineCheckDeviceAction,L as GetAppAndVersionCommand,E as GetBatteryStatusCommand,me as GetDeviceMetadataDeviceAction,se as GetDeviceStatusDeviceAction,M as GetOsVersionCommand,_ as GlobalCommandError,F as GlobalCommandErrorHandler,fe as GoToDashboardDeviceAction,Fe as InstallAppDeviceAction,Ae as InstallOrUpdateAppsDeviceAction,d as InvalidStatusWordError,X as LEDGER_VENDOR_ID,I as ListAppsCommand,De as ListAppsDeviceAction,ue as ListAppsWithMetadataDeviceAction,we as ListInstalledAppsDeviceAction,b as LoadCertificateCommand,ir as LogLevel,T as OpenAppCommand,Se as OpenAppDeviceAction,ye as OpenAppWithDependenciesDeviceAction,oe as OutOfMemoryDAError,te as RefusedByUserDAError,Ne as SecureChannelError,ge as SendCommandInAppDeviceAction,Me as StaticDeviceModelDataSource,lr as TransportConnectedDevice,be as TransportDeviceModel,Xe as UninstallAppDeviceAction,pe as UnknownDAError,ie as UnsupportedFirmwareDAError,J as UserInteractionRequired,sr as WebLogsExporterLogger,Ee as XStateDeviceAction,yr as base64StringToBuffer,Br as bufferToHexaString,vr as connectedDeviceStubBuilder,je as defaultApduReceiverServiceStubBuilder,Je as defaultApduSenderServiceStubBuilder,Er as hexaStringToBuffer,Lr as isBase64String,P as isCommandErrorCode,Gr as isHexaString,v as isSuccessCommandResult};
1
+ import{Apdu as o}from"./apdu/model/Apdu";import{APDU_MAX_PAYLOAD as p,ApduBuilder as i}from"./apdu/utils/ApduBuilder";import{ApduParser as m}from"./apdu/utils/ApduParser";export*from"./apdu/utils/AppBuilderError";import{ByteArrayBuilder as c}from"./apdu/utils/ByteArrayBuilder";import{ByteArrayParser as x}from"./apdu/utils/ByteArrayParser";import{InvalidGetFirmwareMetadataResponseError as A,InvalidStatusWordError as D}from"./command/Errors";import{CommandResultFactory as v,CommandResultStatus as u,isSuccessCommandResult as S}from"./command/model/CommandResult";import{CloseAppCommand as y}from"./command/os/CloseAppCommand";import{GetAppAndVersionCommand as L}from"./command/os/GetAppAndVersionCommand";import{BatteryStatusType as B,GetBatteryStatusCommand as G}from"./command/os/GetBatteryStatusCommand";import{GetOsVersionCommand as R}from"./command/os/GetOsVersionCommand";import{ListAppsCommand as O}from"./command/os/ListAppsCommand";import{LoadCertificateCommand as h}from"./command/os/LoadCertificateCommand";import{OpenAppCommand as U}from"./command/os/OpenAppCommand";import{isCommandErrorCode as V}from"./command/utils/CommandErrors";import{CommandUtils as F}from"./command/utils/CommandUtils";import{GlobalCommandError as _,GlobalCommandErrorHandler as w}from"./command/utils/GlobalCommandError";import{DeviceModel as K,DeviceModelId as X,LEDGER_VENDOR_ID as q}from"./device/DeviceModel";import{DeviceStatus as Y}from"./device/DeviceStatus";import{DeviceActionStatus as z}from"./device-action/model/DeviceActionState";import{UserInteractionRequired as Q}from"./device-action/model/UserInteractionRequired";import{CallTaskInAppDeviceAction as $}from"./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction";import{AppAlreadyInstalledDAError as re,DeviceLockedError as oe,OutOfMemoryDAError as te,RefusedByUserDAError as pe,UnknownDAError as ie,UnsupportedFirmwareDAError as ne}from"./device-action/os/Errors";import{GetDeviceMetadataDeviceAction as ae}from"./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction";import{GetDeviceStatusDeviceAction as ce}from"./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction";import{GoToDashboardDeviceAction as xe}from"./device-action/os/GoToDashboard/GoToDashboardDeviceAction";import{InstallOrUpdateAppsDeviceAction as Ae}from"./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction";import{ListAppsDeviceAction as le}from"./device-action/os/ListApps/ListAppsDeviceAction";import{ListAppsWithMetadataDeviceAction as ue}from"./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction";import{OpenAppDeviceAction as Ce}from"./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction";import{OpenAppWithDependenciesDeviceAction as Ee}from"./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction";import{SendCommandInAppDeviceAction as ge}from"./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction";import{XStateDeviceAction as Ge}from"./device-action/xstate-utils/XStateDeviceAction";import{StaticDeviceModelDataSource as Re}from"./device-model/data/StaticDeviceModelDataSource";import{BleDeviceInfos as Oe}from"./device-model/model/BleDeviceInfos";import{TransportDeviceModel as he}from"./device-model/model/DeviceModel";import{ApduResponse as Ue}from"./device-session/ApduResponse";export*from"./device-session/data/FramerConst";import{DeviceSessionStateType as ke}from"./device-session/DeviceSessionState";import{GenuineCheckDeviceAction as We}from"./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction";import{InstallAppDeviceAction as we}from"./secure-channel/device-action/InstallApp/InstallAppDeviceAction";import{ListInstalledAppsDeviceAction as Ke}from"./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction";import{UninstallAppDeviceAction as qe}from"./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction";import{SecureChannelError as Ye}from"../internal/secure-channel/model/Errors";import{defaultApduReceiverServiceStubBuilder as ze}from"./device-session/service/DefaultApduReceiverService.stub";import{defaultApduSenderServiceStubBuilder as Qe}from"./device-session/service/DefaultApduSenderService.stub";import{FramerUtils as $e}from"./device-session/utils/FramerUtils";import{DeviceManagementKit as rr}from"./DeviceManagementKit";import{DeviceManagementKitBuilder as tr}from"./DeviceManagementKitBuilder";export*from"./Error";import{LogLevel as nr}from"./logger-subscriber/model/LogLevel";import{ConsoleLogger as ar}from"./logger-subscriber/service/ConsoleLogger";import{WebLogsExporterLogger as cr}from"./logger-subscriber/service/WebLogsExporterLogger";import{ConnectedDevice as xr}from"./transport/model/ConnectedDevice";import{DeviceConnectionStateMachine as Ar}from"./transport/model/DeviceConnectionStateMachine";export*from"./transport/model/Errors";import{TransportConnectedDevice as vr}from"./transport/model/TransportConnectedDevice";import{connectedDeviceStubBuilder as Sr}from"./transport/model/TransportConnectedDevice.stub";export*from"./types";import{base64StringToBuffer as Er,isBase64String as Lr}from"./utils/Base64String";import{bufferToHexaString as Br,hexaStringToBuffer as Gr,isHexaString as Mr}from"./utils/HexaString";export{p as APDU_MAX_PAYLOAD,o as Apdu,i as ApduBuilder,m as ApduParser,Ue as ApduResponse,re as AppAlreadyInstalledDAError,B as BatteryStatusType,Oe as BleDeviceInfos,c as ByteArrayBuilder,x as ByteArrayParser,$ as CallTaskInAppDeviceAction,y as CloseAppCommand,v as CommandResultFactory,u as CommandResultStatus,F as CommandUtils,xr as ConnectedDevice,ar as ConsoleLogger,z as DeviceActionStatus,Ar as DeviceConnectionStateMachine,oe as DeviceLockedError,rr as DeviceManagementKit,tr as DeviceManagementKitBuilder,K as DeviceModel,X as DeviceModelId,ke as DeviceSessionStateType,Y as DeviceStatus,$e as FramerUtils,We as GenuineCheckDeviceAction,L as GetAppAndVersionCommand,G as GetBatteryStatusCommand,ae as GetDeviceMetadataDeviceAction,ce as GetDeviceStatusDeviceAction,R as GetOsVersionCommand,_ as GlobalCommandError,w as GlobalCommandErrorHandler,xe as GoToDashboardDeviceAction,we as InstallAppDeviceAction,Ae as InstallOrUpdateAppsDeviceAction,A as InvalidGetFirmwareMetadataResponseError,D as InvalidStatusWordError,q as LEDGER_VENDOR_ID,O as ListAppsCommand,le as ListAppsDeviceAction,ue as ListAppsWithMetadataDeviceAction,Ke as ListInstalledAppsDeviceAction,h as LoadCertificateCommand,nr as LogLevel,U as OpenAppCommand,Ce as OpenAppDeviceAction,Ee as OpenAppWithDependenciesDeviceAction,te as OutOfMemoryDAError,pe as RefusedByUserDAError,Ye as SecureChannelError,ge as SendCommandInAppDeviceAction,Re as StaticDeviceModelDataSource,vr as TransportConnectedDevice,he as TransportDeviceModel,qe as UninstallAppDeviceAction,ie as UnknownDAError,ne as UnsupportedFirmwareDAError,Q as UserInteractionRequired,cr as WebLogsExporterLogger,Ge as XStateDeviceAction,Er as base64StringToBuffer,Br as bufferToHexaString,Sr as connectedDeviceStubBuilder,ze as defaultApduReceiverServiceStubBuilder,Qe as defaultApduSenderServiceStubBuilder,Gr as hexaStringToBuffer,Lr as isBase64String,V as isCommandErrorCode,Mr as isHexaString,S as isSuccessCommandResult};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/index.ts"],
4
- "sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport { InvalidStatusWordError } from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport {\n AppAlreadyInstalledDAError,\n DeviceLockedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { InstallAppDeviceAction } from \"@api/secure-channel/device-action/InstallApp/InstallAppDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nexport { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\nexport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\n DeviceConnectionStateMachine,\n type DeviceConnectionStateMachineParams,\n} from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
5
- "mappings": "AAEA,OAAS,QAAAA,MAAY,uBACrB,OAAS,oBAAAC,EAAkB,eAAAC,MAAmB,8BAC9C,OAAS,cAAAC,MAAkB,6BAC3B,WAAc,kCACd,OAAS,oBAAAC,MAAwB,mCACjC,OAAS,mBAAAC,MAAuB,kCAChC,OAAS,0BAAAC,MAA8B,sBACvC,OACE,wBAAAC,EACA,uBAAAC,EACA,0BAAAC,MACK,mCACP,OAAS,mBAAAC,MAAuB,kCAChC,OACE,2BAAAC,MAEK,0CACP,OACE,qBAAAC,EAEA,2BAAAC,MAEK,0CACP,OACE,uBAAAC,MAEK,sCACP,OAEE,mBAAAC,MAGK,kCACP,OAEE,0BAAAC,MAEK,yCACP,OAEE,kBAAAC,MACK,iCACP,OAAS,sBAAAC,MAA0B,mCACnC,OAAS,gBAAAC,MAAoB,kCAC7B,OACE,sBAAAC,EACA,6BAAAC,MACK,wCACP,OACE,eAAAC,EACA,iBAAAC,EACA,oBAAAC,MACK,0BACP,OAAS,gBAAAC,MAAoB,2BAE7B,OAEE,sBAAAC,MACK,6CACP,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,6BAAAC,MAAiC,4EAC1C,OACE,8BAAAC,GACA,qBAAAC,GACA,sBAAAC,GACA,wBAAAC,GACA,kBAAAC,GACA,8BAAAC,OACK,+BACP,OAAS,iCAAAC,OAAqC,wEAC9C,OAAS,+BAAAC,OAAmC,oEAC5C,OAAS,6BAAAC,OAAiC,gEAC1C,OAAS,mCAAAC,OAAuC,4EAChD,OAAS,wBAAAC,OAA4B,sDACrC,OAAS,oCAAAC,OAAwC,8EACjD,OAAS,uBAAAC,OAA2B,gEACpC,OAAS,uCAAAC,OAA2C,oFACpD,OAAS,gCAAAC,OAAoC,kFAC7C,OAEE,sBAAAC,OACK,qDACP,OAAS,+BAAAC,OAAmC,qDAC5C,OAAS,kBAAAC,OAAsB,yCAC/B,OAAS,wBAAAC,OAA4B,sCACrC,OAAS,gBAAAC,OAAoB,mCAC7B,WAAc,uCACd,OAEE,0BAAAC,OACK,yCACP,OAAS,4BAAAC,OAAgC,0EACzC,OAAS,0BAAAC,OAA8B,sEACvC,OAAS,iCAAAC,OAAqC,oFAC9C,OAAS,4BAAAC,OAAgC,0EACzC,OAAS,sBAAAC,OAA0B,wCAEnC,OAAS,yCAAAC,OAA6C,8DACtD,OAAS,uCAAAC,OAA2C,4DACpD,OAAS,eAAAC,OAAmB,wCAC5B,OAAS,uBAAAC,OAA2B,2BACpC,OAAS,8BAAAC,OAAkC,kCAC3C,WAAc,aACd,OAAS,YAAAC,OAAgB,wCACzB,OAAS,iBAAAC,OAAqB,+CAC9B,OAAS,yBAAAC,OAA6B,uDACtC,OAAS,mBAAAC,OAAuB,uCAChC,OACE,gCAAAC,OAEK,oDACP,WAAc,8BACd,OAAS,4BAAAC,OAAgC,gDACzC,OAAS,8BAAAC,OAAkC,qDAC3C,WAAc,aACd,OAAS,wBAAAC,GAAsB,kBAAAC,OAAsB,0BACrD,OACE,sBAAAC,GACA,sBAAAC,GACA,gBAAAC,OACK",
6
- "names": ["Apdu", "APDU_MAX_PAYLOAD", "ApduBuilder", "ApduParser", "ByteArrayBuilder", "ByteArrayParser", "InvalidStatusWordError", "CommandResultFactory", "CommandResultStatus", "isSuccessCommandResult", "CloseAppCommand", "GetAppAndVersionCommand", "BatteryStatusType", "GetBatteryStatusCommand", "GetOsVersionCommand", "ListAppsCommand", "LoadCertificateCommand", "OpenAppCommand", "isCommandErrorCode", "CommandUtils", "GlobalCommandError", "GlobalCommandErrorHandler", "DeviceModel", "DeviceModelId", "LEDGER_VENDOR_ID", "DeviceStatus", "DeviceActionStatus", "UserInteractionRequired", "CallTaskInAppDeviceAction", "AppAlreadyInstalledDAError", "DeviceLockedError", "OutOfMemoryDAError", "RefusedByUserDAError", "UnknownDAError", "UnsupportedFirmwareDAError", "GetDeviceMetadataDeviceAction", "GetDeviceStatusDeviceAction", "GoToDashboardDeviceAction", "InstallOrUpdateAppsDeviceAction", "ListAppsDeviceAction", "ListAppsWithMetadataDeviceAction", "OpenAppDeviceAction", "OpenAppWithDependenciesDeviceAction", "SendCommandInAppDeviceAction", "XStateDeviceAction", "StaticDeviceModelDataSource", "BleDeviceInfos", "TransportDeviceModel", "ApduResponse", "DeviceSessionStateType", "GenuineCheckDeviceAction", "InstallAppDeviceAction", "ListInstalledAppsDeviceAction", "UninstallAppDeviceAction", "SecureChannelError", "defaultApduReceiverServiceStubBuilder", "defaultApduSenderServiceStubBuilder", "FramerUtils", "DeviceManagementKit", "DeviceManagementKitBuilder", "LogLevel", "ConsoleLogger", "WebLogsExporterLogger", "ConnectedDevice", "DeviceConnectionStateMachine", "TransportConnectedDevice", "connectedDeviceStubBuilder", "base64StringToBuffer", "isBase64String", "bufferToHexaString", "hexaStringToBuffer", "isHexaString"]
4
+ "sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport {\n InvalidGetFirmwareMetadataResponseError,\n InvalidStatusWordError,\n} from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport {\n AppAlreadyInstalledDAError,\n DeviceLockedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { InstallAppDeviceAction } from \"@api/secure-channel/device-action/InstallApp/InstallAppDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nexport { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\nexport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\n DeviceConnectionStateMachine,\n type DeviceConnectionStateMachineParams,\n} from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
5
+ "mappings": "AAEA,OAAS,QAAAA,MAAY,uBACrB,OAAS,oBAAAC,EAAkB,eAAAC,MAAmB,8BAC9C,OAAS,cAAAC,MAAkB,6BAC3B,WAAc,kCACd,OAAS,oBAAAC,MAAwB,mCACjC,OAAS,mBAAAC,MAAuB,kCAChC,OACE,2CAAAC,EACA,0BAAAC,MACK,sBACP,OACE,wBAAAC,EACA,uBAAAC,EACA,0BAAAC,MACK,mCACP,OAAS,mBAAAC,MAAuB,kCAChC,OACE,2BAAAC,MAEK,0CACP,OACE,qBAAAC,E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S,YAAAC,OAAgB,wCACzB,OAAS,iBAAAC,OAAqB,+CAC9B,OAAS,yBAAAC,OAA6B,uDACtC,OAAS,mBAAAC,OAAuB,uCAChC,OACE,gCAAAC,OAEK,oDACP,WAAc,8BACd,OAAS,4BAAAC,OAAgC,gDACzC,OAAS,8BAAAC,OAAkC,qDAC3C,WAAc,aACd,OAAS,wBAAAC,GAAsB,kBAAAC,OAAsB,0BACrD,OACE,sBAAAC,GACA,sBAAAC,GACA,gBAAAC,OACK",
6
+ "names": ["Apdu", "APDU_MAX_PAYLOAD", "ApduBuilder", "ApduParser", "ByteArrayBuilder", "ByteArrayParser", "InvalidGetFirmwareMetadataResponseError", "InvalidStatusWordError", "CommandResultFactory", "CommandResultStatus", "isSuccessCommandResult", "CloseAppCommand", "GetAppAndVersionCommand", "BatteryStatusType", "GetBatteryStatusCommand", "GetOsVersionCommand", "ListAppsCommand", "LoadCertificateCommand", "OpenAppCommand", "isCommandErrorCode", "CommandUtils", "GlobalCommandError", "GlobalCommandErrorHandler", "DeviceModel", "DeviceModelId", "LEDGER_VENDOR_ID", "DeviceStatus", "DeviceActionStatus", "UserInteractionRequired", "CallTaskInAppDeviceAction", "AppAlreadyInstalledDAError", "DeviceLockedError", "OutOfMemoryDAError", "RefusedByUserDAError", "UnknownDAError", "UnsupportedFirmwareDAError", "GetDeviceMetadataDeviceAction", "GetDeviceStatusDeviceAction", "GoToDashboardDeviceAction", "InstallOrUpdateAppsDeviceAction", "ListAppsDeviceAction", "ListAppsWithMetadataDeviceAction", "OpenAppDeviceAction", "OpenAppWithDependenciesDeviceAction", "SendCommandInAppDeviceAction", "XStateDeviceAction", "StaticDeviceModelDataSource", "BleDeviceInfos", "TransportDeviceModel", "ApduResponse", "DeviceSessionStateType", "GenuineCheckDeviceAction", "InstallAppDeviceAction", "ListInstalledAppsDeviceAction", "UninstallAppDeviceAction", "SecureChannelError", "defaultApduReceiverServiceStubBuilder", "defaultApduSenderServiceStubBuilder", "FramerUtils", "DeviceManagementKit", "DeviceManagementKitBuilder", "LogLevel", "ConsoleLogger", "WebLogsExporterLogger", "ConnectedDevice", "DeviceConnectionStateMachine", "TransportConnectedDevice", "connectedDeviceStubBuilder", "base64StringToBuffer", "isBase64String", "bufferToHexaString", "hexaStringToBuffer", "isHexaString"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{LogLevel as e}from"../../logger-subscriber/model/LogLevel";class c{maxLevel;constructor(l=e.Debug){this.maxLevel=l}log(l,a,r){const o=`[${r.tag}]`;switch(l){case e.Info:{this.maxLevel>=e.Info&&console.info(o,a,r.data);break}case e.Warning:{this.maxLevel>=e.Warning&&console.warn(o,a,r.data);break}case e.Debug:{this.maxLevel>=e.Debug&&console.debug(o,a,r.data);break}case e.Error:{this.maxLevel>=e.Error&&console.error(o,a,r.data);break}case e.Fatal:{this.maxLevel>=e.Fatal&&console.error(o,a,r.data);break}default:console.log(o,a,r.data)}}}export{c as ConsoleLogger};
1
+ import{LogLevel as e}from"../../logger-subscriber/model/LogLevel";class g{maxLevel;constructor(t=e.Debug){this.maxLevel=t}log(t,a,r){const i=`[${r.tag}]`;switch(t){case e.Info:{this.maxLevel>=e.Info&&this.logWithData(i,console.info,a,r);break}case e.Warning:{this.maxLevel>=e.Warning&&this.logWithData(i,console.warn,a,r);break}case e.Debug:{this.maxLevel>=e.Debug&&this.logWithData(i,console.debug,a,r);break}case e.Error:{this.maxLevel>=e.Error&&this.logWithData(i,console.error,a,r);break}case e.Fatal:{this.maxLevel>=e.Fatal&&this.logWithData(i,console.error,a,r);break}default:this.logWithData(i,console.log,a,r)}}logWithData(t,a,r,i){i.data?a(t,r,i.data):a(t,r)}}export{g as ConsoleLogger};
2
2
  //# sourceMappingURL=ConsoleLogger.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/logger-subscriber/service/ConsoleLogger.ts"],
4
- "sourcesContent": ["import { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nimport { type LogSubscriberOptions } from \"@api/logger-subscriber/model/LogSubscriberOptions\";\nimport { type LoggerSubscriberService } from \"@api/logger-subscriber/service/LoggerSubscriberService\";\n\nexport class ConsoleLogger implements LoggerSubscriberService {\n private readonly maxLevel: LogLevel;\n\n constructor(level: LogLevel = LogLevel.Debug) {\n this.maxLevel = level;\n }\n\n log(\n level: LogLevel | null,\n message: string,\n options: LogSubscriberOptions,\n ): void {\n const tag = `[${options.tag}]`;\n\n switch (level) {\n case LogLevel.Info: {\n if (this.maxLevel >= LogLevel.Info) {\n console.info(tag, message, options.data);\n }\n break;\n }\n case LogLevel.Warning: {\n if (this.maxLevel >= LogLevel.Warning) {\n console.warn(tag, message, options.data);\n }\n break;\n }\n case LogLevel.Debug: {\n if (this.maxLevel >= LogLevel.Debug) {\n console.debug(tag, message, options.data);\n }\n break;\n }\n case LogLevel.Error: {\n if (this.maxLevel >= LogLevel.Error) {\n console.error(tag, message, options.data);\n }\n break;\n }\n case LogLevel.Fatal: {\n if (this.maxLevel >= LogLevel.Fatal) {\n console.error(tag, message, options.data);\n }\n break;\n }\n default:\n console.log(tag, message, options.data);\n }\n }\n}\n"],
5
- "mappings": "AAAA,OAAS,YAAAA,MAAgB,wCAIlB,MAAMC,CAAiD,CAC3C,SAEjB,YAAYC,EAAkBF,EAAS,MAAO,CAC5C,KAAK,SAAWE,CAClB,CAEA,IACEA,EACAC,EACAC,EACM,CACN,MAAMC,EAAM,IAAID,EAAQ,GAAG,IAE3B,OAAQF,EAAO,CACb,KAAKF,EAAS,KAAM,CACd,KAAK,UAAYA,EAAS,MAC5B,QAAQ,KAAKK,EAAKF,EAASC,EAAQ,IAAI,EAEzC,KACF,CACA,KAAKJ,EAAS,QAAS,CACjB,KAAK,UAAYA,EAAS,SAC5B,QAAQ,KAAKK,EAAKF,EAASC,EAAQ,IAAI,EAEzC,KACF,CACA,KAAKJ,EAAS,MAAO,CACf,KAAK,UAAYA,EAAS,OAC5B,QAAQ,MAAMK,EAAKF,EAASC,EAAQ,IAAI,EAE1C,KACF,CACA,KAAKJ,EAAS,MAAO,CACf,KAAK,UAAYA,EAAS,OAC5B,QAAQ,MAAMK,EAAKF,EAASC,EAAQ,IAAI,EAE1C,KACF,CACA,KAAKJ,EAAS,MAAO,CACf,KAAK,UAAYA,EAAS,OAC5B,QAAQ,MAAMK,EAAKF,EAASC,EAAQ,IAAI,EAE1C,KACF,CACA,QACE,QAAQ,IAAIC,EAAKF,EAASC,EAAQ,IAAI,CAC1C,CACF,CACF",
6
- "names": ["LogLevel", "ConsoleLogger", "level", "message", "options", "tag"]
4
+ "sourcesContent": ["import { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nimport { type LogSubscriberOptions } from \"@api/logger-subscriber/model/LogSubscriberOptions\";\nimport { type LoggerSubscriberService } from \"@api/logger-subscriber/service/LoggerSubscriberService\";\n\nexport class ConsoleLogger implements LoggerSubscriberService {\n private readonly maxLevel: LogLevel;\n\n constructor(level: LogLevel = LogLevel.Debug) {\n this.maxLevel = level;\n }\n\n log(\n level: LogLevel | null,\n message: string,\n options: LogSubscriberOptions,\n ): void {\n const tag = `[${options.tag}]`;\n\n switch (level) {\n case LogLevel.Info: {\n if (this.maxLevel >= LogLevel.Info) {\n this.logWithData(tag, console.info, message, options);\n }\n break;\n }\n case LogLevel.Warning: {\n if (this.maxLevel >= LogLevel.Warning) {\n this.logWithData(tag, console.warn, message, options);\n }\n break;\n }\n case LogLevel.Debug: {\n if (this.maxLevel >= LogLevel.Debug) {\n this.logWithData(tag, console.debug, message, options);\n }\n break;\n }\n case LogLevel.Error: {\n if (this.maxLevel >= LogLevel.Error) {\n this.logWithData(tag, console.error, message, options);\n }\n break;\n }\n case LogLevel.Fatal: {\n if (this.maxLevel >= LogLevel.Fatal) {\n this.logWithData(tag, console.error, message, options);\n }\n break;\n }\n default:\n this.logWithData(tag, console.log, message, options);\n }\n }\n\n private logWithData(\n tag: string,\n logFunction: (...args: unknown[]) => void,\n message: string,\n options: LogSubscriberOptions,\n ): void {\n if (options.data) {\n logFunction(tag, message, options.data);\n } else {\n logFunction(tag, message);\n }\n }\n}\n"],
5
+ "mappings": "AAAA,OAAS,YAAAA,MAAgB,wCAIlB,MAAMC,CAAiD,CAC3C,SAEjB,YAAYC,EAAkBF,EAAS,MAAO,CAC5C,KAAK,SAAWE,CAClB,CAEA,IACEA,EACAC,EACAC,EACM,CACN,MAAMC,EAAM,IAAID,EAAQ,GAAG,IAE3B,OAAQF,EAAO,CACb,KAAKF,EAAS,KAAM,CACd,KAAK,UAAYA,EAAS,MAC5B,KAAK,YAAYK,EAAK,QAAQ,KAAMF,EAASC,CAAO,EAEtD,KACF,CACA,KAAKJ,EAAS,QAAS,CACjB,KAAK,UAAYA,EAAS,SAC5B,KAAK,YAAYK,EAAK,QAAQ,KAAMF,EAASC,CAAO,EAEtD,KACF,CACA,KAAKJ,EAAS,MAAO,CACf,KAAK,UAAYA,EAAS,OAC5B,KAAK,YAAYK,EAAK,QAAQ,MAAOF,EAASC,CAAO,EAEvD,KACF,CACA,KAAKJ,EAAS,MAAO,CACf,KAAK,UAAYA,EAAS,OAC5B,KAAK,YAAYK,EAAK,QAAQ,MAAOF,EAASC,CAAO,EAEvD,KACF,CACA,KAAKJ,EAAS,MAAO,CACf,KAAK,UAAYA,EAAS,OAC5B,KAAK,YAAYK,EAAK,QAAQ,MAAOF,EAASC,CAAO,EAEvD,KACF,CACA,QACE,KAAK,YAAYC,EAAK,QAAQ,IAAKF,EAASC,CAAO,CACvD,CACF,CAEQ,YACNC,EACAC,EACAH,EACAC,EACM,CACFA,EAAQ,KACVE,EAAYD,EAAKF,EAASC,EAAQ,IAAI,EAEtCE,EAAYD,EAAKF,CAAO,CAE5B,CACF",
6
+ "names": ["LogLevel", "ConsoleLogger", "level", "message", "options", "tag", "logFunction"]
7
7
  }
@@ -1,2 +1,2 @@
1
- class c{id;sessionId;modelId;name;type;constructor({transportConnectedDevice:{id:e,deviceModel:{id:o,productName:n},type:i},sessionId:t}){this.id=e,this.sessionId=t,this.modelId=o,this.name=n,this.type=i}}export{c as ConnectedDevice};
1
+ class c{id;sessionId;modelId;name;type;transport;constructor({transportConnectedDevice:{id:e,deviceModel:{id:o,productName:n},type:t,transport:i,name:r},sessionId:d}){this.id=e,this.sessionId=d,this.modelId=o,this.name=r??n,this.type=t,this.transport=i}}export{c as 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": "AAUO,MAAMA,CAAgB,CACX,GACA,UACA,QACA,KACA,KAEhB,YAAY,CACV,yBAA0B,CACxB,GAAAC,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", "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": "AAUO,MAAMA,CAAgB,CACX,GACA,UACA,QACA,KACA,KACA,UAEhB,YAAY,CACV,yBAA0B,CACxB,GAAAC,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", "id", "deviceModelId", "productName", "type", "transport", "name", "sessionId"]
7
7
  }
@@ -1,2 +1,2 @@
1
- class i{id;deviceModel;sendApdu;type;transport;constructor({id:e,deviceModel:t,type:o,transport:r,sendApdu:n}){this.id=e,this.deviceModel=t,this.sendApdu=n,this.type=o,this.transport=r}}export{i as TransportConnectedDevice};
1
+ class d{id;deviceModel;sendApdu;type;transport;name;constructor({id:e,deviceModel:t,type:n,transport:r,sendApdu:o,name:p}){this.id=e,this.deviceModel=t,this.sendApdu=o,this.type=n,this.transport=r,this.name=p}}export{d as 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": "AAiBO,MAAMA,CAAyB,CACpB,GACA,YACA,SACA,KACA,UAEhB,YAAY,CACV,GAAAC,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", "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": "AAkBO,MAAMA,CAAyB,CACpB,GACA,YACA,SACA,KACA,UACA,KAEhB,YAAY,CACV,GAAAC,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", "id", "deviceModel", "type", "transport", "sendApdu", "name"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{BehaviorSubject as v}from"rxjs";import{v4 as d}from"uuid";import{CommandUtils as h}from"../../../api/command/utils/CommandUtils";import{DeviceStatus as c}from"../../../api/device/DeviceStatus";import{DeviceSessionStateType as S}from"../../../api/device-session/DeviceSessionState";import{DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS as u}from"../../device-session/data/DeviceSessionRefresherConst";import{MutexService as m}from"../../device-session/service/MutexService";import{RefresherService as D}from"../../device-session/service/RefresherService";import{DevicePinger as l}from"./DevicePinger";import{DeviceSessionEventDispatcher as _,SessionEvents as n}from"./DeviceSessionEventDispatcher";import{DeviceSessionRefresher as f}from"./DeviceSessionRefresher";import{DeviceSessionStateHandler as g}from"./DeviceSessionStateHandler";class V{_id;_connectedDevice;_deviceState;_managerApiService;_secureChannelService;_logger;_refresherOptions;_pinger;_deviceSessionRefresher;_refresherService;_commandMutex=new m;_sessionEventDispatcher=new _;constructor({connectedDevice:e,id:s=d()},t,i,r,a){this._id=s,this._connectedDevice=e,this._logger=t("device-session"),this._managerApiService=i,this._secureChannelService=r,this._refresherOptions={...u,...a},this._deviceState=new v({sessionStateType:S.Connected,deviceStatus:c.CONNECTED,deviceModelId:this._connectedDevice.deviceModel.id}),this._pinger=new l(t,e,this._sessionEventDispatcher,(o,p)=>this.sendCommand(o,p)),this._deviceSessionRefresher=new f(t,this._refresherOptions,this._sessionEventDispatcher,this._connectedDevice),new g(t,this._sessionEventDispatcher,this._connectedDevice,this._deviceState,o=>this.setDeviceSessionState(o)),this._refresherService=new D(t,{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,s={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){const t=await this._commandMutex.lock();try{this._sessionEventDispatcher.dispatch({eventName:n.DEVICE_STATE_UPDATE_BUSY});const i=await this._connectedDevice.sendApdu(e,s.triggersDisconnection,s.abortTimeout);return i.ifRight(r=>{h.isLockedDeviceResponse(r)?this._sessionEventDispatcher.dispatch({eventName:n.DEVICE_STATE_UPDATE_LOCKED}):this._sessionEventDispatcher.dispatch({eventName:n.DEVICE_STATE_UPDATE_CONNECTED})}).ifLeft(()=>{this._sessionEventDispatcher.dispatch({eventName:n.DEVICE_STATE_UPDATE_CONNECTED})}),i}finally{t()}}async sendCommand(e,s){const t=e.getApdu();return(await this.sendApdu(t.getRawApdu(),{isPolling:!1,triggersDisconnection:e.triggersDisconnection??!1,abortTimeout:s})).caseOf({Left:r=>{throw r},Right:r=>e.parseResponse(r,this._connectedDevice.deviceModel.id)})}executeDeviceAction(e){const{observable:s,cancel:t}=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:s,cancel:t}}close(){this._updateDeviceStatus(c.NOT_CONNECTED),this._deviceState.complete(),this._deviceSessionRefresher.stopRefresher()}disableRefresher(e){return this._refresherService.disableRefresher(e)}_updateDeviceStatus(e){const s=this._deviceState.getValue();this._deviceState.next({...s,deviceStatus:e})}}export{V as DeviceSession};
1
+ import{BehaviorSubject as d}from"rxjs";import{v4 as h}from"uuid";import{CommandUtils as S}from"../../../api/command/utils/CommandUtils";import{DeviceStatus as v}from"../../../api/device/DeviceStatus";import{DeviceSessionStateType as u}from"../../../api/device-session/DeviceSessionState";import{bufferToHexaString as a}from"../../../api/index";import{DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS as m}from"../../device-session/data/DeviceSessionRefresherConst";import{MutexService as l}from"../../device-session/service/MutexService";import{RefresherService as D}from"../../device-session/service/RefresherService";import{DevicePinger as _}from"./DevicePinger";import{DeviceSessionEventDispatcher as g,SessionEvents as o}from"./DeviceSessionEventDispatcher";import{DeviceSessionRefresher as f}from"./DeviceSessionRefresher";import{DeviceSessionStateHandler as E}from"./DeviceSessionStateHandler";class L{_id;_connectedDevice;_deviceState;_managerApiService;_secureChannelService;_logger;_refresherOptions;_pinger;_deviceSessionRefresher;_refresherService;_commandMutex=new l;_sessionEventDispatcher=new g;constructor({connectedDevice:e,id:r=h()},s,t,i,n){this._id=r,this._connectedDevice=e,this._logger=s("device-session"),this._managerApiService=t,this._secureChannelService=i,this._refresherOptions={...m,...n},this._deviceState=new d({sessionStateType:u.Connected,deviceStatus:v.CONNECTED,deviceModelId:this._connectedDevice.deviceModel.id}),this._pinger=new _(s,e,this._sessionEventDispatcher,(c,p)=>this.sendCommand(c,p)),this._deviceSessionRefresher=new f(s,this._refresherOptions,this._sessionEventDispatcher,this._connectedDevice),new E(s,this._sessionEventDispatcher,this._connectedDevice,this._deviceState,c=>this.setDeviceSessionState(c)),this._refresherService=new D(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,r={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){const s=await this._commandMutex.lock();try{this._sessionEventDispatcher.dispatch({eventName:o.DEVICE_STATE_UPDATE_BUSY}),this._logger.debug(`[exchange] => ${a(e,!1)}`);const t=await this._connectedDevice.sendApdu(e,r.triggersDisconnection,r.abortTimeout);return t.ifRight(i=>{this._logger.debug(`[exchange] <= ${a(i.data,!1)}${a(i.statusCode,!1)}`),S.isLockedDeviceResponse(i)?this._sessionEventDispatcher.dispatch({eventName:o.DEVICE_STATE_UPDATE_LOCKED}):this._sessionEventDispatcher.dispatch({eventName:o.DEVICE_STATE_UPDATE_CONNECTED})}).ifLeft(()=>{this._sessionEventDispatcher.dispatch({eventName:o.DEVICE_STATE_UPDATE_CONNECTED})}),t}finally{s()}}async sendCommand(e,r){this._logger.debug(`[sendCommand] ${e.name}`);const s=e.getApdu();return(await this.sendApdu(s.getRawApdu(),{isPolling:!1,triggersDisconnection:e.triggersDisconnection??!1,abortTimeout:r})).caseOf({Left:i=>{throw this._logger.error("[sendCommand] error",{data:{err:i}}),i},Right:i=>{const n=e.parseResponse(i,this._connectedDevice.deviceModel.id);return this._logger.debug("[sendCommand] result",{data:{result:n}}),n}})}executeDeviceAction(e){const{observable:r,cancel:s}=e._execute({sendApdu:async t=>this.sendApdu(t),sendCommand:async(t,i)=>this.sendCommand(t,i),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:r,cancel:s}}close(){this._updateDeviceStatus(v.NOT_CONNECTED),this._deviceState.complete(),this._deviceSessionRefresher.stopRefresher()}disableRefresher(e){return this._refresherService.disableRefresher(e)}_updateDeviceStatus(e){const r=this._deviceState.getValue();this._deviceState.next({...r,deviceStatus:e})}}export{L as 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": "AACA,OAAS,mBAAAA,MAAwC,OACjD,OAAS,MAAMC,MAAc,OAI7B,OAAS,gBAAAC,MAAoB,kCAC7B,OAAS,gBAAAC,MAAoB,2BAO7B,OAEE,0BAAAC,MACK,yCAKP,OAAS,4CAAAC,MAAgD,4DACzD,OAAS,gBAAAC,MAAoB,gDAC7B,OAAS,oBAAAC,MAAwB,oDAIjC,OAAS,gBAAAC,MAAoB,iBAC7B,OACE,gCAAAC,EACA,iBAAAC,MACK,iCACP,OAAS,0BAAAC,MAA8B,2BACvC,OAAS,6BAAAC,MAAiC,8BAqBnC,MAAMC,CAAc,CACR,IACA,iBACA,aACA,mBACA,sBACA,QACA,kBACT,QACA,wBACS,kBACT,cAAgB,IAAIP,EACpB,wBAA0B,IAAIG,EAE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ACxD,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,oBAAoB9B,EAAa,aAAa,EACnD,KAAK,aAAa,SAAS,EAC3B,KAAK,wBAAwB,cAAc,CAC7C,CAEO,iBAAiBY,EAAwB,CAC9C,OAAO,KAAK,kBAAkB,iBAAiBA,CAAE,CACnD,CAEQ,oBAAoBoB,EAAkC,CAC5D,MAAMb,EAAQ,KAAK,aAAa,SAAS,EACzC,KAAK,aAAa,KAAK,CAAE,GAAGA,EAAO,aAAAa,CAAa,CAAC,CACnD,CACF",
6
- "names": ["BehaviorSubject", "uuidv4", "CommandUtils", "DeviceStatus", "DeviceSessionStateType", "DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS", "MutexService", "RefresherService", "DevicePinger", "DeviceSessionEventDispatcher", "SessionEvents", "DeviceSessionRefresher", "DeviceSessionStateHandler", "DeviceSession", "connectedDevice", "id", "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": "AACA,OAAS,mBAAAA,MAAwC,OACjD,OAAS,MAAMC,MAAc,OAI7B,OAAS,gBAAAC,MAAoB,kCAC7B,OAAS,gBAAAC,MAAoB,2BAO7B,OAEE,0BAAAC,MACK,yCAGP,OAAS,sBAAAC,MAA0B,aAGnC,OAAS,4CAAAC,MAAgD,4DACzD,OAAS,gBAAAC,MAAoB,gDAC7B,OAAS,oBAAAC,MAAwB,oDAIjC,OAAS,gBAAAC,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names": ["BehaviorSubject", "uuidv4", "CommandUtils", "DeviceStatus", "DeviceSessionStateType", "bufferToHexaString", "DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS", "MutexService", "RefresherService", "DevicePinger", "DeviceSessionEventDispatcher", "SessionEvents", "DeviceSessionRefresher", "DeviceSessionStateHandler", "DeviceSession", "connectedDevice", "id", "loggerModuleFactory", "managerApiService", "secureChannelService", "deviceSessionRefresherOptions", "command", "abortTimeout", "state", "error", "rawApdu", "options", "release", "result", "response", "apdu", "err", "r", "deviceAction", "observable", "cancel", "blockerId", "deviceStatus"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var d=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var g=(t,e,i,s)=>{for(var o=s>1?void 0:s?l(e,i):e,n=t.length-1,c;n>=0;n--)(c=t[n])&&(o=(s?c(e,i,o):c(o))||o);return s&&o&&d(e,i,o),o},v=(t,e)=>(i,s)=>e(i,s,t);import{inject as u,injectable as S}from"inversify";import{Maybe as a}from"purify-ts";import{ReplaySubject as b}from"rxjs";import{DeviceSessionNotFound as h}from"../../device-session/model/Errors";import{loggerTypes as m}from"../../logger-publisher/di/loggerTypes";let r=class{_sessions;_logger;_sessionsSubject;constructor(e){this._sessions=[],this._sessionsSubject=new b,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.fromNullable(this._sessions.find(s=>s.id===e)).toEither(new h)}getDeviceSessionByDeviceId(e){return a.fromNullable(this._sessions.find(s=>s.connectedDevice.id===e)).toEither(new h)}getDeviceSessions(){return this._sessions}};r=g([S(),v(0,u(m.LoggerPublisherServiceFactory))],r);export{r as DefaultDeviceSessionService};
1
+ var S=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var v=(r,e,s,i)=>{for(var o=i>1?void 0:i?a(e,s):e,n=r.length-1,c;n>=0;n--)(c=r[n])&&(o=(i?c(e,s,o):c(o))||o);return i&&o&&S(e,s,o),o},h=(r,e)=>(s,i)=>e(s,i,r);import{inject as l,injectable as u}from"inversify";import{Maybe as d}from"purify-ts";import{ReplaySubject as m}from"rxjs";import{DeviceSessionNotFound as g}from"../../device-session/model/Errors";import{loggerTypes as D}from"../../logger-publisher/di/loggerTypes";let t=class{_sessions;_sessionsSubject;_logger;constructor(e){this._sessions=[],this._sessionsSubject=new m,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.fromNullable(this._sessions.find(s=>s.id===e)).toEither(new g)}getDeviceSessionsByDeviceId(e){return d.fromPredicate(({length:s})=>s>0,this._sessions.filter(s=>s.connectedDevice.id===e)).toEither(new g)}getDeviceSessions(){return this._sessions}};t=v([u(),h(0,l(D.LoggerPublisherServiceFactory))],t);export{t as 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": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YACnC,OAAS,SAAAC,MAAa,YACtB,OAAqB,iBAAAC,MAAqB,OAI1C,OAAS,yBAAAC,MAA6B,wCAEtC,OAAS,eAAAC,MAAmB,4CAGrB,IAAMC,EAAN,KAAkE,CAC/D,UACS,QACT,iBAER,YAEEC,EACA,CACA,KAAK,UAAY,CAAC,EAClB,KAAK,iBAAmB,IAAIC,EAC5B,KAAK,QAAUD,EAAoB,sBAAsB,CAC3D,CAEA,IAAW,aAAyC,CAClD,OAAO,KAAK,iBAAiB,aAAa,CAC5C,CAEA,iBAAiBE,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,OAJsBE,EAAM,aAC1B,KAAK,UAAU,KAAM,GAAM,EAAE,KAAOF,CAAS,CAC/C,EAEqB,SAAS,IAAIG,CAAuB,CAC3D,CAEA,2BAA2BC,EAAkB,CAK3C,OAJsBF,EAAM,aAC1B,KAAK,UAAU,KAAM,GAAM,EAAE,gBAAgB,KAAOE,CAAQ,CAC9D,EAEqB,SAAS,IAAID,CAAuB,CAC3D,CAEA,mBAAoB,CAClB,OAAO,KAAK,SACd,CACF,EAjEaP,EAANS,EAAA,CADNC,EAAW,EAOPC,EAAA,EAAAC,EAAOC,EAAY,6BAA6B,IANxCb",
6
- "names": ["inject", "injectable", "Maybe", "ReplaySubject", "DeviceSessionNotFound", "loggerTypes", "DefaultDeviceSessionService", "loggerModuleFactory", "ReplaySubject", "deviceSession", "sessionId", "found", "Maybe", "DeviceSessionNotFound", "deviceId", "__decorateClass", "injectable", "__decorateParam", "inject", "loggerTypes"]
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": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,SAAAC,MAAa,YAC9B,OAAqB,iBAAAC,MAAqB,OAK1C,OAAS,yBAAAC,MAA6B,wCAEtC,OAAS,eAAAC,MAAmB,4CAGrB,IAAMC,EAAN,KAAkE,CAC/D,UACS,iBACA,QAEjB,YAEEC,EACA,CACA,KAAK,UAAY,CAAC,EAClB,KAAK,iBAAmB,IAAIC,EAC5B,KAAK,QAAUD,EAAoB,sBAAsB,CAC3D,CAEA,IAAW,aAAyC,CAClD,OAAO,KAAK,iBAAiB,aAAa,CAC5C,CAEA,iBAAiBE,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,OAAOE,EAAM,aACX,KAAK,UAAU,KAAM,GAAM,EAAE,KAAOF,CAAS,CAC/C,EAAE,SAAS,IAAIG,CAAuB,CACxC,CAEA,4BACEC,EACgD,CAChD,OAAOF,EAAM,cACX,CAAC,CAAE,OAAAG,CAAO,IAAMA,EAAS,EACzB,KAAK,UAAU,OAAQ,GAAM,EAAE,gBAAgB,KAAOD,CAAQ,CAChE,EAAE,SAAS,IAAID,CAAuB,CACxC,CAEA,mBAAqC,CACnC,OAAO,KAAK,SACd,CACF,EAlEaR,EAANW,EAAA,CADNC,EAAW,EAOPC,EAAA,EAAAC,EAAOC,EAAY,6BAA6B,IANxCf",
6
+ "names": ["inject", "injectable", "Maybe", "ReplaySubject", "DeviceSessionNotFound", "loggerTypes", "DefaultDeviceSessionService", "loggerModuleFactory", "ReplaySubject", "deviceSession", "s", "sessionId", "found", "Maybe", "DeviceSessionNotFound", "deviceId", "length", "__decorateClass", "injectable", "__decorateParam", "inject", "loggerTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Either as m,Left as p}from"purify-ts";import{Observable as D}from"rxjs";import{DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS as S}from"../../device-session/data/DeviceSessionRefresherConst";import{deviceSessionStubBuilder as l}from"../../device-session/model/DeviceSession.stub";import{DeviceSessionNotFound as f}from"../../device-session/model/Errors";import{DefaultLoggerPublisherService as g}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as h}from"../../manager-api/data/AxiosManagerApiDataSource";import{DefaultManagerApiService as b}from"../../manager-api/service/DefaultManagerApiService";import{DefaultSecureChannelDataSource as E}from"../../secure-channel/data/DefaultSecureChannelDataSource";import{DefaultSecureChannelService as x}from"../../secure-channel/service/DefaultSecureChannelService";import{DefaultDeviceSessionService as A}from"./DefaultDeviceSessionService";vi.mock("@internal/logger-publisher/service/DefaultLoggerPublisherService");vi.mock("@internal/manager-api/data/AxiosManagerApiDataSource");let e,t,i,v,a,u,c;describe("DefaultDeviceSessionService",()=>{beforeEach(()=>{vi.restoreAllMocks(),t=new g([],"deviceSession"),e=new A(()=>t),v=new h({}),a=new b(v),u=new E({}),c=new x(u),i=l({},()=>t,a,c,S)}),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(m.of(i))}),it("should not get a deviceSession if it does not exist",()=>{expect(e.getDeviceSessionById(i.id)).toEqual(p(new f))}),it("should get all sessions",()=>{e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])}),it("should retrieve sessionObs",()=>{expect(e.sessionsObs).toBeInstanceOf(D)}),it("should emit new session",()=>new Promise((s,o)=>{const r=e.sessionsObs.subscribe({next(n){try{expect(n).toStrictEqual(i),r.unsubscribe(),s()}catch(d){o(d)}}});e.addDeviceSession(i)})),it("should emit previous added session",()=>{const s=l({id:"last-session"},()=>t,a,c,S),o=[];e.addDeviceSession(i),e.addDeviceSession(s);const r=e.sessionsObs.subscribe({next(n){o.push(n)}});s.close(),expect(o).toEqual([i,s]),r.unsubscribe()})});
1
+ import{Either as l,Left as u}from"purify-ts";import{Observable as b}from"rxjs";import{connectedDeviceStubBuilder as p}from"../../../api/transport/model/TransportConnectedDevice.stub";import{DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS as r}from"../../device-session/data/DeviceSessionRefresherConst";import{deviceSessionStubBuilder as a}from"../../device-session/model/DeviceSession.stub";import{DeviceSessionNotFound as m}from"../../device-session/model/Errors";import{DefaultLoggerPublisherService as x}from"../../logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as E}from"../../manager-api/data/AxiosManagerApiDataSource";import{DefaultManagerApiService as y}from"../../manager-api/service/DefaultManagerApiService";import{DefaultSecureChannelDataSource as I}from"../../secure-channel/data/DefaultSecureChannelDataSource";import{DefaultSecureChannelService as A}from"../../secure-channel/service/DefaultSecureChannelService";import{DefaultDeviceSessionService as q}from"./DefaultDeviceSessionService";vi.mock("@internal/logger-publisher/service/DefaultLoggerPublisherService");vi.mock("@internal/manager-api/data/AxiosManagerApiDataSource");let e,s,i,v,d,g,t,f,c;describe("DefaultDeviceSessionService",()=>{s=new x([],"deviceSession"),g=new E({}),t=new y(g),f=new I({}),c=new A(f),beforeEach(()=>{vi.restoreAllMocks(),e=new q(()=>s),i=a({},()=>s,t,c,r)}),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(l.of(i))}),it("should not get the DeviceSession if it does not exist",()=>{e.addDeviceSession(i),expect(e.getDeviceSessionById("non-existent-id")).toEqual(u(new m))})}),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(u(new m))}),it("should get a single device session by deviceId",()=>{e.addDeviceSession(i),expect(e.getDeviceSessionsByDeviceId(i.connectedDevice.id)).toEqual(l.of([i]))}),it("should get device sessions by deviceId",()=>{e.addDeviceSession(i),v=a({connectedDevice:p({id:"device-1"}),id:"session-1"},()=>s,t,c,r),d=a({connectedDevice:p({id:"device-1"}),id:"session-2"},()=>s,t,c,r),e.addDeviceSession(v),e.addDeviceSession(d),expect(e.getDeviceSessionsByDeviceId("device-1")).toEqual(l.of([v,d])),v.close(),d.close()})}),it("should get all sessions",()=>{e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])}),it("should retrieve sessionObs",()=>{expect(e.sessionsObs).toBeInstanceOf(b)}),it("should emit new session",()=>new Promise((o,n)=>{const S=e.sessionsObs.subscribe({next(D){try{expect(D).toStrictEqual(i),S.unsubscribe(),o()}catch(h){n(h)}}});e.addDeviceSession(i)})),it("should emit previous added session",()=>{const o=a({id:"last-session"},()=>s,t,c,r),n=[];e.addDeviceSession(i),e.addDeviceSession(o);const S=e.sessionsObs.subscribe({next(D){n.push(D)}});o.close(),expect(n).toEqual([i,o]),S.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,OAAS,UAAAA,EAAQ,QAAAC,MAAY,YAC7B,OAAS,cAAAC,MAAkB,OAG3B,OAAS,4CAAAC,MAAgD,4DAEzD,OAAS,4BAAAC,MAAgC,oDACzC,OAAS,yBAAAC,MAA6B,wCACtC,OAAS,iCAAAC,MAAqC,mEAC9C,OAAS,6BAAAC,MAA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OAAOC,CAAe,EAAE,QAAQ,CAACX,EAAeU,CAAiB,CAAC,EAClEH,EAAa,YAAY,CAC3B,CAAC,CACH,CAAC",
6
- "names": ["Either", "Left", "Observable", "DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS", "deviceSessionStubBuilder", "DeviceSessionNotFound", "DefaultLoggerPublisherService", "AxiosManagerApiDataSource", "DefaultManagerApiService", "DefaultSecureChannelDataSource", "DefaultSecureChannelService", "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,OAAS,UAAAA,EAAQ,QAAAC,MAAY,YAC7B,OAAS,cAAAC,MAAkB,OAG3B,OAAS,8BAAAC,MAAkC,qDAC3C,OAAS,4CAAAC,MAAgD,4DAEzD,OAAS,4BAAAC,MAAgC,oDACzC,OAAS,yBAAAC,MAA6B,wCACtC,OAAS,iCAAAC,MAAqC,mEAC9C,OAAS,6BAAAC,MAAiC,uDAE1C,O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ubBuilder", "DeviceSessionNotFound", "DefaultLoggerPublisherService", "AxiosManagerApiDataSource", "DefaultManagerApiService", "DefaultSecureChannelDataSource", "DefaultSecureChannelService", "DefaultDeviceSessionService", "sessionService", "loggerService", "deviceSession", "deviceSession1", "deviceSession2", "managerApiDataSource", "managerApi", "secureChannelDataSource", "secureChannel", "resolve", "reject", "subscription", "emittedDeviceSession", "error", "lastDeviceSession", "emittedSessions"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ContainerModule as i}from"inversify";import{ConnectUseCase as C}from"../../discovery/use-case/ConnectUseCase";import{DisconnectUseCase as c}from"../../discovery/use-case/DisconnectUseCase";import{GetConnectedDeviceUseCase as r}from"../../discovery/use-case/GetConnectedDeviceUseCase";import{ListConnectedDevicesUseCase as n}from"../../discovery/use-case/ListConnectedDevicesUseCase";import{ListenToAvailableDevicesUseCase as U}from"../../discovery/use-case/ListenToAvailableDevicesUseCase";import{ListenToConnectedDeviceUseCase as v}from"../../discovery/use-case/ListenToConnectedDeviceUseCase";import{StartDiscoveringUseCase as m}from"../../discovery/use-case/StartDiscoveringUseCase";import{StopDiscoveringUseCase as D}from"../../discovery/use-case/StopDiscoveringUseCase";import{StubUseCase as t}from"../../../../src/di.stub";import{discoveryTypes as e}from"./discoveryTypes";const P=({stub:a=!1})=>new i(({bind:o,rebindSync:s})=>{o(e.ConnectUseCase).to(C),o(e.DisconnectUseCase).to(c),o(e.StartDiscoveringUseCase).to(m),o(e.StopDiscoveringUseCase).to(D),o(e.GetConnectedDeviceUseCase).to(r),o(e.ListenToAvailableDevicesUseCase).to(U),o(e.ListenToConnectedDeviceUseCase).to(v),o(e.ListConnectedDevicesUseCase).to(n),a&&(s(e.ConnectUseCase).to(t),s(e.DisconnectUseCase).to(t),s(e.StartDiscoveringUseCase).to(t),s(e.StopDiscoveringUseCase).to(t),s(e.GetConnectedDeviceUseCase).to(t),s(e.ListenToAvailableDevicesUseCase).to(t),s(e.ListenToConnectedDeviceUseCase).to(t),s(e.ListConnectedDevicesUseCase).to(t))});export{P as discoveryModuleFactory};
1
+ import{ContainerModule as i}from"inversify";import{ConnectUseCase as C}from"../../discovery/use-case/ConnectUseCase";import{DisconnectUseCase as c}from"../../discovery/use-case/DisconnectUseCase";import{GetConnectedDeviceUseCase as r}from"../../discovery/use-case/GetConnectedDeviceUseCase";import{ListConnectedDevicesUseCase as n}from"../../discovery/use-case/ListConnectedDevicesUseCase";import{ListenToAvailableDevicesUseCase as U}from"../../discovery/use-case/ListenToAvailableDevicesUseCase";import{ListenToConnectedDeviceUseCase as m}from"../../discovery/use-case/ListenToConnectedDeviceUseCase";import{ReconnectUseCase as v}from"../../discovery/use-case/ReconnectUseCase";import{StartDiscoveringUseCase as D}from"../../discovery/use-case/StartDiscoveringUseCase";import{StopDiscoveringUseCase as p}from"../../discovery/use-case/StopDiscoveringUseCase";import{StubUseCase as t}from"../../../../src/di.stub";import{discoveryTypes as e}from"./discoveryTypes";const w=({stub:a=!1})=>new i(({bind:o,rebindSync:s})=>{o(e.ConnectUseCase).to(C),o(e.DisconnectUseCase).to(c),o(e.ReconnectUseCase).to(v),o(e.StartDiscoveringUseCase).to(D),o(e.StopDiscoveringUseCase).to(p),o(e.GetConnectedDeviceUseCase).to(r),o(e.ListenToAvailableDevicesUseCase).to(U),o(e.ListenToConnectedDeviceUseCase).to(m),o(e.ListConnectedDevicesUseCase).to(n),a&&(s(e.ConnectUseCase).to(t),s(e.DisconnectUseCase).to(t),s(e.StartDiscoveringUseCase).to(t),s(e.StopDiscoveringUseCase).to(t),s(e.GetConnectedDeviceUseCase).to(t),s(e.ListenToAvailableDevicesUseCase).to(t),s(e.ListenToConnectedDeviceUseCase).to(t),s(e.ListConnectedDevicesUseCase).to(t))});export{w as discoveryModuleFactory};
2
2
  //# sourceMappingURL=discoveryModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/discovery/di/discoveryModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { ConnectUseCase } from \"@internal/discovery/use-case/ConnectUseCase\";\nimport { DisconnectUseCase } from \"@internal/discovery/use-case/DisconnectUseCase\";\nimport { GetConnectedDeviceUseCase } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nimport { ListConnectedDevicesUseCase } from \"@internal/discovery/use-case/ListConnectedDevicesUseCase\";\nimport { ListenToAvailableDevicesUseCase } from \"@internal/discovery/use-case/ListenToAvailableDevicesUseCase\";\nimport { ListenToConnectedDeviceUseCase } from \"@internal/discovery/use-case/ListenToConnectedDeviceUseCase\";\nimport { StartDiscoveringUseCase } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nimport { StopDiscoveringUseCase } from \"@internal/discovery/use-case/StopDiscoveringUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { discoveryTypes } from \"./discoveryTypes\";\n\ntype FactoryProps = {\n stub: boolean;\n};\n\nexport const discoveryModuleFactory = ({ stub = false }: FactoryProps) =>\n new ContainerModule(({ bind, 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": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,kBAAAC,MAAsB,8CAC/B,OAAS,qBAAAC,MAAyB,iDAClC,OAAS,6BAAAC,MAAiC,yDAC1C,OAAS,+BAAAC,MAAmC,2DAC5C,OAAS,mCAAAC,MAAuC,+DAChD,OAAS,kCAAAC,MAAsC,8DAC/C,OAAS,2BAAAC,MAA+B,uDACxC,OAAS,0BAAAC,MAA8B,sDACvC,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,kBAAAC,MAAsB,mBAMxB,MAAMC,EAAyB,CAAC,CAAE,KAAAC,EAAO,EAAM,IACpD,IAAIZ,EAAgB,CAAC,CAAE,KAAAa,EAAM,WAAAC,CAAW,IAAM,CAC5CD,EAAKH,EAAe,cAAc,EAAE,GAAGT,CAAc,EACrDY,EAAKH,EAAe,iBAAiB,EAAE,GAAGR,CAAiB,EAC3DW,EAAKH,EAAe,uBAAuB,EAAE,GAAGH,CAAuB,EACvEM,EAAKH,EAAe,sBAAsB,EAAE,GAAGF,CAAsB,EACrEK,EAAKH,EAAe,yBAAyB,EAAE,GAC7CP,CACF,EACAU,EAAKH,EAAe,+BAA+B,EAAE,GACnDL,CACF,EACAQ,EAAKH,EAAe,8BAA8B,EAAE,GAClDJ,CACF,EACAO,EAAKH,EAAe,2BAA2B,EAAE,GAC/CN,CACF,EAEIQ,IACFE,EAAWJ,EAAe,cAAc,EAAE,GAAGD,CAAW,EACxDK,EAAWJ,EAAe,iBAAiB,EAAE,GAAGD,CAAW,EAC3DK,EAAWJ,EAAe,uBAAuB,EAAE,GAAGD,CAAW,EACjEK,EAAWJ,EAAe,sBAAsB,EAAE,GAAGD,CAAW,EAChEK,EAAWJ,EAAe,yBAAyB,EAAE,GAAGD,CAAW,EACnEK,EAAWJ,EAAe,+BAA+B,EAAE,GACzDD,CACF,EACAK,EAAWJ,EAAe,8BAA8B,EAAE,GAAGD,CAAW,EACxEK,EAAWJ,EAAe,2BAA2B,EAAE,GAAGD,CAAW,EAEzE,CAAC",
6
- "names": ["ContainerModule", "ConnectUseCase", "DisconnectUseCase", "GetConnectedDeviceUseCase", "ListConnectedDevicesUseCase", "ListenToAvailableDevicesUseCase", "ListenToConnectedDeviceUseCase", "StartDiscoveringUseCase", "StopDiscoveringUseCase", "StubUseCase", "discoveryTypes", "discoveryModuleFactory", "stub", "bind", "rebindSync"]
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": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,kBAAAC,MAAsB,8CAC/B,OAAS,qBAAAC,MAAyB,iDAClC,OAAS,6BAAAC,MAAiC,yDAC1C,OAAS,+BAAAC,MAAmC,2DAC5C,OAAS,mCAAAC,MAAuC,+DAChD,OAAS,kCAAAC,MAAsC,8DAC/C,OAAS,oBAAAC,MAAwB,gDACjC,OAAS,2BAAAC,MAA+B,uDACxC,OAAS,0BAAAC,MAA8B,sDACvC,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,kBAAAC,MAAsB,mBAMxB,MAAMC,EAAyB,CAAC,CAAE,KAAAC,EAAO,EAAM,IACpD,IAAIb,EAAgB,CAAC,CAAE,KAAAc,EAAM,WAAAC,CAAW,IAAM,CAC5CD,EAAKH,EAAe,cAAc,EAAE,GAAGV,CAAc,EACrDa,EAAKH,EAAe,iBAAiB,EAAE,GAAGT,CAAiB,EAC3DY,EAAKH,EAAe,gBAAgB,EAAE,GAAGJ,CAAgB,EACzDO,EAAKH,EAAe,uBAAuB,EAAE,GAAGH,CAAuB,EACvEM,EAAKH,EAAe,sBAAsB,EAAE,GAAGF,CAAsB,EACrEK,EAAKH,EAAe,yBAAyB,EAAE,GAC7CR,CACF,EACAW,EAAKH,EAAe,+BAA+B,EAAE,GACnDN,CACF,EACAS,EAAKH,EAAe,8BAA8B,EAAE,GAClDL,CACF,EACAQ,EAAKH,EAAe,2BAA2B,EAAE,GAC/CP,CACF,EAEIS,IACFE,EAAWJ,EAAe,cAAc,EAAE,GAAGD,CAAW,EACxDK,EAAWJ,EAAe,iBAAiB,EAAE,GAAGD,CAAW,EAC3DK,EAAWJ,EAAe,uBAAuB,EAAE,GAAGD,CAAW,EACjEK,EAAWJ,EAAe,sBAAsB,EAAE,GAAGD,CAAW,EAChEK,EAAWJ,EAAe,yBAAyB,EAAE,GAAGD,CAAW,EACnEK,EAAWJ,EAAe,+BAA+B,EAAE,GACzDD,CACF,EACAK,EAAWJ,EAAe,8BAA8B,EAAE,GAAGD,CAAW,EACxEK,EAAWJ,EAAe,2BAA2B,EAAE,GAAGD,CAAW,EAEzE,CAAC",
6
+ "names": ["ContainerModule", "ConnectUseCase", "DisconnectUseCase", "GetConnectedDeviceUseCase", "ListConnectedDevicesUseCase", "ListenToAvailableDevicesUseCase", "ListenToConnectedDeviceUseCase", "ReconnectUseCase", "StartDiscoveringUseCase", "StopDiscoveringUseCase", "StubUseCase", "discoveryTypes", "discoveryModuleFactory", "stub", "bind", "rebindSync"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Container as p}from"inversify";import{TransportMock as f}from"../../../api/transport/model/__mocks__/TransportMock";import{deviceModelModuleFactory as l}from"../../device-model/di/deviceModelModule";import{deviceSessionModuleFactory as d}from"../../device-session/di/deviceSessionModule";import{ConnectUseCase as C}from"../../discovery/use-case/ConnectUseCase";import{DisconnectUseCase as v}from"../../discovery/use-case/DisconnectUseCase";import{ListConnectedDevicesUseCase as u}from"../../discovery/use-case/ListConnectedDevicesUseCase";import{ListenToAvailableDevicesUseCase as g}from"../../discovery/use-case/ListenToAvailableDevicesUseCase";import{StartDiscoveringUseCase as U}from"../../discovery/use-case/StartDiscoveringUseCase";import{StopDiscoveringUseCase as y}from"../../discovery/use-case/StopDiscoveringUseCase";import{loggerModuleFactory as D}from"../../logger-publisher/di/loggerModule";import{managerApiModuleFactory as k}from"../../manager-api/di/managerApiModule";import{secureChannelModuleFactory as M}from"../../secure-channel/di/secureChannelModule";import{transportModuleFactory as b}from"../../transport/di/transportModule";import{discoveryModuleFactory as F}from"./discoveryModule";import{discoveryTypes as o}from"./discoveryTypes";describe("discoveryModuleFactory",()=>{let e,t,s;beforeEach(()=>{t=F({stub:!1}),e=new p,s=new f,e.loadSync(t,D(),l({stub:!1}),d(),b({transports:[vi.fn().mockImplementation(()=>s)]}),k({config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url"}}),M({config:{webSocketUrl:"http://fake-websocket.url"}}))}),it("should return the device module",()=>{expect(t).toBeDefined()}),it("should return none mocked use cases",()=>{const r=e.get(o.StartDiscoveringUseCase);expect(r).toBeInstanceOf(U);const n=e.get(o.StopDiscoveringUseCase);expect(n).toBeInstanceOf(y);const c=e.get(o.DisconnectUseCase);expect(c).toBeInstanceOf(v);const i=e.get(o.ConnectUseCase);expect(i).toBeInstanceOf(C);const a=e.get(o.ListenToAvailableDevicesUseCase);expect(a).toBeInstanceOf(g);const m=e.get(o.ListConnectedDevicesUseCase);expect(m).toBeInstanceOf(u)})});
1
+ import{Container as f}from"inversify";import{TransportMock as l}from"../../../api/transport/model/__mocks__/TransportMock";import{deviceModelModuleFactory as C}from"../../device-model/di/deviceModelModule";import{deviceSessionModuleFactory as d}from"../../device-session/di/deviceSessionModule";import{ConnectUseCase as U}from"../../discovery/use-case/ConnectUseCase";import{DisconnectUseCase as v}from"../../discovery/use-case/DisconnectUseCase";import{ListConnectedDevicesUseCase as g}from"../../discovery/use-case/ListConnectedDevicesUseCase";import{ListenToAvailableDevicesUseCase as u}from"../../discovery/use-case/ListenToAvailableDevicesUseCase";import{ReconnectUseCase as y}from"../../discovery/use-case/ReconnectUseCase";import{StartDiscoveringUseCase as D}from"../../discovery/use-case/StartDiscoveringUseCase";import{StopDiscoveringUseCase as k}from"../../discovery/use-case/StopDiscoveringUseCase";import{loggerModuleFactory as M}from"../../logger-publisher/di/loggerModule";import{managerApiModuleFactory as b}from"../../manager-api/di/managerApiModule";import{secureChannelModuleFactory as F}from"../../secure-channel/di/secureChannelModule";import{transportModuleFactory as h}from"../../transport/di/transportModule";import{discoveryModuleFactory as x}from"./discoveryModule";import{discoveryTypes as o}from"./discoveryTypes";describe("discoveryModuleFactory",()=>{let e,t,s;beforeEach(()=>{t=x({stub:!1}),e=new f,s=new l,e.loadSync(t,M(),C({stub:!1}),d(),h({transports:[vi.fn().mockImplementation(()=>s)]}),b({config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url"}}),F({config:{webSocketUrl:"http://fake-websocket.url"}}))}),it("should return the device module",()=>{expect(t).toBeDefined()}),it("should return none mocked use cases",()=>{const r=e.get(o.StartDiscoveringUseCase);expect(r).toBeInstanceOf(D);const n=e.get(o.StopDiscoveringUseCase);expect(n).toBeInstanceOf(k);const c=e.get(o.DisconnectUseCase);expect(c).toBeInstanceOf(v);const i=e.get(o.ConnectUseCase);expect(i).toBeInstanceOf(U);const a=e.get(o.ListenToAvailableDevicesUseCase);expect(a).toBeInstanceOf(u);const m=e.get(o.ListConnectedDevicesUseCase);expect(m).toBeInstanceOf(g);const p=e.get(o.ReconnectUseCase);expect(p).toBeInstanceOf(y)})});
2
2
  //# sourceMappingURL=discoveryModule.test.js.map