@ledgerhq/device-management-kit 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/README.md +0 -3
  2. package/lib/cjs/package.json +1 -1
  3. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  4. package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  5. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
  6. package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  7. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  8. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +3 -3
  9. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  10. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
  11. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/types.js +1 -1
  12. package/lib/cjs/src/api/device-action/os/GetDeviceStatus/types.js.map +2 -2
  13. package/lib/cjs/src/api/device-action/os/InstallLanguagePackage/types.js +1 -1
  14. package/lib/cjs/src/api/device-action/os/InstallLanguagePackage/types.js.map +3 -3
  15. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  16. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +2 -2
  17. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  18. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
  19. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -1
  20. package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js.map +1 -1
  21. package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +1 -1
  22. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
  23. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js.map +3 -3
  24. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js +1 -1
  25. package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +3 -3
  26. package/lib/cjs/src/api/index.js +1 -1
  27. package/lib/cjs/src/api/index.js.map +3 -3
  28. package/lib/cjs/src/api/types.js +1 -1
  29. package/lib/cjs/src/api/types.js.map +3 -3
  30. package/lib/cjs/src/api/utils/apduLogs.js +1 -1
  31. package/lib/cjs/src/api/utils/apduLogs.js.map +3 -3
  32. package/lib/cjs/src/api/utils/apduLogs.test.js +1 -1
  33. package/lib/cjs/src/api/utils/apduLogs.test.js.map +3 -3
  34. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  35. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
  36. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  37. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js.map +2 -2
  38. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  39. package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
  40. package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.js +1 -1
  41. package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.js.map +2 -2
  42. package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.test.js +1 -1
  43. package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.test.js.map +2 -2
  44. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
  45. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
  46. package/lib/cjs/src/internal/manager-api/model/Const.js +1 -1
  47. package/lib/cjs/src/internal/manager-api/model/Const.js.map +1 -1
  48. package/lib/cjs/src/internal/manager-api/model/Firmware.js +1 -1
  49. package/lib/cjs/src/internal/manager-api/model/Firmware.js.map +1 -1
  50. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  51. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +2 -2
  52. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  53. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  54. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
  55. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
  56. package/lib/cjs/src/internal/secure-channel/model/Errors.js +1 -1
  57. package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +2 -2
  58. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
  59. package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
  60. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js +1 -1
  61. package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js.map +1 -1
  62. package/lib/esm/package.json +1 -1
  63. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
  64. package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
  65. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
  66. package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
  67. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
  68. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +3 -3
  69. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
  70. package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
  71. package/lib/esm/src/api/device-action/os/GetDeviceStatus/types.js +1 -1
  72. package/lib/esm/src/api/device-action/os/GetDeviceStatus/types.js.map +2 -2
  73. package/lib/esm/src/api/device-action/os/InstallLanguagePackage/types.js +1 -1
  74. package/lib/esm/src/api/device-action/os/InstallLanguagePackage/types.js.map +3 -3
  75. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
  76. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +2 -2
  77. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
  78. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
  79. package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/types.js.map +1 -1
  80. package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js.map +1 -1
  81. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
  82. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js.map +3 -3
  83. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js +1 -1
  84. package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +3 -3
  85. package/lib/esm/src/api/index.js +1 -1
  86. package/lib/esm/src/api/index.js.map +3 -3
  87. package/lib/esm/src/api/types.js +1 -0
  88. package/lib/esm/src/api/types.js.map +4 -4
  89. package/lib/esm/src/api/utils/apduLogs.js +1 -1
  90. package/lib/esm/src/api/utils/apduLogs.js.map +3 -3
  91. package/lib/esm/src/api/utils/apduLogs.test.js +1 -1
  92. package/lib/esm/src/api/utils/apduLogs.test.js.map +3 -3
  93. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  94. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
  95. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
  96. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js.map +2 -2
  97. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
  98. package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
  99. package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.js +1 -1
  100. package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.js.map +3 -3
  101. package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.test.js +1 -1
  102. package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.test.js.map +3 -3
  103. package/lib/esm/src/internal/manager-api/model/Const.js +1 -1
  104. package/lib/esm/src/internal/manager-api/model/Const.js.map +1 -1
  105. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  106. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +2 -2
  107. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  108. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
  109. package/lib/esm/src/internal/secure-channel/model/Errors.js +1 -1
  110. package/lib/esm/src/internal/secure-channel/model/Errors.js.map +3 -3
  111. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
  112. package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
  113. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts +3 -0
  114. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
  115. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +3 -1
  116. package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
  117. package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts +0 -9
  118. package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
  119. package/lib/types/src/api/device-action/os/GetDeviceStatus/types.d.ts +5 -4
  120. package/lib/types/src/api/device-action/os/GetDeviceStatus/types.d.ts.map +1 -1
  121. package/lib/types/src/api/device-action/os/InstallLanguagePackage/types.d.ts +1 -0
  122. package/lib/types/src/api/device-action/os/InstallLanguagePackage/types.d.ts.map +1 -1
  123. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts.map +1 -1
  124. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts +1 -1
  125. package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
  126. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +1 -1
  127. package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -1
  128. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts +2 -0
  129. package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts.map +1 -1
  130. package/lib/types/src/api/index.d.ts +3 -4
  131. package/lib/types/src/api/index.d.ts.map +1 -1
  132. package/lib/types/src/api/types.d.ts +1 -1
  133. package/lib/types/src/api/types.d.ts.map +1 -1
  134. package/lib/types/src/api/utils/apduLogs.d.ts +15 -0
  135. package/lib/types/src/api/utils/apduLogs.d.ts.map +1 -1
  136. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  137. package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts.map +1 -1
  138. package/lib/types/src/internal/manager-api/data/HttpManagerApiDataSource.d.ts +2 -2
  139. package/lib/types/src/internal/manager-api/data/HttpManagerApiDataSource.d.ts.map +1 -1
  140. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +4 -4
  141. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
  142. package/lib/types/src/internal/manager-api/model/Const.d.ts +1 -1
  143. package/lib/types/src/internal/manager-api/model/Firmware.d.ts +3 -0
  144. package/lib/types/src/internal/manager-api/model/Firmware.d.ts.map +1 -1
  145. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +2 -1
  146. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
  147. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +9 -3
  148. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
  149. package/lib/types/src/internal/secure-channel/model/Errors.d.ts +8 -1
  150. package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -1
  151. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +1 -1
  152. package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts.map +1 -1
  153. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts +2 -2
  154. package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -1
  155. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  156. package/package.json +4 -4
  157. package/lib/cjs/src/api/command/os/BackupStorageCommand.js +0 -2
  158. package/lib/cjs/src/api/command/os/BackupStorageCommand.js.map +0 -7
  159. package/lib/cjs/src/api/command/os/BackupStorageCommand.test.js +0 -2
  160. package/lib/cjs/src/api/command/os/BackupStorageCommand.test.js.map +0 -7
  161. package/lib/cjs/src/api/command/os/GetAppStorageInfoCommand.js +0 -2
  162. package/lib/cjs/src/api/command/os/GetAppStorageInfoCommand.js.map +0 -7
  163. package/lib/cjs/src/api/command/os/GetAppStorageInfoCommand.test.js +0 -2
  164. package/lib/cjs/src/api/command/os/GetAppStorageInfoCommand.test.js.map +0 -7
  165. package/lib/cjs/src/api/device-action/task/BackupAppStorageTask.js +0 -2
  166. package/lib/cjs/src/api/device-action/task/BackupAppStorageTask.js.map +0 -7
  167. package/lib/cjs/src/api/device-action/task/BackupAppStorageTask.test.js +0 -2
  168. package/lib/cjs/src/api/device-action/task/BackupAppStorageTask.test.js.map +0 -7
  169. package/lib/cjs/src/api/storage/KeyValueStorage.js +0 -2
  170. package/lib/cjs/src/api/storage/KeyValueStorage.js.map +0 -7
  171. package/lib/esm/src/api/command/os/BackupStorageCommand.js +0 -2
  172. package/lib/esm/src/api/command/os/BackupStorageCommand.js.map +0 -7
  173. package/lib/esm/src/api/command/os/BackupStorageCommand.test.js +0 -2
  174. package/lib/esm/src/api/command/os/BackupStorageCommand.test.js.map +0 -7
  175. package/lib/esm/src/api/command/os/GetAppStorageInfoCommand.js +0 -2
  176. package/lib/esm/src/api/command/os/GetAppStorageInfoCommand.js.map +0 -7
  177. package/lib/esm/src/api/command/os/GetAppStorageInfoCommand.test.js +0 -2
  178. package/lib/esm/src/api/command/os/GetAppStorageInfoCommand.test.js.map +0 -7
  179. package/lib/esm/src/api/device-action/task/BackupAppStorageTask.js +0 -2
  180. package/lib/esm/src/api/device-action/task/BackupAppStorageTask.js.map +0 -7
  181. package/lib/esm/src/api/device-action/task/BackupAppStorageTask.test.js +0 -2
  182. package/lib/esm/src/api/device-action/task/BackupAppStorageTask.test.js.map +0 -7
  183. package/lib/esm/src/api/storage/KeyValueStorage.js +0 -2
  184. package/lib/esm/src/api/storage/KeyValueStorage.js.map +0 -7
  185. package/lib/types/src/api/command/os/BackupStorageCommand.d.ts +0 -23
  186. package/lib/types/src/api/command/os/BackupStorageCommand.d.ts.map +0 -1
  187. package/lib/types/src/api/command/os/BackupStorageCommand.test.d.ts +0 -2
  188. package/lib/types/src/api/command/os/BackupStorageCommand.test.d.ts.map +0 -1
  189. package/lib/types/src/api/command/os/GetAppStorageInfoCommand.d.ts +0 -31
  190. package/lib/types/src/api/command/os/GetAppStorageInfoCommand.d.ts.map +0 -1
  191. package/lib/types/src/api/command/os/GetAppStorageInfoCommand.test.d.ts +0 -2
  192. package/lib/types/src/api/command/os/GetAppStorageInfoCommand.test.d.ts.map +0 -1
  193. package/lib/types/src/api/device-action/task/BackupAppStorageTask.d.ts +0 -23
  194. package/lib/types/src/api/device-action/task/BackupAppStorageTask.d.ts.map +0 -1
  195. package/lib/types/src/api/device-action/task/BackupAppStorageTask.test.d.ts +0 -2
  196. package/lib/types/src/api/device-action/task/BackupAppStorageTask.test.d.ts.map +0 -1
  197. package/lib/types/src/api/storage/KeyValueStorage.d.ts +0 -7
  198. package/lib/types/src/api/storage/KeyValueStorage.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/manager-api/service/DefaultManagerApiService.test.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { type Mocked } from \"vitest\";\n\nimport { getOsVersionCommandResponseMockBuilder } from \"@api/command/os/__mocks__/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport {\n BTC_APP,\n BTC_APP_METADATA,\n ETH_APP,\n ETH_APP_METADATA,\n} from \"@api/device-action/__test-utils__/data\";\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { HttpManagerApiDataSource } from \"@internal/manager-api/data/HttpManagerApiDataSource\";\nimport { HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\nimport {\n type FinalFirmware,\n type OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\n\nimport { DefaultManagerApiService } from \"./DefaultManagerApiService\";\nimport { type ManagerApiService } from \"./ManagerApiService\";\n\nvi.mock(\"@internal/manager-api/data/HttpManagerApiDataSource\");\nlet dataSource: Mocked<HttpManagerApiDataSource>;\nlet service: ManagerApiService;\ndescribe(\"ManagerApiService\", () => {\n beforeEach(() => {\n dataSource = new HttpManagerApiDataSource(\n {} as DmkConfig,\n ) as Mocked<HttpManagerApiDataSource>;\n service = new DefaultManagerApiService(dataSource);\n });\n\n describe(\"getAppList\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const deviceInfo = getOsVersionCommandResponseMockBuilder(\n DeviceModelId.STAX,\n );\n // when\n service.getAppList(deviceInfo);\n // then\n expect(dataSource.getAppList).toHaveBeenCalledWith({\n targetId: \"857735172\",\n firmwareVersionName: \"1.3.0\",\n });\n });\n });\n\n describe(\"getAppsByHash\", () => {\n describe(\"success cases\", () => {\n it(\"with no apps, should return an empty list\", async () => {\n dataSource.getAppsByHash.mockResolvedValue(Right([]));\n expect(await service.getAppsByHash([])).toEqual(Right([]));\n });\n\n it(\"with one app, should return the metadata\", async () => {\n dataSource.getAppsByHash.mockResolvedValue(Right([BTC_APP_METADATA]));\n expect(await service.getAppsByHash([BTC_APP.appFullHash])).toEqual(\n Right([BTC_APP_METADATA]),\n );\n });\n\n it(\"with two app, should return the metadata of both apps\", async () => {\n dataSource.getAppsByHash.mockResolvedValue(\n Right([BTC_APP_METADATA, ETH_APP_METADATA]),\n );\n expect(\n await service.getAppsByHash(\n [BTC_APP, ETH_APP].map((app) => app.appFullHash),\n ),\n ).toEqual(Right([BTC_APP_METADATA, ETH_APP_METADATA]));\n });\n\n it(\"with one app and one without `appFullHash`, should return the metadata of the correct app\", async () => {\n dataSource.getAppsByHash.mockResolvedValue(Right([BTC_APP_METADATA]));\n const APP_WITH_NO_HASH = { ...ETH_APP, appFullHash: \"\" };\n expect(\n await service.getAppsByHash(\n [BTC_APP, APP_WITH_NO_HASH].map((app) => app.appFullHash),\n ),\n ).toEqual(Right([BTC_APP_METADATA]));\n });\n });\n\n describe(\"error cases\", () => {\n it(\"should return an error when the data source fails with a known error\", async () => {\n const error = new HttpFetchApiError(new Error(\"Failed to fetch data\"));\n dataSource.getAppsByHash.mockRejectedValue(error);\n expect(await service.getAppsByHash([BTC_APP.appFullHash])).toEqual(\n Left(error),\n );\n });\n\n it(\"should return an error when the data source fails with an unknown error\", async () => {\n const error = new Error(\"unkown error\");\n dataSource.getAppsByHash.mockRejectedValue(error);\n expect(await service.getAppsByHash([BTC_APP.appFullHash])).toEqual(\n Left(new HttpFetchApiError(error)),\n );\n });\n });\n });\n\n describe(\"getDeviceVersion\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const deviceInfo = getOsVersionCommandResponseMockBuilder(\n DeviceModelId.STAX,\n );\n // when\n service.getDeviceVersion(deviceInfo);\n // then\n expect(dataSource.getDeviceVersion).toHaveBeenCalledWith({\n targetId: \"857735172\",\n });\n });\n });\n\n describe(\"getFirmwareVersion\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const mockGetDeviceVersion = {\n id: 17,\n target_id: \"857735172\",\n };\n const deviceInfo = getOsVersionCommandResponseMockBuilder(\n DeviceModelId.STAX,\n );\n // when\n service.getFirmwareVersion(deviceInfo, mockGetDeviceVersion);\n // then\n expect(dataSource.getFirmwareVersion).toHaveBeenCalledWith({\n deviceId: 17,\n version: \"1.3.0\",\n });\n });\n });\n\n describe(\"getOsuFirmwareVersion\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const mockGetDeviceVersion = {\n id: 17,\n target_id: \"857735172\",\n };\n const deviceInfo = getOsVersionCommandResponseMockBuilder(\n DeviceModelId.STAX,\n );\n // when\n service.getOsuFirmwareVersion(deviceInfo, mockGetDeviceVersion);\n // then\n expect(dataSource.getOsuFirmwareVersion).toHaveBeenCalledWith({\n deviceId: 17,\n version: \"1.3.0\",\n });\n });\n });\n\n describe(\"getLatestFirmwareVersion\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const deviceVersion = {\n id: 17,\n target_id: \"857735172\",\n };\n const currentFirmware = {\n id: 159,\n } as FinalFirmware;\n // when\n service.getLatestFirmwareVersion(currentFirmware, deviceVersion);\n // then\n expect(dataSource.getLatestFirmwareVersion).toHaveBeenCalledWith({\n currentFinalFirmwareId: 159,\n deviceId: 17,\n });\n });\n });\n\n describe(\"getNextFirmwareVersion\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const osuFirmware = {\n nextFinalFirmware: 159,\n } as OsuFirmware;\n // when\n service.getNextFirmwareVersion(osuFirmware);\n // then\n expect(dataSource.getFirmwareVersionById).toHaveBeenCalledWith(159);\n });\n });\n\n describe(\"getLanguagePackages\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const deviceVersion = {\n id: 17,\n target_id: \"857735172\",\n };\n const currentFirmware = {\n id: 159,\n } as FinalFirmware;\n // when\n service.getLanguagePackages(deviceVersion, currentFirmware);\n // then\n expect(dataSource.getLanguagePackages).toHaveBeenCalledWith({\n deviceId: 17,\n currentFinalFirmwareId: 159,\n });\n });\n });\n\n describe(\"getMcuList\", () => {\n it(\"should call api with the correct parameters\", () => {\n // when\n service.getMcuList();\n // then\n expect(dataSource.getMcuList).toHaveBeenCalled();\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA4B,qBAG5BC,EAAuD,yDACvDC,EAA8B,mCAC9BC,EAKO,kDAEPC,EAAyC,+DACzCC,EAAkC,8CAMlCC,EAAyC,sCAGzC,GAAG,KAAK,qDAAqD,EAC7D,IAAIC,EACAC,EACJ,SAAS,oBAAqB,IAAM,CAClC,WAAW,IAAM,CACfD,EAAa,IAAI,2BACf,CAAC,CACH,EACAC,EAAU,IAAI,2BAAyBD,CAAU,CACnD,CAAC,EAED,SAAS,aAAc,IAAM,CAC3B,GAAG,8CAA+C,IAAM,CAEtD,MAAME,KAAa,0CACjB,gBAAc,IAChB,EAEAD,EAAQ,WAAWC,CAAU,EAE7B,OAAOF,EAAW,UAAU,EAAE,qBAAqB,CACjD,SAAU,YACV,oBAAqB,OACvB,CAAC,CACH,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,SAAS,gBAAiB,IAAM,CAC9B,GAAG,4CAA6C,SAAY,CAC1DA,EAAW,cAAc,qBAAkB,SAAM,CAAC,CAAC,CAAC,EACpD,OAAO,MAAMC,EAAQ,cAAc,CAAC,CAAC,CAAC,EAAE,WAAQ,SAAM,CAAC,CAAC,CAAC,CAC3D,CAAC,EAED,GAAG,2CAA4C,SAAY,CACzDD,EAAW,cAAc,qBAAkB,SAAM,CAAC,kBAAgB,CAAC,CAAC,EACpE,OAAO,MAAMC,EAAQ,cAAc,CAAC,UAAQ,WAAW,CAAC,CAAC,EAAE,WACzD,SAAM,CAAC,kBAAgB,CAAC,CAC1B,CACF,CAAC,EAED,GAAG,wDAAyD,SAAY,CACtED,EAAW,cAAc,qBACvB,SAAM,CAAC,mBAAkB,kBAA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CAAC,CACH,CAAC,EAED,SAAS,aAAc,IAAM,CAC3B,GAAG,8CAA+C,IAAM,CAEtDC,EAAQ,WAAW,EAEnB,OAAOD,EAAW,UAAU,EAAE,iBAAiB,CACjD,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_purify_ts", "import_GetOsVersionCommand", "import_DeviceModel", "import_data", "import_HttpManagerApiDataSource", "import_Errors", "import_DefaultManagerApiService", "dataSource", "service", "deviceInfo", "app", "APP_WITH_NO_HASH", "error", "mockGetDeviceVersion", "deviceVersion", "currentFirmware", "osuFirmware"]
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { type Mocked } from \"vitest\";\n\nimport { getOsVersionCommandResponseMockBuilder } from \"@api/command/os/__mocks__/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport {\n BTC_APP,\n BTC_APP_METADATA,\n ETH_APP,\n ETH_APP_METADATA,\n} from \"@api/device-action/__test-utils__/data\";\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { HttpManagerApiDataSource } from \"@internal/manager-api/data/HttpManagerApiDataSource\";\nimport { HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\nimport {\n type FinalFirmware,\n type OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\n\nimport { DefaultManagerApiService } from \"./DefaultManagerApiService\";\nimport { type ManagerApiService } from \"./ManagerApiService\";\n\nvi.mock(\"@internal/manager-api/data/HttpManagerApiDataSource\");\nlet dataSource: Mocked<HttpManagerApiDataSource>;\nlet service: ManagerApiService;\ndescribe(\"ManagerApiService\", () => {\n beforeEach(() => {\n dataSource = new HttpManagerApiDataSource(\n {} as DmkConfig,\n ) as Mocked<HttpManagerApiDataSource>;\n service = new DefaultManagerApiService(dataSource);\n });\n\n describe(\"getAppList\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const deviceInfo = getOsVersionCommandResponseMockBuilder(\n DeviceModelId.STAX,\n );\n // when\n service.getAppList(deviceInfo);\n // then\n expect(dataSource.getAppList).toHaveBeenCalledWith({\n targetId: \"857735172\",\n firmwareVersionName: \"1.3.0\",\n });\n });\n });\n\n describe(\"getAppsByHash\", () => {\n describe(\"success cases\", () => {\n it(\"with no apps, should return an empty list\", async () => {\n dataSource.getAppsByHash.mockResolvedValue(Right([]));\n expect(await service.getAppsByHash([])).toEqual(Right([]));\n });\n\n it(\"with one app, should return the metadata\", async () => {\n dataSource.getAppsByHash.mockResolvedValue(Right([BTC_APP_METADATA]));\n expect(await service.getAppsByHash([BTC_APP.appFullHash])).toEqual(\n Right([BTC_APP_METADATA]),\n );\n });\n\n it(\"with two app, should return the metadata of both apps\", async () => {\n dataSource.getAppsByHash.mockResolvedValue(\n Right([BTC_APP_METADATA, ETH_APP_METADATA]),\n );\n expect(\n await service.getAppsByHash(\n [BTC_APP, ETH_APP].map((app) => app.appFullHash),\n ),\n ).toEqual(Right([BTC_APP_METADATA, ETH_APP_METADATA]));\n });\n\n it(\"with one app and one without `appFullHash`, should return the metadata of the correct app\", async () => {\n dataSource.getAppsByHash.mockResolvedValue(Right([BTC_APP_METADATA]));\n const APP_WITH_NO_HASH = { ...ETH_APP, appFullHash: \"\" };\n expect(\n await service.getAppsByHash(\n [BTC_APP, APP_WITH_NO_HASH].map((app) => app.appFullHash),\n ),\n ).toEqual(Right([BTC_APP_METADATA]));\n });\n });\n\n describe(\"error cases\", () => {\n it(\"should return an error when the data source fails with a known error\", async () => {\n const error = new HttpFetchApiError(new Error(\"Failed to fetch data\"));\n dataSource.getAppsByHash.mockRejectedValue(error);\n expect(await service.getAppsByHash([BTC_APP.appFullHash])).toEqual(\n Left(error),\n );\n });\n\n it(\"should return an error when the data source fails with an unknown error\", async () => {\n const error = new Error(\"unkown error\");\n dataSource.getAppsByHash.mockRejectedValue(error);\n expect(await service.getAppsByHash([BTC_APP.appFullHash])).toEqual(\n Left(new HttpFetchApiError(error)),\n );\n });\n });\n });\n\n describe(\"getDeviceVersion\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const deviceInfo = getOsVersionCommandResponseMockBuilder(\n DeviceModelId.STAX,\n );\n // when\n service.getDeviceVersion(deviceInfo);\n // then\n expect(dataSource.getDeviceVersion).toHaveBeenCalledWith({\n targetId: \"857735172\",\n });\n });\n });\n\n describe(\"getFirmwareVersion\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const mockGetDeviceVersion = {\n id: 17,\n target_id: \"857735172\",\n };\n const deviceInfo = getOsVersionCommandResponseMockBuilder(\n DeviceModelId.STAX,\n );\n // when\n service.getFirmwareVersion(deviceInfo, mockGetDeviceVersion);\n // then\n expect(dataSource.getFirmwareVersion).toHaveBeenCalledWith({\n deviceId: 17,\n version: \"1.3.0\",\n });\n });\n });\n\n describe(\"getOsuFirmwareVersion\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const mockGetDeviceVersion = {\n id: 17,\n target_id: \"857735172\",\n };\n const deviceInfo = getOsVersionCommandResponseMockBuilder(\n DeviceModelId.STAX,\n );\n // when\n service.getOsuFirmwareVersion(deviceInfo, mockGetDeviceVersion);\n // then\n expect(dataSource.getOsuFirmwareVersion).toHaveBeenCalledWith({\n deviceId: 17,\n version: \"1.3.0\",\n });\n });\n });\n\n describe(\"getLatestFirmwareVersion\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const deviceVersion = {\n id: 17,\n target_id: \"857735172\",\n };\n const currentFirmware = {\n id: 159,\n } as FinalFirmware;\n // when\n service.getLatestFirmwareVersion(currentFirmware, deviceVersion);\n // then\n expect(dataSource.getLatestFirmwareVersion).toHaveBeenCalledWith({\n currentFinalFirmwareId: 159,\n deviceId: 17,\n });\n });\n });\n\n describe(\"getNextFirmwareVersion\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const osuFirmware = {\n nextFinalFirmware: 159,\n } as OsuFirmware;\n // when\n service.getNextFirmwareVersion(osuFirmware);\n // then\n expect(dataSource.getFirmwareVersionById).toHaveBeenCalledWith(159);\n });\n });\n\n describe(\"getLanguagePackages\", () => {\n it(\"should call api with the correct parameters\", () => {\n // given\n const deviceVersion = {\n id: 17,\n target_id: \"857735172\",\n };\n const currentFirmware = {\n id: 159,\n } as FinalFirmware;\n // when\n service.getLanguagePackages(deviceVersion, currentFirmware);\n // then\n expect(dataSource.getLanguagePackages).toHaveBeenCalledWith({\n deviceId: 17,\n currentFinalFirmwareId: 159,\n });\n });\n });\n\n describe(\"getMcuList\", () => {\n it(\"should call api with the correct parameters\", () => {\n // when\n service.getMcuList();\n // then\n expect(dataSource.getMcuList).toHaveBeenCalled();\n });\n });\n\n describe(\"getProvider\", () => {\n it(\"should return the provider\", () => {\n // given\n dataSource.getProvider.mockReturnValue(1);\n // when\n const provider = service.getProvider();\n // then\n expect(provider).toEqual(1);\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA4B,qBAG5BC,EAAuD,yDACvDC,EAA8B,mCAC9BC,EAKO,kDAEPC,EAAyC,+DACzCC,EAAkC,8CAMlCC,EAAyC,sCAGzC,GAAG,KAAK,qDAAqD,EAC7D,IAAIC,EACAC,EACJ,SAAS,oBAAqB,IAAM,CAClC,WAAW,IAAM,CACfD,EAAa,IAAI,2BACf,CAAC,CACH,EACAC,EAAU,IAAI,2BAAyBD,CAAU,CACnD,CAAC,EAED,SAAS,aAAc,IAAM,CAC3B,GAAG,8CAA+C,IAAM,CAEtD,MAAME,KAAa,0CACjB,gBAAc,IAChB,EAEAD,EAAQ,WAAWC,CAAU,EAE7B,OAAOF,EAAW,UAAU,EAAE,qBAAqB,CACjD,SAAU,YACV,oBAAqB,OACvB,CAAC,CACH,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,SAAS,gBAAiB,IAAM,CAC9B,GAAG,4CAA6C,SAAY,CAC1DA,EAAW,cAAc,qBAAkB,SAAM,CAAC,CAAC,CAAC,EACpD,OAAO,MAAMC,EAAQ,cAAc,CAAC,CAAC,CAAC,EAAE,WAAQ,SAAM,CAAC,CAAC,CAAC,CAC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AqB,GAAG,CACpE,CAAC,CACH,CAAC,EAED,SAAS,sBAAuB,IAAM,CACpC,GAAG,8CAA+C,IAAM,CAEtD,MAAMO,EAAgB,CACpB,GAAI,GACJ,UAAW,WACb,EACMC,EAAkB,CACtB,GAAI,GACN,EAEAP,EAAQ,oBAAoBM,EAAeC,CAAe,EAE1D,OAAOR,EAAW,mBAAmB,EAAE,qBAAqB,CAC1D,SAAU,GACV,uBAAwB,GAC1B,CAAC,CACH,CAAC,CACH,CAAC,EAED,SAAS,aAAc,IAAM,CAC3B,GAAG,8CAA+C,IAAM,CAEtDC,EAAQ,WAAW,EAEnB,OAAOD,EAAW,UAAU,EAAE,iBAAiB,CACjD,CAAC,CACH,CAAC,EAED,SAAS,cAAe,IAAM,CAC5B,GAAG,6BAA8B,IAAM,CAErCA,EAAW,YAAY,gBAAgB,CAAC,EAExC,MAAMU,EAAWT,EAAQ,YAAY,EAErC,OAAOS,CAAQ,EAAE,QAAQ,CAAC,CAC5B,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_purify_ts", "import_GetOsVersionCommand", "import_DeviceModel", "import_data", "import_HttpManagerApiDataSource", "import_Errors", "import_DefaultManagerApiService", "dataSource", "service", "deviceInfo", "app", "APP_WITH_NO_HASH", "error", "mockGetDeviceVersion", "deviceVersion", "currentFirmware", "osuFirmware", "provider"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var c=(r,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!a.call(r,i)&&i!==o&&s(r,i,{get:()=>e[i],enumerable:!(t=n(e,i))||t.enumerable});return r};var F=r=>c(s({},"__esModule",{value:!0}),r);var m={};module.exports=F(m);
1
+ "use strict";var s=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var c=(r,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!a.call(r,i)&&i!==o&&s(r,i,{get:()=>e[i],enumerable:!(t=n(e,i))||t.enumerable});return r};var m=r=>c(s({},"__esModule",{value:!0}),r);var F={};module.exports=m(F);
2
2
  //# sourceMappingURL=ManagerApiService.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/manager-api/service/ManagerApiService.ts"],
4
- "sourcesContent": ["import { type EitherAsync } from \"purify-ts\";\n\nimport { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { type HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\nimport {\n type FinalFirmware,\n type McuFirmware,\n type OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\nimport { type LanguagePackage } from \"@internal/manager-api/model/Language\";\n\n/**\n * Interface representing the Manager API service.\n */\nexport interface ManagerApiService {\n /**\n * Retrieves the list of applications for a given device.\n *\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or an array of `Application` objects.\n */\n getAppList(\n deviceInfo: GetOsVersionResponse,\n ): EitherAsync<HttpFetchApiError, Array<Application>>;\n\n /**\n * Retrieves applications by their hash values.\n *\n * @param appHashes - An array of application hash values.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or an array of `Application` objects or `null`.\n */\n getAppsByHash(\n appHashes: Array<string>,\n ): EitherAsync<HttpFetchApiError, Array<Application | null>>;\n\n /**\n * Retrieves the device version for a given device.\n *\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or a `DeviceVersion` object.\n */\n getDeviceVersion(\n deviceInfo: GetOsVersionResponse,\n ): EitherAsync<HttpFetchApiError, DeviceVersion>;\n\n /**\n * Retrieves the firmware version for a given device.\n *\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param deviceVersion - Response of the GetDeviceVersion HTTP request.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or a `FinalFirmware` object.\n */\n getFirmwareVersion(\n deviceInfo: GetOsVersionResponse,\n deviceVersion: DeviceVersion,\n ): EitherAsync<HttpFetchApiError, FinalFirmware>;\n\n /**\n * Retrieves an OSU firmware version for a given device.\n *\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param deviceVersion - Response of the GetDeviceVersion HTTP request.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or a `FinalFirmware` object.\n */\n getOsuFirmwareVersion(\n deviceInfo: GetOsVersionResponse,\n deviceVersion: DeviceVersion,\n ): EitherAsync<HttpFetchApiError, OsuFirmware>;\n\n /**\n * Retrieves the latest firmware available for a given device.\n *\n * @param currentFirmware - Current firmware obtained from getFirmwareVersion.\n * @param deviceVersion - Response of the GetDeviceVersion HTTP request.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or a `OsuFirmware` object.\n */\n getLatestFirmwareVersion(\n currentFirmware: FinalFirmware,\n deviceVersion: DeviceVersion,\n ): EitherAsync<HttpFetchApiError, OsuFirmware>;\n\n /**\n * Retrieves the next final firmware following an OSU.\n *\n * @param osuFirmware - OSU firmware from which the next firmware should be fetched.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or a `FinalFirmware` object.\n */\n getNextFirmwareVersion(\n osuFirmware: OsuFirmware,\n ): EitherAsync<HttpFetchApiError, FinalFirmware>;\n\n /**\n * Retrieves the available language packages for a device.\n *\n * @param deviceVersion - Response of the GetDeviceVersion HTTP request.\n * @param currentFirmware - Current firmware obtained from getFirmwareVersion.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or the list of languages.\n */\n getLanguagePackages(\n deviceVersion: DeviceVersion,\n currentFirmware: FinalFirmware,\n ): EitherAsync<HttpFetchApiError, Array<LanguagePackage>>;\n\n /**\n * Retrieves the list of available MCU firmwares.\n *\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or an array of `McuFirmware` objects.\n */\n getMcuList(): EitherAsync<HttpFetchApiError, Array<McuFirmware>>;\n}\n"],
4
+ "sourcesContent": ["import { type EitherAsync, type Maybe } from \"purify-ts\";\n\nimport { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { type HttpFetchApiError } from \"@internal/manager-api/model/Errors\";\nimport {\n type FinalFirmware,\n type McuFirmware,\n type OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\nimport { type LanguagePackage } from \"@internal/manager-api/model/Language\";\n\n/**\n * Interface representing the Manager API service.\n */\nexport interface ManagerApiService {\n /**\n * Retrieves the list of applications for a given device.\n *\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or an array of `Application` objects.\n */\n getAppList(\n deviceInfo: GetOsVersionResponse,\n ): EitherAsync<HttpFetchApiError, Array<Application>>;\n\n /**\n * Retrieves applications by their hash values.\n *\n * @param appHashes - An array of application hash values.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or an array of `Application` objects or `null`.\n */\n getAppsByHash(\n appHashes: Array<string>,\n ): EitherAsync<HttpFetchApiError, Array<Application | null>>;\n\n /**\n * Retrieves the device version for a given device.\n *\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or a `DeviceVersion` object.\n */\n getDeviceVersion(\n deviceInfo: GetOsVersionResponse,\n ): EitherAsync<HttpFetchApiError, DeviceVersion>;\n\n /**\n * Retrieves the firmware version for a given device.\n *\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param deviceVersion - Response of the GetDeviceVersion HTTP request.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or a `FinalFirmware` object.\n */\n getFirmwareVersion(\n deviceInfo: GetOsVersionResponse,\n deviceVersion: DeviceVersion,\n ): EitherAsync<HttpFetchApiError, FinalFirmware>;\n\n /**\n * Retrieves an OSU firmware version for a given device.\n *\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param deviceVersion - Response of the GetDeviceVersion HTTP request.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or a `FinalFirmware` object.\n */\n getOsuFirmwareVersion(\n deviceInfo: GetOsVersionResponse,\n deviceVersion: DeviceVersion,\n ): EitherAsync<HttpFetchApiError, OsuFirmware>;\n\n /**\n * Retrieves the latest firmware available, if any, for a given device.\n *\n * @param currentFirmware - Current firmware obtained from getFirmwareVersion.\n * @param deviceVersion - Response of the GetDeviceVersion HTTP request.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or a `OsuFirmware` object.\n */\n getLatestFirmwareVersion(\n currentFirmware: FinalFirmware,\n deviceVersion: DeviceVersion,\n ): EitherAsync<HttpFetchApiError, Maybe<OsuFirmware>>;\n\n /**\n * Retrieves the next final firmware following an OSU.\n *\n * @param osuFirmware - OSU firmware from which the next firmware should be fetched.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or a `FinalFirmware` object.\n */\n getNextFirmwareVersion(\n osuFirmware: OsuFirmware,\n ): EitherAsync<HttpFetchApiError, FinalFirmware>;\n\n /**\n * Retrieves the available language packages for a device.\n *\n * @param deviceVersion - Response of the GetDeviceVersion HTTP request.\n * @param currentFirmware - Current firmware obtained from getFirmwareVersion.\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or the list of languages.\n */\n getLanguagePackages(\n deviceVersion: DeviceVersion,\n currentFirmware: FinalFirmware,\n ): EitherAsync<HttpFetchApiError, Array<LanguagePackage>>;\n\n /**\n * Retrieves the list of available MCU firmwares.\n *\n * @returns An `EitherAsync` containing either an `HttpFetchApiError` or an array of `McuFirmware` objects.\n */\n getMcuList(): EitherAsync<HttpFetchApiError, Array<McuFirmware>>;\n\n /**\n * Retrieves the provider for the Manager API.\n *\n * @returns The provider for the Manager API.\n */\n getProvider(): number;\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["ManagerApiService_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var p=(n,r)=>{for(var t in r)l(n,t,{get:r[t],enumerable:!0})},d=(n,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of i(r))!E.call(n,s)&&s!==t&&l(n,s,{get:()=>r[s],enumerable:!(a=u(r,s))||a.enumerable});return n};var D=n=>d(l({},"__esModule",{value:!0}),n);var m={};p(m,{SecureChannelError:()=>A,SecureChannelErrorType:()=>c,WebSocketConnectionError:()=>y});module.exports=D(m);var o=require("../../../api/device-action/os/Errors"),c=(e=>(e[e.AppAlreadyInstalled=0]="AppAlreadyInstalled",e[e.DeviceLocked=1]="DeviceLocked",e[e.OutOfMemory=2]="OutOfMemory",e[e.RefusedByUser=3]="RefusedByUser",e[e.Unknown=4]="Unknown",e))(c||{});class y{constructor(r){this.error=r;this.originalError=r}_tag="WebSocketConnectionError";originalError}class A{constructor(r,t=4){this.error=r;this.errorType=t;this.originalError=r}_tag="SecureChannelError";originalError;mapDAErrors(){switch(this.errorType){case 1:return new o.DeviceLockedError;case 3:return new o.RefusedByUserDAError;default:return this}}mapInstallDAErrors(){switch(this.errorType){case 1:return new o.DeviceLockedError;case 3:return new o.RefusedByUserDAError;case 0:return new o.AppAlreadyInstalledDAError;case 2:return new o.OutOfMemoryDAError;default:return this}}}0&&(module.exports={SecureChannelError,SecureChannelErrorType,WebSocketConnectionError});
1
+ "use strict";var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var p=(o,e)=>{for(var t in e)a(o,t,{get:e[t],enumerable:!0})},D=(o,e,t,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!i.call(o,s)&&s!==t&&a(o,s,{get:()=>e[s],enumerable:!(c=l(e,s))||c.enumerable});return o};var d=o=>D(a({},"__esModule",{value:!0}),o);var A={};p(A,{SecureChannelError:()=>y,SecureChannelErrorType:()=>u,WebSocketConnectionError:()=>h});module.exports=d(A);var r=require("../../../api/device-action/os/Errors"),u=(n=>(n[n.AppAlreadyInstalled=0]="AppAlreadyInstalled",n[n.DeviceLocked=1]="DeviceLocked",n[n.OutOfMemory=2]="OutOfMemory",n[n.RefusedByUser=3]="RefusedByUser",n[n.Unknown=4]="Unknown",n))(u||{});class h{constructor(e){this.error=e;this.originalError=e}_tag="WebSocketConnectionError";originalError}class y{constructor(e,t=4){this.error=e;this.errorType=t;this.originalError=e}_tag="SecureChannelError";originalError;mapDAErrors(){switch(this.errorType){case 1:return new r.DeviceLockedError;case 3:return new r.RefusedByUserDAError;default:return this}}mapInstallDAErrors(){switch(this.errorType){case 1:return new r.DeviceLockedError;case 3:return new r.RefusedByUserDAError;case 0:return new r.AppAlreadyInstalledDAError;case 2:return new r.OutOfMemoryDAError;default:return this}}mapUpdateFirmwareDAErrors(){switch(this.errorType){case 2:return new r.OutOfMemoryDAError;case 1:return new r.DeviceLockedError;case 3:return new r.RefusedByUserDAError;case 4:return new r.UnknownDAError;default:return this}}mapFlashMcuDAErrors(){switch(this.errorType){case 1:return new r.DeviceLockedError;case 4:return new r.UnknownDAError;default:return this}}}0&&(module.exports={SecureChannelError,SecureChannelErrorType,WebSocketConnectionError});
2
2
  //# sourceMappingURL=Errors.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/secure-channel/model/Errors.ts"],
4
- "sourcesContent": ["import {\n AppAlreadyInstalledDAError,\n DeviceLockedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n} from \"@api/device-action/os/Errors\";\nimport type { DmkError } from \"@api/Error\";\n\nexport enum SecureChannelErrorType {\n AppAlreadyInstalled,\n DeviceLocked,\n OutOfMemory,\n RefusedByUser,\n Unknown,\n}\n\n/**\n * Errors that can possibly occur during a secure channel operation\n */\nexport type SecureChannelDAErrors =\n | SecureChannelError\n | DeviceLockedError\n | RefusedByUserDAError;\n\n/**\n * Errors that can possibly occur during a secure channel install operation\n * such as installApp or installFirmware\n */\nexport type SecureChannelInstallDAErrors =\n | SecureChannelError\n | AppAlreadyInstalledDAError\n | OutOfMemoryDAError\n | DeviceLockedError\n | RefusedByUserDAError;\n\nexport class WebSocketConnectionError implements DmkError {\n _tag = \"WebSocketConnectionError\";\n originalError?: unknown;\n\n constructor(public readonly error: unknown) {\n this.originalError = error;\n }\n}\n\nexport class SecureChannelError implements DmkError {\n _tag = \"SecureChannelError\";\n originalError?: unknown;\n\n constructor(\n public readonly error: unknown,\n public readonly errorType: SecureChannelErrorType = SecureChannelErrorType.Unknown,\n ) {\n this.originalError = error;\n }\n\n mapDAErrors(): SecureChannelDAErrors {\n switch (this.errorType) {\n case SecureChannelErrorType.DeviceLocked:\n return new DeviceLockedError();\n case SecureChannelErrorType.RefusedByUser:\n return new RefusedByUserDAError();\n default:\n return this;\n }\n }\n\n mapInstallDAErrors(): SecureChannelInstallDAErrors {\n switch (this.errorType) {\n case SecureChannelErrorType.DeviceLocked:\n return new DeviceLockedError();\n case SecureChannelErrorType.RefusedByUser:\n return new RefusedByUserDAError();\n case SecureChannelErrorType.AppAlreadyInstalled:\n return new AppAlreadyInstalledDAError();\n case SecureChannelErrorType.OutOfMemory:\n return new OutOfMemoryDAError();\n default:\n return this;\n }\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,EAAA,2BAAAC,EAAA,6BAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAKO,wCAGKH,OACVA,IAAA,6CACAA,IAAA,+BACAA,IAAA,6BACAA,IAAA,iCACAA,IAAA,qBALUA,OAAA,IA2BL,MAAMC,CAA6C,CAIxD,YAA4BG,EAAgB,CAAhB,WAAAA,EAC1B,KAAK,cAAgBA,CACvB,CALA,KAAO,2BACP,aAKF,CAEO,MAAML,CAAuC,CAIlD,YACkBK,EACAC,EAAoC,EACpD,CAFgB,WAAAD,EACA,eAAAC,EAEhB,KAAK,cAAgBD,CACvB,CARA,KAAO,qBACP,cASA,aAAqC,CACnC,OAAQ,KAAK,UAAW,CACtB,IAAK,GACH,OAAO,IAAI,oBACb,IAAK,GACH,OAAO,IAAI,uBACb,QACE,OAAO,IACX,CACF,CAEA,oBAAmD,CACjD,OAAQ,KAAK,UAAW,CACtB,IAAK,GACH,OAAO,IAAI,oBACb,IAAK,GACH,OAAO,IAAI,uBACb,IAAK,GACH,OAAO,IAAI,6BACb,IAAK,GACH,OAAO,IAAI,qBACb,QACE,OAAO,IACX,CACF,CACF",
4
+ "sourcesContent": ["import {\n AppAlreadyInstalledDAError,\n DeviceLockedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n} from \"@api/device-action/os/Errors\";\nimport type { DmkError } from \"@api/Error\";\n\nexport enum SecureChannelErrorType {\n AppAlreadyInstalled,\n DeviceLocked,\n OutOfMemory,\n RefusedByUser,\n Unknown,\n}\n\n/**\n * Errors that can possibly occur during a secure channel operation\n */\nexport type SecureChannelDAErrors =\n | SecureChannelError\n | DeviceLockedError\n | RefusedByUserDAError;\n\n/**\n * Errors that can possibly occur during a secure channel install operation\n * such as installApp or installFirmware\n */\nexport type SecureChannelInstallDAErrors =\n | SecureChannelError\n | AppAlreadyInstalledDAError\n | OutOfMemoryDAError\n | DeviceLockedError\n | RefusedByUserDAError;\n\n/**\n * Errors that can possibly occur during a secure channel update firmware operation\n */\nexport type SecureChannelUpdateFirmwareDAErrors =\n | SecureChannelError\n | OutOfMemoryDAError\n | DeviceLockedError\n | RefusedByUserDAError\n | UnknownDAError;\n\nexport type SecureChannelFlashMcuDAErrors =\n | SecureChannelError\n | DeviceLockedError\n | UnknownDAError;\n\nexport class WebSocketConnectionError implements DmkError {\n _tag = \"WebSocketConnectionError\";\n originalError?: unknown;\n\n constructor(public readonly error: unknown) {\n this.originalError = error;\n }\n}\n\nexport class SecureChannelError implements DmkError {\n _tag = \"SecureChannelError\";\n originalError?: unknown;\n\n constructor(\n public readonly error: unknown,\n public readonly errorType: SecureChannelErrorType = SecureChannelErrorType.Unknown,\n ) {\n this.originalError = error;\n }\n\n mapDAErrors(): SecureChannelDAErrors {\n switch (this.errorType) {\n case SecureChannelErrorType.DeviceLocked:\n return new DeviceLockedError();\n case SecureChannelErrorType.RefusedByUser:\n return new RefusedByUserDAError();\n default:\n return this;\n }\n }\n\n mapInstallDAErrors(): SecureChannelInstallDAErrors {\n switch (this.errorType) {\n case SecureChannelErrorType.DeviceLocked:\n return new DeviceLockedError();\n case SecureChannelErrorType.RefusedByUser:\n return new RefusedByUserDAError();\n case SecureChannelErrorType.AppAlreadyInstalled:\n return new AppAlreadyInstalledDAError();\n case SecureChannelErrorType.OutOfMemory:\n return new OutOfMemoryDAError();\n default:\n return this;\n }\n }\n\n mapUpdateFirmwareDAErrors(): SecureChannelUpdateFirmwareDAErrors {\n switch (this.errorType) {\n case SecureChannelErrorType.OutOfMemory:\n return new OutOfMemoryDAError();\n case SecureChannelErrorType.DeviceLocked:\n return new DeviceLockedError();\n case SecureChannelErrorType.RefusedByUser:\n return new RefusedByUserDAError();\n case SecureChannelErrorType.Unknown:\n return new UnknownDAError();\n default:\n return this;\n }\n }\n\n mapFlashMcuDAErrors(): SecureChannelFlashMcuDAErrors {\n switch (this.errorType) {\n case SecureChannelErrorType.DeviceLocked:\n return new DeviceLockedError();\n case SecureChannelErrorType.Unknown:\n return new UnknownDAError();\n default:\n return this;\n }\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,EAAA,2BAAAC,EAAA,6BAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAMO,wCAGKH,OACVA,IAAA,6CACAA,IAAA,+BACAA,IAAA,6BACAA,IAAA,iCACAA,IAAA,qBALUA,OAAA,IA0CL,MAAMC,CAA6C,CAIxD,YAA4BG,EAAgB,CAAhB,WAAAA,EAC1B,KAAK,cAAgBA,CACvB,CALA,KAAO,2BACP,aAKF,CAEO,MAAML,CAAuC,CAIlD,YACkBK,EACAC,EAAoC,EACpD,CAFgB,WAAAD,EACA,eAAAC,EAEhB,KAAK,cAAgBD,CACvB,CARA,KAAO,qBACP,cASA,aAAqC,CACnC,OAAQ,KAAK,UAAW,CACtB,IAAK,GACH,OAAO,IAAI,oBACb,IAAK,GACH,OAAO,IAAI,uBACb,QACE,OAAO,IACX,CACF,CAEA,oBAAmD,CACjD,OAAQ,KAAK,UAAW,CACtB,IAAK,GACH,OAAO,IAAI,oBACb,IAAK,GACH,OAAO,IAAI,uBACb,IAAK,GACH,OAAO,IAAI,6BACb,IAAK,GACH,OAAO,IAAI,qBACb,QACE,OAAO,IACX,CACF,CAEA,2BAAiE,CAC/D,OAAQ,KAAK,UAAW,CACtB,IAAK,GACH,OAAO,IAAI,qBACb,IAAK,GACH,OAAO,IAAI,oBACb,IAAK,GACH,OAAO,IAAI,uBACb,IAAK,GACH,OAAO,IAAI,iBACb,QACE,OAAO,IACX,CACF,CAEA,qBAAqD,CACnD,OAAQ,KAAK,UAAW,CACtB,IAAK,GACH,OAAO,IAAI,oBACb,IAAK,GACH,OAAO,IAAI,iBACb,QACE,OAAO,IACX,CACF,CACF",
6
6
  "names": ["Errors_exports", "__export", "SecureChannelError", "SecureChannelErrorType", "WebSocketConnectionError", "__toCommonJS", "import_Errors", "error", "errorType"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var y=(o,e)=>{for(var r in e)p(o,r,{get:e[r],enumerable:!0})},k=(o,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of h(e))!g.call(o,a)&&a!==r&&p(o,a,{get:()=>e[a],enumerable:!(t=l(e,a))||t.enumerable});return o};var f=o=>k(p({},"__esModule",{value:!0}),o),d=(o,e,r,t)=>{for(var a=t>1?void 0:t?l(e,r):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(a=(t?n(e,r,a):n(a))||a);return t&&a&&p(e,r,a),a},u=(o,e)=>(r,t)=>e(r,t,o);var I={};y(I,{DefaultSecureChannelService:()=>i});module.exports=f(I);var c=require("inversify"),S=require("../../secure-channel/di/secureChannelTypes");let i=class{constructor(e){this.dataSource=e}genuineCheck(e,r){const t={targetId:e.targetId.toString(),perso:r.perso};return this.dataSource.genuineCheck(t)}installApp(e,r){const{perso:t,firmware:a,firmwareKey:s,hash:n}=r,m={targetId:e.targetId.toString(),perso:t,firmware:a,firmwareKey:s,hash:n};return this.dataSource.installApp(m)}listInstalledApps(e,r){const t={targetId:e.targetId.toString(),perso:r.perso};return this.dataSource.listInstalledApps(t)}uninstallApp(e,r){const{perso:t,delete:a,deleteKey:s,hash:n}=r,m={targetId:e.targetId.toString(),perso:t,firmware:a,firmwareKey:s,hash:n};return this.dataSource.uninstallApp(m)}updateFirmware(e,r){const t={targetId:e.targetId.toString(),perso:r.perso,firmware:r.firmware,firmwareKey:r.firmwareKey};return this.dataSource.updateFirmware(t)}updateMcu(e,r){const t={targetId:e.targetId.toString(),version:r.version};return this.dataSource.updateMcu(t)}};i=d([(0,c.injectable)(),u(0,(0,c.inject)(S.secureChannelTypes.SecureChannelDataSource))],i);0&&(module.exports={DefaultSecureChannelService});
1
+ "use strict";var p=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var g=(o,e)=>{for(var r in e)p(o,r,{get:e[r],enumerable:!0})},k=(o,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of h(e))!y.call(o,a)&&a!==r&&p(o,a,{get:()=>e[a],enumerable:!(t=l(e,a))||t.enumerable});return o};var w=o=>k(p({},"__esModule",{value:!0}),o),d=(o,e,r,t)=>{for(var a=t>1?void 0:t?l(e,r):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(a=(t?n(e,r,a):n(a))||a);return t&&a&&p(e,r,a),a},u=(o,e)=>(r,t)=>e(r,t,o);var f={};g(f,{DefaultSecureChannelService:()=>i});module.exports=w(f);var m=require("inversify"),S=require("../../secure-channel/di/secureChannelTypes");let i=class{constructor(e){this.dataSource=e}genuineCheck(e,r){const t={targetId:e.targetId.toString(),perso:r.perso};return this.dataSource.genuineCheck(t)}installApp(e,r){const{perso:t,firmware:a,firmwareKey:s,hash:n}=r,c={targetId:e.targetId.toString(),perso:t,firmware:a,firmwareKey:s,hash:n};return this.dataSource.installApp(c)}listInstalledApps(e,r){const t={targetId:e.targetId.toString(),perso:r.perso};return this.dataSource.listInstalledApps(t)}uninstallApp(e,r){const{perso:t,delete:a,deleteKey:s,hash:n}=r,c={targetId:e.targetId.toString(),perso:t,firmware:a,firmwareKey:s,hash:n};return this.dataSource.uninstallApp(c)}updateFirmware(e,r){const t={targetId:e.targetId.toString(),perso:r.perso,firmware:r.firmware,firmwareKey:r.firmwareKey};return this.dataSource.updateFirmware(t)}updateMcu(e,r){const t={targetId:e.targetId.toString(),version:r.version};return this.dataSource.updateMcu(t)}};i=d([(0,m.injectable)(),u(0,(0,m.inject)(S.secureChannelTypes.SecureChannelDataSource))],i);0&&(module.exports={DefaultSecureChannelService});
2
2
  //# sourceMappingURL=DefaultSecureChannelService.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/secure-channel/service/DefaultSecureChannelService.ts"],
4
- "sourcesContent": ["import { inject, injectable } from \"inversify\";\nimport WebSocket from \"isomorphic-ws\";\nimport { Either } from \"purify-ts\";\n\nimport { type GetOsVersionResponse } from \"@api/index\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\nimport {\n type FinalFirmware,\n type OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\nimport { type SecureChannelDataSource } from \"@internal/secure-channel/data/SecureChannelDataSource\";\nimport { secureChannelTypes } from \"@internal/secure-channel/di/secureChannelTypes\";\nimport { WebSocketConnectionError } from \"@internal/secure-channel/model/Errors\";\nimport {\n type GenuineCheckParams,\n type InstallAppsParams,\n type ListInstalledAppsParams,\n type UninstallAppsParams,\n type UpdateFirmwareParams,\n type UpdateMcuParams,\n} from \"@internal/secure-channel/model/Params\";\n\nimport { type SecureChannelService } from \"./SecureChannelService\";\n\n@injectable()\nexport class DefaultSecureChannelService implements SecureChannelService {\n constructor(\n @inject(secureChannelTypes.SecureChannelDataSource)\n private readonly dataSource: SecureChannelDataSource,\n ) {}\n\n genuineCheck(\n deviceInfo: GetOsVersionResponse,\n finalFirmware: FinalFirmware,\n ): Either<WebSocketConnectionError, WebSocket> {\n const params: GenuineCheckParams = {\n targetId: deviceInfo.targetId.toString(),\n perso: finalFirmware.perso,\n };\n return this.dataSource.genuineCheck(params);\n }\n\n installApp(\n deviceInfo: GetOsVersionResponse,\n app: Pick<Application, \"perso\" | \"firmware\" | \"firmwareKey\" | \"hash\">,\n ): Either<WebSocketConnectionError, WebSocket> {\n const { perso, firmware, firmwareKey, hash } = app;\n const params: InstallAppsParams = {\n targetId: deviceInfo.targetId.toString(),\n perso,\n firmware,\n firmwareKey,\n hash,\n };\n return this.dataSource.installApp(params);\n }\n\n listInstalledApps(\n deviceInfo: GetOsVersionResponse,\n finalFirmware: FinalFirmware,\n ): Either<WebSocketConnectionError, WebSocket> {\n const params: ListInstalledAppsParams = {\n targetId: deviceInfo.targetId.toString(),\n perso: finalFirmware.perso,\n };\n return this.dataSource.listInstalledApps(params);\n }\n\n uninstallApp(\n deviceInfo: GetOsVersionResponse,\n app: Pick<Application, \"perso\" | \"delete\" | \"deleteKey\" | \"hash\">,\n ): Either<WebSocketConnectionError, WebSocket> {\n const { perso, delete: appDelete, deleteKey, hash } = app;\n const params: UninstallAppsParams = {\n targetId: deviceInfo.targetId.toString(),\n perso,\n firmware: appDelete,\n firmwareKey: deleteKey,\n hash,\n };\n return this.dataSource.uninstallApp(params);\n }\n\n updateFirmware(\n deviceInfo: GetOsVersionResponse,\n osuFirmware: OsuFirmware,\n ): Either<WebSocketConnectionError, WebSocket> {\n const params: UpdateFirmwareParams = {\n targetId: deviceInfo.targetId.toString(),\n perso: osuFirmware.perso,\n firmware: osuFirmware.firmware,\n firmwareKey: osuFirmware.firmwareKey,\n };\n return this.dataSource.updateFirmware(params);\n }\n\n updateMcu(\n deviceInfo: GetOsVersionResponse,\n param: { version: string },\n ): Either<WebSocketConnectionError, WebSocket> {\n const params: UpdateMcuParams = {\n targetId: deviceInfo.targetId.toString(),\n version: param.version,\n };\n return this.dataSource.updateMcu(params);\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAWnCC,EAAmC,0DAc5B,IAAMC,EAAN,KAAkE,CACvE,YAEmBC,EACjB,CADiB,gBAAAA,CAChB,CAEH,aACEC,EACAC,EAC6C,CAC7C,MAAMC,EAA6B,CACjC,SAAUF,EAAW,SAAS,SAAS,EACvC,MAAOC,EAAc,KACvB,EACA,OAAO,KAAK,WAAW,aAAaC,CAAM,CAC5C,CAEA,WACEF,EACAG,EAC6C,CAC7C,KAAM,CAAE,MAAAC,EAAO,SAAAC,EAAU,YAAAC,EAAa,KAAAC,CAAK,EAAIJ,EACzCD,EAA4B,CAChC,SAAUF,EAAW,SAAS,SAAS,EACvC,MAAAI,EACA,SAAAC,EACA,YAAAC,EACA,KAAAC,CACF,EACA,OAAO,KAAK,WAAW,WAAWL,CAAM,CAC1C,CAEA,kBACEF,EACAC,EAC6C,CAC7C,MAAMC,EAAkC,CACtC,SAAUF,EAAW,SAAS,SAAS,EACvC,MAAOC,EAAc,KACvB,EACA,OAAO,KAAK,WAAW,kBAAkBC,CAAM,CACjD,CAEA,aACEF,EACAG,EAC6C,CAC7C,KAAM,CAAE,MAAAC,EAAO,OAAQI,EAAW,UAAAC,EAAW,KAAAF,CAAK,EAAIJ,EAChDD,EAA8B,CAClC,SAAUF,EAAW,SAAS,SAAS,EACvC,MAAAI,EACA,SAAUI,EACV,YAAaC,EACb,KAAAF,CACF,EACA,OAAO,KAAK,WAAW,aAAaL,CAAM,CAC5C,CAEA,eACEF,EACAU,EAC6C,CAC7C,MAAMR,EAA+B,CACnC,SAAUF,EAAW,SAAS,SAAS,EACvC,MAAOU,EAAY,MACnB,SAAUA,EAAY,SACtB,YAAaA,EAAY,WAC3B,EACA,OAAO,KAAK,WAAW,eAAeR,CAAM,CAC9C,CAEA,UACEF,EACAW,EAC6C,CAC7C,MAAMT,EAA0B,CAC9B,SAAUF,EAAW,SAAS,SAAS,EACvC,QAASW,EAAM,OACjB,EACA,OAAO,KAAK,WAAW,UAAUT,CAAM,CACzC,CACF,EAjFaJ,EAANc,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,qBAAmB,uBAAuB,IAFzCf",
6
- "names": ["DefaultSecureChannelService_exports", "__export", "DefaultSecureChannelService", "__toCommonJS", "import_inversify", "import_secureChannelTypes", "DefaultSecureChannelService", "dataSource", "deviceInfo", "finalFirmware", "params", "app", "perso", "firmware", "firmwareKey", "hash", "appDelete", "deleteKey", "osuFirmware", "param", "__decorateClass", "__decorateParam"]
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\nimport WebSocket from \"isomorphic-ws\";\nimport { Either } from \"purify-ts\";\n\nimport { type GetOsVersionResponse } from \"@api/index\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\nimport {\n type FinalFirmware,\n type OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\nimport { type SecureChannelDataSource } from \"@internal/secure-channel/data/SecureChannelDataSource\";\nimport { secureChannelTypes } from \"@internal/secure-channel/di/secureChannelTypes\";\nimport { WebSocketConnectionError } from \"@internal/secure-channel/model/Errors\";\nimport {\n type GenuineCheckParams,\n type InstallAppsParams,\n type ListInstalledAppsParams,\n type UninstallAppsParams,\n type UpdateFirmwareParams,\n type UpdateMcuParams,\n} from \"@internal/secure-channel/model/Params\";\n\nimport { type SecureChannelService } from \"./SecureChannelService\";\n\n@injectable()\nexport class DefaultSecureChannelService implements SecureChannelService {\n constructor(\n @inject(secureChannelTypes.SecureChannelDataSource)\n private readonly dataSource: SecureChannelDataSource,\n ) {}\n\n genuineCheck(\n deviceInfo: GetOsVersionResponse,\n finalFirmware: FinalFirmware,\n ): Either<WebSocketConnectionError, WebSocket> {\n const params: GenuineCheckParams = {\n targetId: deviceInfo.targetId.toString(),\n perso: finalFirmware.perso,\n };\n return this.dataSource.genuineCheck(params);\n }\n\n installApp(\n deviceInfo: GetOsVersionResponse,\n app: Pick<Application, \"perso\" | \"firmware\" | \"firmwareKey\" | \"hash\">,\n ): Either<WebSocketConnectionError, WebSocket> {\n const { perso, firmware, firmwareKey, hash } = app;\n const params: InstallAppsParams = {\n targetId: deviceInfo.targetId.toString(),\n perso,\n firmware,\n firmwareKey,\n hash,\n };\n return this.dataSource.installApp(params);\n }\n\n listInstalledApps(\n deviceInfo: GetOsVersionResponse,\n finalFirmware: FinalFirmware,\n ): Either<WebSocketConnectionError, WebSocket> {\n const params: ListInstalledAppsParams = {\n targetId: deviceInfo.targetId.toString(),\n perso: finalFirmware.perso,\n };\n return this.dataSource.listInstalledApps(params);\n }\n\n uninstallApp(\n deviceInfo: GetOsVersionResponse,\n app: Pick<Application, \"perso\" | \"delete\" | \"deleteKey\" | \"hash\">,\n ): Either<WebSocketConnectionError, WebSocket> {\n const { perso, delete: appDelete, deleteKey, hash } = app;\n const params: UninstallAppsParams = {\n targetId: deviceInfo.targetId.toString(),\n perso,\n firmware: appDelete,\n firmwareKey: deleteKey,\n hash,\n };\n return this.dataSource.uninstallApp(params);\n }\n\n updateFirmware(\n deviceInfo: GetOsVersionResponse,\n firmware: Pick<OsuFirmware, \"perso\" | \"firmware\" | \"firmwareKey\">,\n ): Either<WebSocketConnectionError, WebSocket> {\n const params: UpdateFirmwareParams = {\n targetId: deviceInfo.targetId.toString(),\n perso: firmware.perso,\n firmware: firmware.firmware,\n firmwareKey: firmware.firmwareKey,\n };\n return this.dataSource.updateFirmware(params);\n }\n\n updateMcu(\n deviceInfo: GetOsVersionResponse,\n param: { version: string },\n ): Either<WebSocketConnectionError, WebSocket> {\n const params: UpdateMcuParams = {\n targetId: deviceInfo.targetId.toString(),\n version: param.version,\n };\n return this.dataSource.updateMcu(params);\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAWnCC,EAAmC,0DAc5B,IAAMC,EAAN,KAAkE,CACvE,YAEmBC,EACjB,CADiB,gBAAAA,CAChB,CAEH,aACEC,EACAC,EAC6C,CAC7C,MAAMC,EAA6B,CACjC,SAAUF,EAAW,SAAS,SAAS,EACvC,MAAOC,EAAc,KACvB,EACA,OAAO,KAAK,WAAW,aAAaC,CAAM,CAC5C,CAEA,WACEF,EACAG,EAC6C,CAC7C,KAAM,CAAE,MAAAC,EAAO,SAAAC,EAAU,YAAAC,EAAa,KAAAC,CAAK,EAAIJ,EACzCD,EAA4B,CAChC,SAAUF,EAAW,SAAS,SAAS,EACvC,MAAAI,EACA,SAAAC,EACA,YAAAC,EACA,KAAAC,CACF,EACA,OAAO,KAAK,WAAW,WAAWL,CAAM,CAC1C,CAEA,kBACEF,EACAC,EAC6C,CAC7C,MAAMC,EAAkC,CACtC,SAAUF,EAAW,SAAS,SAAS,EACvC,MAAOC,EAAc,KACvB,EACA,OAAO,KAAK,WAAW,kBAAkBC,CAAM,CACjD,CAEA,aACEF,EACAG,EAC6C,CAC7C,KAAM,CAAE,MAAAC,EAAO,OAAQI,EAAW,UAAAC,EAAW,KAAAF,CAAK,EAAIJ,EAChDD,EAA8B,CAClC,SAAUF,EAAW,SAAS,SAAS,EACvC,MAAAI,EACA,SAAUI,EACV,YAAaC,EACb,KAAAF,CACF,EACA,OAAO,KAAK,WAAW,aAAaL,CAAM,CAC5C,CAEA,eACEF,EACAK,EAC6C,CAC7C,MAAMH,EAA+B,CACnC,SAAUF,EAAW,SAAS,SAAS,EACvC,MAAOK,EAAS,MAChB,SAAUA,EAAS,SACnB,YAAaA,EAAS,WACxB,EACA,OAAO,KAAK,WAAW,eAAeH,CAAM,CAC9C,CAEA,UACEF,EACAU,EAC6C,CAC7C,MAAMR,EAA0B,CAC9B,SAAUF,EAAW,SAAS,SAAS,EACvC,QAASU,EAAM,OACjB,EACA,OAAO,KAAK,WAAW,UAAUR,CAAM,CACzC,CACF,EAjFaJ,EAANa,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,qBAAmB,uBAAuB,IAFzCd",
6
+ "names": ["DefaultSecureChannelService_exports", "__export", "DefaultSecureChannelService", "__toCommonJS", "import_inversify", "import_secureChannelTypes", "DefaultSecureChannelService", "dataSource", "deviceInfo", "finalFirmware", "params", "app", "perso", "firmware", "firmwareKey", "hash", "appDelete", "deleteKey", "param", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var t=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var a=(r,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of p(e))!c.call(r,o)&&o!==n&&t(r,o,{get:()=>e[o],enumerable:!(i=s(e,o))||i.enumerable});return r};var m=r=>a(t({},"__esModule",{value:!0}),r);var l={};module.exports=m(l);
1
+ "use strict";var t=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var a=(r,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of s(e))!c.call(r,o)&&o!==n&&t(r,o,{get:()=>e[o],enumerable:!(i=p(e,o))||i.enumerable});return r};var m=r=>a(t({},"__esModule",{value:!0}),r);var f={};module.exports=m(f);
2
2
  //# sourceMappingURL=SecureChannelService.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/secure-channel/service/SecureChannelService.ts"],
4
- "sourcesContent": ["import type WebSocket from \"isomorphic-ws\";\nimport { type Either } from \"purify-ts\";\n\nimport { type GetOsVersionResponse } from \"@api/index\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\nimport {\n type FinalFirmware,\n type OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\nimport { type WebSocketConnectionError } from \"@internal/secure-channel/model/Errors\";\n\n/**\n * Interface representing a secure channel service for device management.\n */\nexport interface SecureChannelService {\n /**\n * Construct a WebSocket connection for genuine check.\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param finalFirmware - Response of the GetFirmwareVersion HTTP request in manager API.\n * @returns Either a WebSocketConnectionError or a WebSocket.\n */\n genuineCheck(\n deviceInfo: GetOsVersionResponse,\n finalFirmware: FinalFirmware,\n ): Either<WebSocketConnectionError, WebSocket>;\n\n /**\n * Construct a WebSocket connection for installing an application.\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param app - The application to be installed, must have perso, firmware, firmwareKey, and hash properties.\n * @returns Either a WebSocketConnectionError or a WebSocket.\n */\n installApp(\n deviceInfo: GetOsVersionResponse,\n app: Pick<Application, \"perso\" | \"firmware\" | \"firmwareKey\" | \"hash\">,\n ): Either<WebSocketConnectionError, WebSocket>;\n\n /**\n * Construct a WebSocket connection for listing installed applications.\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param finalFirmware - Response of the GetFirmwareVersion HTTP request in manager API.\n * @returns Either a WebSocketConnectionError or a WebSocket.\n */\n listInstalledApps(\n deviceInfo: GetOsVersionResponse,\n finalFirmware: FinalFirmware,\n ): Either<WebSocketConnectionError, WebSocket>;\n\n /**\n * Construct a WebSocket connection for uninstalling an application.\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param app - The application to be uninstalled, must have perso, delete, deleteKey, and hash properties.\n * @returns Either a WebSocketConnectionError or a WebSocket.\n */\n uninstallApp(\n deviceInfo: GetOsVersionResponse,\n app: Pick<Application, \"perso\" | \"delete\" | \"deleteKey\" | \"hash\">,\n ): Either<WebSocketConnectionError, WebSocket>;\n\n /**\n * Construct a WebSocket connection for updating the firmware of the device.\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param osuFirmware - The osu firmware to be updated.\n * @returns Either a WebSocketConnectionError or a WebSocket.\n */\n updateFirmware(\n deviceInfo: GetOsVersionResponse,\n osuFirmware: OsuFirmware,\n ): Either<WebSocketConnectionError, WebSocket>;\n\n /**\n * Construct a WebSocket connection for updating the MCU (Microcontroller Unit) of the device.\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param param - Parameters for the MCU update, including the version.\n * @returns Either a WebSocketConnectionError or a WebSocket.\n */\n updateMcu(\n deviceInfo: GetOsVersionResponse,\n param: { version: string },\n ): Either<WebSocketConnectionError, WebSocket>;\n}\n"],
4
+ "sourcesContent": ["import type WebSocket from \"isomorphic-ws\";\nimport { type Either } from \"purify-ts\";\n\nimport { type GetOsVersionResponse } from \"@api/index\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\nimport {\n type FinalFirmware,\n type OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\nimport { type WebSocketConnectionError } from \"@internal/secure-channel/model/Errors\";\n\n/**\n * Interface representing a secure channel service for device management.\n */\nexport interface SecureChannelService {\n /**\n * Construct a WebSocket connection for genuine check.\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param finalFirmware - Response of the GetFirmwareVersion HTTP request in manager API.\n * @returns Either a WebSocketConnectionError or a WebSocket.\n */\n genuineCheck(\n deviceInfo: GetOsVersionResponse,\n finalFirmware: FinalFirmware,\n ): Either<WebSocketConnectionError, WebSocket>;\n\n /**\n * Construct a WebSocket connection for installing an application.\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param app - The application to be installed, must have perso, firmware, firmwareKey, and hash properties.\n * @returns Either a WebSocketConnectionError or a WebSocket.\n */\n installApp(\n deviceInfo: GetOsVersionResponse,\n app: Pick<Application, \"perso\" | \"firmware\" | \"firmwareKey\" | \"hash\">,\n ): Either<WebSocketConnectionError, WebSocket>;\n\n /**\n * Construct a WebSocket connection for listing installed applications.\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param finalFirmware - Response of the GetFirmwareVersion HTTP request in manager API.\n * @returns Either a WebSocketConnectionError or a WebSocket.\n */\n listInstalledApps(\n deviceInfo: GetOsVersionResponse,\n finalFirmware: FinalFirmware,\n ): Either<WebSocketConnectionError, WebSocket>;\n\n /**\n * Construct a WebSocket connection for uninstalling an application.\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param app - The application to be uninstalled, must have perso, delete, deleteKey, and hash properties.\n * @returns Either a WebSocketConnectionError or a WebSocket.\n */\n uninstallApp(\n deviceInfo: GetOsVersionResponse,\n app: Pick<Application, \"perso\" | \"delete\" | \"deleteKey\" | \"hash\">,\n ): Either<WebSocketConnectionError, WebSocket>;\n\n /**\n * Construct a WebSocket connection for updating the firmware of the device.\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param firmware - The firmware to be updated.\n * @returns Either a WebSocketConnectionError or a WebSocket.\n */\n updateFirmware(\n deviceInfo: GetOsVersionResponse,\n firmware: Pick<OsuFirmware, \"perso\" | \"firmware\" | \"firmwareKey\">,\n ): Either<WebSocketConnectionError, WebSocket>;\n\n /**\n * Construct a WebSocket connection for updating the MCU (Microcontroller Unit) of the device.\n * @param deviceInfo - Response of the GetOsVersionCommand.\n * @param param - Parameters for the MCU update, including the version.\n * @returns Either a WebSocketConnectionError or a WebSocket.\n */\n updateMcu(\n deviceInfo: GetOsVersionResponse,\n param: { version: string },\n ): Either<WebSocketConnectionError, WebSocket>;\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["SecureChannelService_exports", "__toCommonJS"]
7
7
  }
@@ -62,5 +62,5 @@
62
62
  "watch:builds": "pnpm ldmk-tool watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
63
63
  "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\""
64
64
  },
65
- "version": "1.7.0"
65
+ "version": "1.8.0"
66
66
  }
@@ -1,2 +1,2 @@
1
- import{Left as o,Right as n}from"purify-ts";import{assign as i,createMachine as r}from"xstate";import{UserInteractionRequired as p}from"../../device-action/model/UserInteractionRequired";import{UnknownDAError as m}from"../../device-action/os/Errors";import{GetDeviceMetadataDeviceAction as s}from"../../device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction";import{getDeviceMetadataDAStateStep as c}from"../../device-action/os/GetDeviceMetadata/types";import{GetDeviceStatusDeviceAction as d}from"../../device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction";import{getDeviceStatusDAStateStep as l}from"../../device-action/os/GetDeviceStatus/types";import{GoToDashboardDeviceAction as A}from"../../device-action/os/GoToDashboard/GoToDashboardDeviceAction";import{goToDashboardDAStateStep as u}from"../../device-action/os/GoToDashboard/types";import{InstallOrUpdateAppsDeviceAction as f}from"../../device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction";import{ListAppsDeviceAction as k}from"../../device-action/os/ListApps/ListAppsDeviceAction";import{listAppsDAStateStep as D}from"../../device-action/os/ListApps/types";import{OpenAppDeviceAction as I}from"../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction";import{openAppDAStateStep as y}from"../../device-action/os/OpenAppDeviceAction/types";import{ListInstalledAppsDeviceAction as M}from"../../secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction";const x=(e,t=!1)=>{k.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>r({id:"MockListAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:i({intermediateValue:()=>({requiredUserInteraction:p.AllowListApps,step:D.LIST_APPS})})},done:{type:"final"}},output:()=>t?o(new m("ListApps failed")):n(e)}))}))},P=(e,t=!1)=>{s.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>r({id:"MockGetDeviceMetadataDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:i({intermediateValue:()=>({requiredUserInteraction:p.None,step:c.GET_DEVICE_METADATA})})},done:{type:"final"}},output:()=>t?o(new m("GetDeviceMetadata failed")):n(e)}))}))},N=(e,t,a=!1)=>{f.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>r({id:"MockInstallOrUpdateAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:i({intermediateValue:()=>t})},done:{type:"final"}},output:()=>a?o(new m("InstallOrUpdateApps failed")):n(e)}))}))},B=(e=!1)=>{I.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>r({initial:"ready",states:{ready:{entry:i({intermediateValue:{requiredUserInteraction:p.ConfirmOpenApp,step:y.GET_DEVICE_STATUS}}),after:{0:"done"}},done:{type:"final"}},output:()=>e?o(new m("OpenApp failed")):n(void 0)}))}))},R=(e=!1)=>{A.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>r({id:"MockGoToDashboardDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:i({intermediateValue:()=>({requiredUserInteraction:p.None,step:u.GET_DEVICE_STATUS})})},done:{type:"final"}},output:()=>e?o(new m("GoToDashboard failed")):n(void 0)}))}))},F=(e=[{currentApp:"BOLOS",currentAppVersion:"1.0.0"}])=>{const t=vi.fn();for(const a of e)t.mockImplementationOnce(()=>"currentApp"in a?n(a):o(a));d.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>r({id:"MockGetDeviceStatusDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:i({intermediateValue:()=>({requiredUserInteraction:p.None,step:l.ONBOARD_CHECK})})},done:{type:"final"}},output:t}))}))},H=(e=[])=>{M.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>r({id:"MockListInstalledAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:i({intermediateValue:()=>({requiredUserInteraction:p.None})})},done:{type:"final"}},output:e.reduce((t,a)=>t.mockImplementationOnce(()=>"installedApps"in a?n(a):o(a)),vi.fn()).mockImplementation(()=>n([]))}))}))};export{P as setupGetDeviceMetadataMock,F as setupGetDeviceStatusMock,R as setupGoToDashboardMock,N as setupInstallOrUpdateAppsMock,x as setupListAppsMock,H as setupListInstalledAppsMock,B as setupOpenAppMock};
1
+ import{Left as i,Right as o}from"purify-ts";import{assign as r,createMachine as p}from"xstate";import{UserInteractionRequired as a}from"../../device-action/model/UserInteractionRequired";import{UnknownDAError as s}from"../../device-action/os/Errors";import{GetDeviceMetadataDeviceAction as c}from"../../device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction";import{getDeviceMetadataDAStateStep as d}from"../../device-action/os/GetDeviceMetadata/types";import{GetDeviceStatusDeviceAction as l}from"../../device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction";import{getDeviceStatusDAStateStep as A}from"../../device-action/os/GetDeviceStatus/types";import{GoToDashboardDeviceAction as f}from"../../device-action/os/GoToDashboard/GoToDashboardDeviceAction";import{goToDashboardDAStateStep as u}from"../../device-action/os/GoToDashboard/types";import{InstallOrUpdateAppsDeviceAction as k}from"../../device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction";import{ListAppsDeviceAction as D}from"../../device-action/os/ListApps/ListAppsDeviceAction";import{listAppsDAStateStep as I}from"../../device-action/os/ListApps/types";import{OpenAppDeviceAction as y}from"../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction";import{openAppDAStateStep as M}from"../../device-action/os/OpenAppDeviceAction/types";import{waitForAppAndVersionDAStateStep as m}from"../../device-action/os/WaitForAppAndVersion/types";import{WaitForAppAndVersionDeviceAction as v}from"../../device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction";import{ListInstalledAppsDeviceAction as S}from"../../secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction";const F=(e,t=!1)=>{D.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>p({id:"MockListAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:r({intermediateValue:()=>({requiredUserInteraction:a.AllowListApps,step:I.LIST_APPS})})},done:{type:"final"}},output:()=>t?i(new s("ListApps failed")):o(e)}))}))},B=(e,t=!1)=>{c.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>p({id:"MockGetDeviceMetadataDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:r({intermediateValue:()=>({requiredUserInteraction:a.None,step:d.GET_DEVICE_METADATA})})},done:{type:"final"}},output:()=>t?i(new s("GetDeviceMetadata failed")):o(e)}))}))},W=(e,t,n=!1)=>{k.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>p({id:"MockInstallOrUpdateAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:r({intermediateValue:()=>t})},done:{type:"final"}},output:()=>n?i(new s("InstallOrUpdateApps failed")):o(e)}))}))},H=(e=!1)=>{y.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>p({initial:"ready",states:{ready:{entry:r({intermediateValue:{requiredUserInteraction:a.ConfirmOpenApp,step:M.GET_DEVICE_STATUS}}),after:{0:"done"}},done:{type:"final"}},output:()=>e?i(new s("OpenApp failed")):o(void 0)}))}))},K=(e=!1)=>{f.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>p({id:"MockGoToDashboardDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:r({intermediateValue:()=>({requiredUserInteraction:a.None,step:u.GET_DEVICE_STATUS})})},done:{type:"final"}},output:()=>e?i(new s("GoToDashboard failed")):o(void 0)}))}))},j=(e=[{currentApp:"BOLOS",currentAppVersion:"1.0.0"}])=>{const t=vi.fn();for(const n of e)t.mockImplementationOnce(()=>"currentApp"in n?o(n):i(n));l.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>p({id:"MockGetDeviceStatusDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:r({intermediateValue:()=>({requiredUserInteraction:a.None,step:A.ONBOARD_CHECK})})},done:{type:"final"}},output:t}))}))},z=(e=[])=>{S.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>p({id:"MockListInstalledAppsDeviceAction",initial:"ready",states:{ready:{after:{0:"done"},entry:r({intermediateValue:()=>({requiredUserInteraction:a.None})})},done:{type:"final"}},output:e.reduce((t,n)=>t.mockImplementationOnce(()=>"installedApps"in n?o(n):i(n)),vi.fn()).mockImplementation(()=>o([]))}))}))},J=(e,t=a.None)=>{v.mockImplementation(()=>({makeStateMachine:vi.fn().mockImplementation(()=>p({id:"MockWaitForAppAndVersionDeviceAction",initial:"ready",context:{intermediateValue:{requiredUserInteraction:a.None,step:m.GET_APP_AND_VERSION}},states:{ready:{after:{0:"done"},entry:r({intermediateValue:()=>({requiredUserInteraction:t,step:m.GET_APP_AND_VERSION})})},done:{type:"final"}},output:()=>"_tag"in e?i(e):o(e)}))}))};export{B as setupGetDeviceMetadataMock,j as setupGetDeviceStatusMock,K as setupGoToDashboardMock,W as setupInstallOrUpdateAppsMock,F as setupListAppsMock,z as setupListInstalledAppsMock,H as setupOpenAppMock,J as setupWaitForAppAndVersionMock};
2
2
  //# sourceMappingURL=setupTestMachine.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/__test-utils__/setupTestMachine.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { type Mock } from \"vitest\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nimport {\n type GetDeviceMetadataDAOutput,\n getDeviceMetadataDAStateStep,\n} from \"@api/device-action/os/GetDeviceMetadata/types\";\nimport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nimport { getDeviceStatusDAStateStep } from \"@api/device-action/os/GetDeviceStatus/types\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { goToDashboardDAStateStep } from \"@api/device-action/os/GoToDashboard/types\";\nimport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nimport {\n type InstallOrUpdateAppsDAIntermediateValue,\n type InstallOrUpdateAppsDAOutput,\n} from \"@api/device-action/os/InstallOrUpdateApps/types\";\nimport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nimport { listAppsDAStateStep } from \"@api/device-action/os/ListApps/types\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { openAppDAStateStep } from \"@api/device-action/os/OpenAppDeviceAction/types\";\nimport { type DmkError } from \"@api/Error\";\nimport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nimport { type InstalledApp } from \"@api/secure-channel/device-action/ListInstalledApps/types\";\n\nimport { type BTC_APP } from \"./data\";\n\ntype App = typeof BTC_APP;\n\nexport const setupListAppsMock = (apps: App[], error = false) => {\n (ListAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"ListApps failed\"))\n : Right(apps);\n },\n }),\n ),\n }));\n};\n\nexport const setupGetDeviceMetadataMock = (\n metadata: GetDeviceMetadataDAOutput,\n error = false,\n) => {\n (GetDeviceMetadataDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGetDeviceMetadataDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: getDeviceMetadataDAStateStep.GET_DEVICE_METADATA,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"GetDeviceMetadata failed\"))\n : Right(metadata);\n },\n }),\n ),\n }));\n};\n\nexport const setupInstallOrUpdateAppsMock = (\n result: InstallOrUpdateAppsDAOutput,\n intermediateValue: InstallOrUpdateAppsDAIntermediateValue,\n error = false,\n) => {\n (InstallOrUpdateAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockInstallOrUpdateAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => intermediateValue,\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"InstallOrUpdateApps failed\"))\n : Right(result);\n },\n }),\n ),\n }));\n};\n\nexport const setupOpenAppMock = (error: boolean = false) => {\n (OpenAppDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n initial: \"ready\",\n states: {\n ready: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n step: openAppDAStateStep.GET_DEVICE_STATUS,\n },\n }),\n after: {\n 0: \"done\",\n },\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"OpenApp failed\"))\n : Right(undefined);\n },\n }),\n ),\n }));\n};\n\nexport const setupGoToDashboardMock = (error: boolean = false) => {\n (GoToDashboardDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGoToDashboardDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: goToDashboardDAStateStep.GET_DEVICE_STATUS,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"GoToDashboard failed\"))\n : Right(undefined);\n },\n }),\n ),\n }));\n};\n\nexport const setupGetDeviceStatusMock = (\n outputs: ReadonlyArray<\n { currentApp: string; currentAppVersion: string } | DmkError\n > = [\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n ],\n) => {\n const outputFn = vi.fn();\n\n for (const output of outputs) {\n outputFn.mockImplementationOnce(() =>\n \"currentApp\" in output ? Right(output) : Left(output),\n );\n }\n (GetDeviceStatusDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGetDeviceStatusDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: getDeviceStatusDAStateStep.ONBOARD_CHECK,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputFn,\n }),\n ),\n }));\n};\n\nexport const setupListInstalledAppsMock = (\n outputs: Array<{ installedApps: InstalledApp[] } | DmkError> = [],\n) => {\n (ListInstalledAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListInstalledAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputs\n .reduce(\n (mockFn, output) =>\n mockFn.mockImplementationOnce(() =>\n \"installedApps\" in output ? Right(output) : Left(output),\n ),\n vi.fn(),\n )\n .mockImplementation(() => Right([])),\n }),\n ),\n }));\n};\n"],
5
- "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAE5B,OAAS,UAAAC,EAAQ,iBAAAC,MAAqB,SAEtC,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,kBAAAC,MAAsB,+BAC/B,OAAS,iCAAAC,MAAqC,wEAC9C,OAEE,gCAAAC,MACK,gDACP,OAAS,+BAAAC,MAAmC,oEAC5C,OAAS,8BAAAC,MAAkC,8CAC3C,OAAS,6BAAAC,MAAiC,gEAC1C,OAAS,4BAAAC,MAAgC,4CACzC,OAAS,mCAAAC,MAAuC,4EAKhD,OAAS,wBAAAC,MAA4B,sDACrC,OAAS,uBAAAC,MAA2B,uCACpC,OAAS,uBAAAC,MAA2B,gEACpC,OAAS,sBAAAC,MAA0B,kDAEnC,OAAS,iCAAAC,MAAqC,oFAOvC,MAAMC,EAAoB,CAACC,EAAaC,EAAQ,KAAU,CAC9DP,EAA8B,mBAAmB,KAAO,CACvD,iBAAkB,GAAG,GAAG,EAAE,mBAAmB,IAC3CV,EAAc,CACZ,GAAI,2BACJ,QAAS,QACT,OAAQ,CACN,MAAO,CACL,MAAO,CACL,EAAG,MACL,EACA,MAAOD,EAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyBE,EAAwB,cACjD,KAAMU,EAAoB,SAC5B,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IACCM,EACHpB,EAAK,IAAIK,EAAe,iBAAiB,CAAC,EAC1CJ,EAAMkB,CAAI,CAElB,CAAC,CACH,CACF,EAAE,CACJ,EAEaE,EAA6B,CACxCC,EACAF,EAAQ,KACL,CACFd,E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D,EAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAyBE,EAAwB,IACnD,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQyB,EACL,OACC,CAACI,EAAQF,IACPE,EAAO,uBAAuB,IAC5B,kBAAmBF,EAAS9B,EAAM8B,CAAM,EAAI/B,EAAK+B,CAAM,CACzD,EACF,GAAG,GAAG,CACR,EACC,mBAAmB,IAAM9B,EAAM,CAAC,CAAC,CAAC,CACvC,CAAC,CACH,CACF,EAAE,CACJ",
6
- "names": ["Left", "Right", "assign", "createMachine", "UserInteractionRequired", "UnknownDAError", "GetDeviceMetadataDeviceAction", "getDeviceMetadataDAStateStep", "GetDeviceStatusDeviceAction", "getDeviceStatusDAStateStep", "GoToDashboardDeviceAction", "goToDashboardDAStateStep", "InstallOrUpdateAppsDeviceAction", "ListAppsDeviceAction", "listAppsDAStateStep", "OpenAppDeviceAction", "openAppDAStateStep", "ListInstalledAppsDeviceAction", "setupListAppsMock", "apps", "error", "setupGetDeviceMetadataMock", "metadata", "setupInstallOrUpdateAppsMock", "result", "intermediateValue", "setupOpenAppMock", "setupGoToDashboardMock", "setupGetDeviceStatusMock", "outputs", "outputFn", "output", "setupListInstalledAppsMock", "mockFn"]
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { type Mock } from \"vitest\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { type GetAppAndVersionResponse } from \"@api/command/os/GetAppAndVersionCommand\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nimport {\n type GetDeviceMetadataDAOutput,\n getDeviceMetadataDAStateStep,\n} from \"@api/device-action/os/GetDeviceMetadata/types\";\nimport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nimport { getDeviceStatusDAStateStep } from \"@api/device-action/os/GetDeviceStatus/types\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { goToDashboardDAStateStep } from \"@api/device-action/os/GoToDashboard/types\";\nimport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nimport {\n type InstallOrUpdateAppsDAIntermediateValue,\n type InstallOrUpdateAppsDAOutput,\n} from \"@api/device-action/os/InstallOrUpdateApps/types\";\nimport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nimport { listAppsDAStateStep } from \"@api/device-action/os/ListApps/types\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { openAppDAStateStep } from \"@api/device-action/os/OpenAppDeviceAction/types\";\nimport { waitForAppAndVersionDAStateStep } from \"@api/device-action/os/WaitForAppAndVersion/types\";\nimport { WaitForAppAndVersionDeviceAction } from \"@api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction\";\nimport { type DmkError } from \"@api/Error\";\nimport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nimport { type InstalledApp } from \"@api/secure-channel/device-action/ListInstalledApps/types\";\n\nimport { type BTC_APP } from \"./data\";\n\ntype App = typeof BTC_APP;\n\nexport const setupListAppsMock = (apps: App[], error = false) => {\n (ListAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.AllowListApps,\n step: listAppsDAStateStep.LIST_APPS,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"ListApps failed\"))\n : Right(apps);\n },\n }),\n ),\n }));\n};\n\nexport const setupGetDeviceMetadataMock = (\n metadata: GetDeviceMetadataDAOutput,\n error = false,\n) => {\n (GetDeviceMetadataDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGetDeviceMetadataDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: getDeviceMetadataDAStateStep.GET_DEVICE_METADATA,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"GetDeviceMetadata failed\"))\n : Right(metadata);\n },\n }),\n ),\n }));\n};\n\nexport const setupInstallOrUpdateAppsMock = (\n result: InstallOrUpdateAppsDAOutput,\n intermediateValue: InstallOrUpdateAppsDAIntermediateValue,\n error = false,\n) => {\n (InstallOrUpdateAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockInstallOrUpdateAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => intermediateValue,\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"InstallOrUpdateApps failed\"))\n : Right(result);\n },\n }),\n ),\n }));\n};\n\nexport const setupOpenAppMock = (error: boolean = false) => {\n (OpenAppDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n initial: \"ready\",\n states: {\n ready: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n step: openAppDAStateStep.GET_DEVICE_STATUS,\n },\n }),\n after: {\n 0: \"done\",\n },\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"OpenApp failed\"))\n : Right(undefined);\n },\n }),\n ),\n }));\n};\n\nexport const setupGoToDashboardMock = (error: boolean = false) => {\n (GoToDashboardDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGoToDashboardDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: goToDashboardDAStateStep.GET_DEVICE_STATUS,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => {\n return error\n ? Left(new UnknownDAError(\"GoToDashboard failed\"))\n : Right(undefined);\n },\n }),\n ),\n }));\n};\n\nexport const setupGetDeviceStatusMock = (\n outputs: ReadonlyArray<\n { currentApp: string; currentAppVersion: string } | DmkError\n > = [\n {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n ],\n) => {\n const outputFn = vi.fn();\n\n for (const output of outputs) {\n outputFn.mockImplementationOnce(() =>\n \"currentApp\" in output ? Right(output) : Left(output),\n );\n }\n (GetDeviceStatusDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockGetDeviceStatusDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: getDeviceStatusDAStateStep.ONBOARD_CHECK,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputFn,\n }),\n ),\n }));\n};\n\nexport const setupListInstalledAppsMock = (\n outputs: Array<{ installedApps: InstalledApp[] } | DmkError> = [],\n) => {\n (ListInstalledAppsDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockListInstalledAppsDeviceAction\",\n initial: \"ready\",\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: outputs\n .reduce(\n (mockFn, output) =>\n mockFn.mockImplementationOnce(() =>\n \"installedApps\" in output ? Right(output) : Left(output),\n ),\n vi.fn(),\n )\n .mockImplementation(() => Right([])),\n }),\n ),\n }));\n};\n\nexport const setupWaitForAppAndVersionMock = (\n output: GetAppAndVersionResponse | DmkError,\n requiredUserInteraction: UserInteractionRequired = UserInteractionRequired.None,\n) => {\n (WaitForAppAndVersionDeviceAction as unknown as Mock).mockImplementation(\n () => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n id: \"MockWaitForAppAndVersionDeviceAction\",\n initial: \"ready\",\n context: {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: waitForAppAndVersionDAStateStep.GET_APP_AND_VERSION,\n },\n },\n states: {\n ready: {\n after: {\n 0: \"done\",\n },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction,\n step: waitForAppAndVersionDAStateStep.GET_APP_AND_VERSION,\n }),\n }),\n },\n done: {\n type: \"final\",\n },\n },\n output: () => (\"_tag\" in output ? Left(output) : Right(output)),\n }),\n ),\n }),\n );\n};\n"],
5
+ "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAE5B,OAAS,UAAAC,EAAQ,iBAAAC,MAAqB,SAGtC,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,kBAAAC,MAAsB,+BAC/B,OAAS,iCAAAC,MAAqC,wEAC9C,OAEE,gCAAAC,MACK,gDACP,OAAS,+BAAAC,MAAmC,oEAC5C,OAAS,8BAAAC,MAAkC,8CAC3C,OAAS,6BAAAC,MAAiC,gEAC1C,OAAS,4BAAAC,MAAgC,4CACzC,OAAS,mCAAAC,MAAuC,4EAKhD,OAAS,wBAAAC,MAA4B,sDACrC,OAAS,uBAAAC,MAA2B,uCACpC,OAAS,uB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AO,CACL,MAAO,CACL,EAAG,MACL,EACA,MAAOf,EAAO,CACZ,kBAAmB,KAAO,CACxB,wBAAAmC,EACA,KAAMpB,EAAgC,mBACxC,EACF,CAAC,CACH,EACA,KAAM,CACJ,KAAM,OACR,CACF,EACA,OAAQ,IAAO,SAAUgB,EAASjC,EAAKiC,CAAM,EAAIhC,EAAMgC,CAAM,CAC/D,CAAC,CACH,CACF,EACF,CACF",
6
+ "names": ["Left", "Right", "assign", "createMachine", "UserInteractionRequired", "UnknownDAError", "GetDeviceMetadataDeviceAction", "getDeviceMetadataDAStateStep", "GetDeviceStatusDeviceAction", "getDeviceStatusDAStateStep", "GoToDashboardDeviceAction", "goToDashboardDAStateStep", "InstallOrUpdateAppsDeviceAction", "ListAppsDeviceAction", "listAppsDAStateStep", "OpenAppDeviceAction", "openAppDAStateStep", "waitForAppAndVersionDAStateStep", "WaitForAppAndVersionDeviceAction", "ListInstalledAppsDeviceAction", "setupListAppsMock", "apps", "error", "setupGetDeviceMetadataMock", "metadata", "setupInstallOrUpdateAppsMock", "result", "intermediateValue", "setupOpenAppMock", "setupGoToDashboardMock", "setupGetDeviceStatusMock", "outputs", "outputFn", "output", "setupListInstalledAppsMock", "mockFn", "setupWaitForAppAndVersionMock", "requiredUserInteraction"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var m=(o=>(o.None="none",o.UnlockDevice="unlock-device",o.AllowSecureConnection="allow-secure-connection",o.ConfirmOpenApp="confirm-open-app",o.SignTransaction="sign-transaction",o.SignTypedData="sign-typed-data",o.AllowListApps="allow-list-apps",o.VerifyAddress="verify-address",o.SignPersonalMessage="sign-personal-message",o.SignDelegationAuthorization="sign-delegation-authorization",o.Web3ChecksOptIn="web3-checks-opt-in",o.VerifySafeAddress="verify-safe-address",o.RegisterWallet="register-wallet",o.ConfirmLoadImage="confirm-load-image",o.ConfirmCommitImage="confirm-commit-image",o.ConfirmRemoveImage="confirm-remove-image",o))(m||{});export{m as UserInteractionRequired};
1
+ var o=(l=>(l.None="none",l.UnlockDevice="unlock-device",l.AllowSecureConnection="allow-secure-connection",l.ConfirmOpenApp="confirm-open-app",l.SignTransaction="sign-transaction",l.SignTypedData="sign-typed-data",l.AllowListApps="allow-list-apps",l.VerifyAddress="verify-address",l.SignPersonalMessage="sign-personal-message",l.SignDelegationAuthorization="sign-delegation-authorization",l.Web3ChecksOptIn="web3-checks-opt-in",l.VerifySafeAddress="verify-safe-address",l.RegisterWallet="register-wallet",l.ConfirmLoadImage="confirm-load-image",l.ConfirmCommitImage="confirm-commit-image",l.ConfirmRemoveImage="confirm-remove-image",l.GrantConsent="grant-consent",l.AllowInstallFirmware="allow-install-firmware",l))(o||{});export{o as UserInteractionRequired};
2
2
  //# sourceMappingURL=UserInteractionRequired.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/model/UserInteractionRequired.ts"],
4
- "sourcesContent": ["/**\n * The user interaction required on the device to move further in a device action.\n * This is used to inform the users about the action they need to take on the device.\n */\nexport enum UserInteractionRequired {\n None = \"none\",\n UnlockDevice = \"unlock-device\",\n AllowSecureConnection = \"allow-secure-connection\",\n ConfirmOpenApp = \"confirm-open-app\",\n SignTransaction = \"sign-transaction\",\n SignTypedData = \"sign-typed-data\",\n AllowListApps = \"allow-list-apps\",\n VerifyAddress = \"verify-address\",\n SignPersonalMessage = \"sign-personal-message\",\n SignDelegationAuthorization = \"sign-delegation-authorization\",\n Web3ChecksOptIn = \"web3-checks-opt-in\",\n VerifySafeAddress = \"verify-safe-address\",\n RegisterWallet = \"register-wallet\",\n ConfirmLoadImage = \"confirm-load-image\",\n ConfirmCommitImage = \"confirm-commit-image\",\n ConfirmRemoveImage = \"confirm-remove-image\",\n}\n"],
5
- "mappings": "AAIO,IAAKA,OACVA,EAAA,KAAO,OACPA,EAAA,aAAe,gBACfA,EAAA,sBAAwB,0BACxBA,EAAA,eAAiB,mBACjBA,EAAA,gBAAkB,mBAClBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,iBAChBA,EAAA,oBAAsB,wBACtBA,EAAA,4BAA8B,gCAC9BA,EAAA,gBAAkB,qBAClBA,EAAA,kBAAoB,sBACpBA,EAAA,eAAiB,kBACjBA,EAAA,iBAAmB,qBACnBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBAhBXA,OAAA",
4
+ "sourcesContent": ["/**\n * The user interaction required on the device to move further in a device action.\n * This is used to inform the users about the action they need to take on the device.\n */\nexport enum UserInteractionRequired {\n None = \"none\",\n UnlockDevice = \"unlock-device\",\n AllowSecureConnection = \"allow-secure-connection\",\n ConfirmOpenApp = \"confirm-open-app\",\n SignTransaction = \"sign-transaction\",\n SignTypedData = \"sign-typed-data\",\n AllowListApps = \"allow-list-apps\",\n VerifyAddress = \"verify-address\",\n SignPersonalMessage = \"sign-personal-message\",\n SignDelegationAuthorization = \"sign-delegation-authorization\",\n Web3ChecksOptIn = \"web3-checks-opt-in\",\n VerifySafeAddress = \"verify-safe-address\",\n RegisterWallet = \"register-wallet\",\n ConfirmLoadImage = \"confirm-load-image\",\n ConfirmCommitImage = \"confirm-commit-image\",\n ConfirmRemoveImage = \"confirm-remove-image\",\n GrantConsent = \"grant-consent\",\n AllowInstallFirmware = \"allow-install-firmware\",\n}\n"],
5
+ "mappings": "AAIO,IAAKA,OACVA,EAAA,KAAO,OACPA,EAAA,aAAe,gBACfA,EAAA,sBAAwB,0BACxBA,EAAA,eAAiB,mBACjBA,EAAA,gBAAkB,mBAClBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,iBAChBA,EAAA,oBAAsB,wBACtBA,EAAA,4BAA8B,gCAC9BA,EAAA,gBAAkB,qBAClBA,EAAA,kBAAoB,sBACpBA,EAAA,eAAiB,kBACjBA,EAAA,iBAAmB,qBACnBA,EAAA,mBAAqB,uBACrBA,EAAA,mBAAqB,uBACrBA,EAAA,aAAe,gBACfA,EAAA,qBAAuB,yBAlBbA,OAAA",
6
6
  "names": ["UserInteractionRequired"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Left as k,Right as E}from"purify-ts";import{EMPTY as f,from as O,interval as C,mergeMap as G,of as h,switchMap as U,take as b}from"rxjs";import{timeout as x}from"rxjs/operators";import{assign as r,fromObservable as I,fromPromise as v,setup as M}from"xstate";import{isSuccessCommandResult as p}from"../../../command/model/CommandResult";import{GetAppAndVersionCommand as A}from"../../../command/os/GetAppAndVersionCommand";import{GetOsVersionCommand as w}from"../../../command/os/GetOsVersionCommand";import{DeviceStatus as R}from"../../../device/DeviceStatus";import{UserInteractionRequired as c}from"../../../device-action/model/UserInteractionRequired";import{DEFAULT_UNLOCK_TIMEOUT_MS as N}from"../../../device-action/os/Const";import{DeviceLockedError as T,DeviceNotOnboardedError as F}from"../../../device-action/os/Errors";import{XStateDeviceAction as _}from"../../../device-action/xstate-utils/XStateDeviceAction";import{DeviceSessionStateType as u}from"../../../device-session/DeviceSessionState";import{isDashboardName as L,LEDGER_OS_NAME as q}from"../../../utils/AppName";import{getDeviceStatusDAStateStep as l}from"./types";const B=a=>({mcu:a.mcuSephVersion,bootloader:a.mcuBootloaderVersion,os:a.seVersion,metadata:a});class ne extends _{makeStateMachine(n){const{getAppAndVersion:d,getOsVersion:S,getDeviceSessionState:o,setDeviceSessionState:i,waitForDeviceUnlock:m}=this.extractDependencies(n),D=this.input.unlockTimeout??N,V=e=>{const t=o();t.sessionStateType!==u.Connected&&i({...t,firmwareVersion:B(e),isSecureConnectionAllowed:e.secureElementFlags.isSecureConnectionAllowed})};return M({types:{input:{unlockTimeout:D},context:{},output:{}},actors:{getAppAndVersion:v(d),getOsVersion:v(S),waitForDeviceUnlock:I(m)},guards:{isCurrentAppBolos:({context:e})=>L(e._internalState.currentApp),isOnboardedFromOsVersion:({context:e})=>e._internalState.osVersionMetadata?.secureElementFlags.isOnboarded===!0,isDeviceLocked:({context:e})=>e._internalState.locked,hasError:({context:e})=>e._internalState.error!==null},actions:{assignErrorDeviceNotOnboarded:r({_internalState:e=>({...e.context._internalState,error:new F})}),assignErrorDeviceLocked:r({_internalState:e=>({...e.context._internalState,error:new T}),intermediateValue:{requiredUserInteraction:c.UnlockDevice,step:l.UNLOCK_DEVICE}}),assignErrorFromEvent:r({_internalState:e=>({...e.context._internalState,error:e.event.error})}),assignNoUserActionNeeded:r({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:c.None})}),assignUserActionUnlockNeeded:r({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:c.UnlockDevice,step:l.UNLOCK_DEVICE})})}}).createMachine({id:"GetDeviceStatusDeviceAction",initial:"DeviceReady",context:e=>{const t=o(),{sessionStateType:s}=t;return{input:{unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:c.None,step:l.ONBOARD_CHECK},_internalState:{onboarded:!1,locked:!1,currentApp:s===u.ReadyWithoutSecureChannel?t.currentApp.name:null,currentAppVersion:null,osVersionMetadata:null,error:null}}},states:{DeviceReady:{always:{target:"AppAndVersionCheck"}},AppAndVersionCheck:{invoke:{src:"getAppAndVersion",onDone:{target:"ApplicationAvailableResultCheck",actions:r({_internalState:e=>{if(p(e.event.output)){const t=o();return t.sessionStateType!==u.Connected?i({...t,currentApp:e.event.output.data}):i({deviceModelId:t.deviceModelId,sessionStateType:u.ReadyWithoutSecureChannel,deviceStatus:R.CONNECTED,currentApp:e.event.output.data,installedApps:[],isSecureConnectionAllowed:!1}),{...e.context._internalState,locked:!1,currentApp:e.event.output.data.name,currentAppVersion:e.event.output.data.version}}if("errorCode"in e.event.output.error){if(e.event.output.error.errorCode==="5515")return{...e.context._internalState,locked:!0};if(e.event.output.error.errorCode==="6e00")return{...e.context._internalState,locked:!1,currentApp:q,currentAppVersion:"0.0.0"}}return{...e.context._internalState,error:e.event.output.error}}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},ApplicationAvailableResultCheck:{always:[{guard:"hasError",target:"Error"},{target:"UserActionUnlockDevice",guard:"isDeviceLocked"},{target:"OnboardingCheck"}]},OnboardingCheck:{always:[{guard:"isCurrentAppBolos",target:"GetOsVersion"},{target:"Success",actions:r({_internalState:e=>({...e.context._internalState,onboarded:!0})})}]},GetOsVersion:{invoke:{src:"getOsVersion",onDone:{target:"OnboardingResultCheck",actions:r({_internalState:e=>p(e.event.output)?(V(e.event.output.data),{...e.context._internalState,osVersionMetadata:e.event.output.data}):{...e.context._internalState,error:e.event.output.error}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},OnboardingResultCheck:{always:[{guard:"hasError",target:"Error"},{guard:"isOnboardedFromOsVersion",target:"Success",actions:r({_internalState:e=>({...e.context._internalState,onboarded:!0})})},{target:"Error",actions:"assignErrorDeviceNotOnboarded"}]},UserActionUnlockDevice:{entry:"assignUserActionUnlockNeeded",exit:"assignNoUserActionNeeded",invoke:{id:"UserActionUnlockDevice",src:"waitForDeviceUnlock",input:e=>({unlockTimeout:D}),onDone:{target:"AppAndVersionCheck",actions:r({_internalState:e=>({...e.context._internalState,locked:!1})})},onError:{target:"Error",actions:"assignErrorDeviceLocked"}}},Success:{type:"final"},Error:{type:"final"}},output:e=>{const{context:t}=e,{error:s,currentApp:g,currentAppVersion:y}=t._internalState;return s?k(s):E({currentApp:g,currentAppVersion:y})}})}extractDependencies(n){return{getAppAndVersion:()=>n.sendCommand(new A),getOsVersion:()=>n.sendCommand(new w),waitForDeviceUnlock:({input:o})=>C(1e3).pipe(U(()=>O(n.sendCommand(new A))),G(i=>!p(i)&&"errorCode"in i.error&&i.error.errorCode==="5515"?f:h(void 0)),b(1),x(o.unlockTimeout)),getDeviceSessionState:()=>n.getDeviceSessionState(),setDeviceSessionState:o=>n.setDeviceSessionState(o)}}}export{ne as GetDeviceStatusDeviceAction};
1
+ import{Left as V,Right as O}from"purify-ts";import{assign as r,fromPromise as g,setup as y}from"xstate";import{isSuccessCommandResult as h}from"../../../command/model/CommandResult";import{GetOsVersionCommand as E}from"../../../command/os/GetOsVersionCommand";import{DeviceStatus as G}from"../../../device/DeviceStatus";import{UserInteractionRequired as l}from"../../../device-action/model/UserInteractionRequired";import{DEFAULT_UNLOCK_TIMEOUT_MS as f}from"../../../device-action/os/Const";import{DeviceNotOnboardedError as I}from"../../../device-action/os/Errors";import{WaitForAppAndVersionDeviceAction as M}from"../../../device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction";import{XStateDeviceAction as b}from"../../../device-action/xstate-utils/XStateDeviceAction";import{DeviceSessionStateType as i}from"../../../device-session/DeviceSessionState";import{isDashboardName as C}from"../../../utils/AppName";import{getDeviceStatusDAStateStep as d}from"./types";const w=a=>({mcu:a.mcuSephVersion,bootloader:a.mcuBootloaderVersion,os:a.seVersion,metadata:a});class K extends b{makeStateMachine(o){const{getOsVersion:s,getDeviceSessionState:c,setDeviceSessionState:u}=this.extractDependencies(o),p=this.input.unlockTimeout??f,S=this.input.allowNonOnboardedDevice??!0,D=e=>{const t=c();t.sessionStateType!==i.Connected&&u({...t,firmwareVersion:w(e),isSecureConnectionAllowed:e.secureElementFlags.isSecureConnectionAllowed})},m=new M({input:{unlockTimeout:p}}).makeStateMachine(o);return y({types:{input:{unlockTimeout:p,allowNonOnboardedDevice:S},context:{},output:{}},actors:{waitForAppAndVersion:m,getOsVersion:g(s)},guards:{isCurrentAppBolos:({context:e})=>C(e._internalState.currentApp),isOnboardedFromOsVersion:({context:e})=>e._internalState.osVersionMetadata?.secureElementFlags.isOnboarded===!0,isAllowedNonOnboardedDevice:({context:e})=>{const t=e._internalState.osVersionMetadata?.secureElementFlags;return e.input.allowNonOnboardedDevice===!0&&t?.isOnboarded===!1},hasError:({context:e})=>e._internalState.error!==null},actions:{assignErrorDeviceNotOnboarded:r({_internalState:e=>({...e.context._internalState,error:new I})}),assignErrorFromEvent:r({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"GetDeviceStatusDeviceAction",initial:"DeviceReady",context:e=>{const t=c(),{sessionStateType:n}=t;return{input:{unlockTimeout:e.input.unlockTimeout,allowNonOnboardedDevice:e.input.allowNonOnboardedDevice??!0},intermediateValue:{requiredUserInteraction:l.None,step:d.WAIT_FOR_APP_AND_VERSION},_internalState:{onboarded:!1,currentApp:n===i.ReadyWithoutSecureChannel?t.currentApp.name:null,currentAppVersion:null,osVersionMetadata:null,error:null}}},states:{DeviceReady:{always:{target:"WaitForAppAndVersion"}},WaitForAppAndVersion:{invoke:{src:"waitForAppAndVersion",input:e=>({unlockTimeout:e.context.input.unlockTimeout}),onSnapshot:{actions:r({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:e.event.snapshot.context.intermediateValue.requiredUserInteraction})})},onDone:{target:"WaitForAppAndVersionResultCheck",actions:r({_internalState:e=>e.event.output.caseOf({Left:t=>({...e.context._internalState,error:t}),Right:t=>{const n=c();return n.sessionStateType!==i.Connected?u({...n,currentApp:t}):u({deviceModelId:n.deviceModelId,sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:G.CONNECTED,currentApp:t,installedApps:[],isSecureConnectionAllowed:!1}),{...e.context._internalState,currentApp:t.name,currentAppVersion:t.version}}})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},WaitForAppAndVersionResultCheck:{always:[{guard:"hasError",target:"Error"},{target:"OnboardingCheck"}]},OnboardingCheck:{entry:r({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:l.None,step:d.ONBOARD_CHECK})}),always:[{guard:"isCurrentAppBolos",target:"GetOsVersion"},{target:"Success",actions:r({_internalState:e=>({...e.context._internalState,onboarded:!0})})}]},GetOsVersion:{invoke:{src:"getOsVersion",onDone:{target:"OnboardingResultCheck",actions:r({_internalState:e=>h(e.event.output)?(D(e.event.output.data),{...e.context._internalState,osVersionMetadata:e.event.output.data}):{...e.context._internalState,error:e.event.output.error}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},OnboardingResultCheck:{always:[{guard:"hasError",target:"Error"},{guard:"isOnboardedFromOsVersion",target:"Success",actions:r({_internalState:e=>({...e.context._internalState,onboarded:!0})})},{guard:"isAllowedNonOnboardedDevice",target:"Success"},{target:"Error",actions:"assignErrorDeviceNotOnboarded"}]},Success:{type:"final"},Error:{type:"final"}},output:e=>{const{context:t}=e,{error:n,currentApp:v,currentAppVersion:A}=t._internalState;return n?V(n):O({currentApp:v,currentAppVersion:A})}})}extractDependencies(o){return{getOsVersion:()=>o.sendCommand(new E),getDeviceSessionState:()=>o.getDeviceSessionState(),setDeviceSessionState:s=>o.setDeviceSessionState(s)}}}export{K as GetDeviceStatusDeviceAction};
2
2
  //# sourceMappingURL=GetDeviceStatusDeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport {\n EMPTY,\n from,\n interval,\n mergeMap,\n type Observable,\n of,\n switchMap,\n take,\n} from \"rxjs\";\nimport { timeout } from \"rxjs/operators\";\nimport { assign, fromObservable, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetAppAndVersionCommand,\n type GetAppAndVersionCommandResult,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nimport {\n GetOsVersionCommand,\n type GetOsVersionCommandResult,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport {\n DeviceLockedError,\n DeviceNotOnboardedError,\n} from \"@api/device-action/os/Errors\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n type FirmwareVersion,\n} from \"@api/device-session/DeviceSessionState\";\nimport { isDashboardName, LEDGER_OS_NAME } from \"@api/utils/AppName\";\n\nimport {\n type GetDeviceStatusDAError,\n type GetDeviceStatusDAInput,\n type GetDeviceStatusDAIntermediateValue,\n type GetDeviceStatusDAOutput,\n getDeviceStatusDAStateStep,\n} from \"./types\";\n\ntype GetDeviceStatusMachineInternalState = {\n readonly onboarded: boolean;\n readonly locked: boolean;\n readonly currentApp: string | null;\n readonly currentAppVersion: string | null;\n readonly osVersionMetadata: GetOsVersionResponse | null;\n readonly error: GetDeviceStatusDAError | null;\n};\n\nexport type MachineDependencies = {\n readonly getAppAndVersion: () => Promise<GetAppAndVersionCommandResult>;\n readonly getOsVersion: () => Promise<GetOsVersionCommandResult>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly waitForDeviceUnlock: (args: {\n input: { unlockTimeout: number };\n }) => Observable<void>;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n};\n\nconst firmwareVersionFromOsVersion = (\n data: GetOsVersionResponse,\n): FirmwareVersion => ({\n mcu: data.mcuSephVersion,\n bootloader: data.mcuBootloaderVersion,\n os: data.seVersion,\n metadata: data,\n});\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class GetDeviceStatusDeviceAction extends XStateDeviceAction<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n > {\n type types = StateMachineTypes<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n >;\n\n const {\n getAppAndVersion,\n getOsVersion,\n getDeviceSessionState,\n setDeviceSessionState,\n waitForDeviceUnlock,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const updateSessionFromOsVersion = (data: GetOsVersionResponse) => {\n const currentState = getDeviceSessionState();\n if (currentState.sessionStateType === DeviceSessionStateType.Connected) {\n return;\n }\n setDeviceSessionState({\n ...currentState,\n firmwareVersion: firmwareVersionFromOsVersion(data),\n isSecureConnectionAllowed:\n data.secureElementFlags.isSecureConnectionAllowed,\n });\n };\n\n return setup({\n types: {\n input: {\n unlockTimeout,\n } as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n getAppAndVersion: fromPromise(getAppAndVersion),\n getOsVersion: fromPromise(getOsVersion),\n waitForDeviceUnlock: fromObservable(waitForDeviceUnlock),\n },\n guards: {\n isCurrentAppBolos: ({ context }) =>\n isDashboardName(context._internalState.currentApp),\n isOnboardedFromOsVersion: ({ context }) =>\n context._internalState.osVersionMetadata?.secureElementFlags\n .isOnboarded === true,\n isDeviceLocked: ({ context }) => context._internalState.locked,\n hasError: ({ context }) => context._internalState.error !== null,\n },\n actions: {\n assignErrorDeviceNotOnboarded: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceNotOnboardedError(),\n }),\n }),\n assignErrorDeviceLocked: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceLockedError(),\n }),\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n step: getDeviceStatusDAStateStep.UNLOCK_DEVICE,\n },\n }),\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n assignNoUserActionNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n assignUserActionUnlockNeeded: assign({\n intermediateValue: (_) =>\n ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n step: getDeviceStatusDAStateStep.UNLOCK_DEVICE,\n }) satisfies types[\"context\"][\"intermediateValue\"],\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHEwBcAiYBuBLAxmAMpoCGaArrFnoQIL5q4D2AdgHQ0FgBKYpEAJ4BiANoAGALqJQAB2axcTNjJAAPRAFoArAHZx7AIwAmQ7oCcugMyHzANmMAWYwBoQgxI8vsAHOJM+VuLmVj5e2gC+EW6omDjcJORUXPSMLBwA8qwARsykAE4QuKxQAMIAFmD4ANZiUqryisqsqhoImo4O7OGhPj4h5n6Obh4IunZ2RoZ+ena6nYaGUTHoKcRklNTxqc3sWbkFRSUVVbWihtJIII1K6a1aVtoGTxOOjtbv84YjiObik7ofPM7GFDP9jNofMsQLE1olNmsGLsADLMGrFMqVGp1S5yBS3FRXNqaOzadjiHx2KyORbzcRBczmH4IbTOdjaabaKmdGy6XSRaIw1bbdZJLa0MBI9LsVHo45Ys4XBr45r3dps-n0ubaGxgx6PZlWULkkLBGmDCzGYzQ2Ei+HJEVStjsACqsDA+SdrBdrAANmjqmthBA2GB2MVsMxqmG3R6vT7-TU1hJcdcVXciYgglZycYQiYqRTQoZtMynDmbM4aW8rHYzD4BSs4hL7eLuF7Xe7PWk2AmA0GPflmPl2LJfeQAGbDgC2nbjPe9fv7IpTyqaGdAbXmxnZPkMNNM820VuZ+8M7Dsb3MznpwW31sFtpbGwdEo7dFksjorAgADUPYobAnNiIasGGEZRmGT4JC+bY7NKH5fj+-75IBrDAdUCAQfg5DpCmq5XDcqqZmMjgGDY-yGJeejjFRzJ2P47DZoEJb+Hyx42sKz5ioiC7sIh35-gB6QYcIg7DqO45oFO+SztBhCtrxuwCchwlAQqWGsJGOHNPh9SEemhKbogdLsIMTjmPuNF1nYZaOBW+5OPu9l1oCjZCs2ME8Y6fGIb6BC4WwdDYKQuDjtkvq8HAFC+mgokEXi65GeoiBguYZJOPSJa6Hm1hGsyuglkxxiUjYVjXlq7nyaKCI+cpn7+Tp6TBaF4WRXwsAxXFCpiEqBlJS0JFAo4vg+BCe55e8-QFUVVglVShjlWRtZ2FEgqsMwEBwKo1WKXVG5pgNaokmRZmQg4fyLHR7ieCNpjGPyx7aNo6UNo4nGeQpsFKdKax8AIoyJQSg3Ge0L07q9F3+Istk3Qg1IjUaZ7GNS-LlU4H1wt9+3OvseSFBiGFrsDx01mZ15mHooReFaVj0fZ5Jci5zissYIKY3a2NvnxsrVITCrE8RoMdDucxWgx1jpZCELDHDgKTC9jg6mNXKLDSHPcbV3O7LG3bNH2SYioLB3EmCI1-HuVL6Cj4hU6eNjsIVD3UrWfKXVCj5cV5Wvtr5n6CShaFE-1JMkWzPgXpCjh+Faw3Mjq5jdOlJhGvo-RzRr3uvr79VjgFzQtWFpARVFnWxcHQNCylCBm+eKPjJL4jWMEdNww4O46vSFVsfyD5Nlj3na9KRAUPghCwPAIdV20QIR7e-RzOYbNK98cN7ndgR-BSzgo+YmdfYPOfSgAovkQ75MbyVtItehmSrJgcijz2uHD+pmXyQSQnyVLs2tQA */\n id: \"GetDeviceStatusDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n const sessionState = getDeviceSessionState();\n const { sessionStateType } = sessionState;\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: getDeviceStatusDAStateStep.ONBOARD_CHECK,\n },\n _internalState: {\n onboarded: false,\n locked: false,\n currentApp:\n sessionStateType ===\n DeviceSessionStateType.ReadyWithoutSecureChannel\n ? sessionState.currentApp.name\n : null,\n currentAppVersion: null,\n osVersionMetadata: null,\n error: null,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"AppAndVersionCheck\",\n },\n },\n AppAndVersionCheck: {\n // We check the current app and version using the getAppAndVersion\n // command. This command is supported both on the dashboard (BOLOS)\n // and inside applications, so it is used to determine the currently\n // running app before deciding whether to read the OS version.\n invoke: {\n src: \"getAppAndVersion\",\n onDone: {\n target: \"ApplicationAvailableResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n const state: DeviceSessionState = getDeviceSessionState();\n if (\n state.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n // Update the current app\n setDeviceSessionState({\n ...state,\n currentApp: _.event.output.data,\n });\n } else {\n // The device can be set to Ready if GetAppAndVersionCommand was successful.\n // The firmware version and secure connection flag are enriched later from\n // the OS version, which can only be read on the dashboard.\n setDeviceSessionState({\n deviceModelId: state.deviceModelId,\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: _.event.output.data,\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n }\n return {\n ..._.context._internalState,\n locked: false,\n currentApp: _.event.output.data.name,\n currentAppVersion: _.event.output.data.version,\n };\n }\n if (\"errorCode\" in _.event.output.error) {\n if (_.event.output.error.errorCode === \"5515\") {\n // Locked device error\n return {\n ..._.context._internalState,\n locked: true,\n };\n } else if (_.event.output.error.errorCode === \"6e00\") {\n // CLA not supported\n // GetAppAndVersion should always be supported by the firmware or any app.\n // But on old firmware versions, that APDU was not supported in the dashboard.\n // On those firmwares, it fails with CLA_NOT_SUPPORTED in BOLOS, and INS_NOT_SUPPORTED\n // in applications. Therefore if CLA is not supported, we can consider we're on the\n // dashboard on an old firmware. We should therefore return that information to\n // ensure the user can still update his firmware and is not blocked at this step.\n return {\n ..._.context._internalState,\n locked: false,\n currentApp: LEDGER_OS_NAME,\n currentAppVersion: \"0.0.0\",\n };\n }\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n ApplicationAvailableResultCheck: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n target: \"UserActionUnlockDevice\",\n guard: \"isDeviceLocked\",\n },\n {\n target: \"OnboardingCheck\",\n },\n ],\n },\n OnboardingCheck: {\n always: [\n {\n // The OS version (and thus the onboarding flag) can only be read\n // on the dashboard. If we are inside an application, fetching it\n // would fail, so we only fetch it when the current app is BOLOS.\n guard: \"isCurrentAppBolos\",\n target: \"GetOsVersion\",\n },\n {\n // A non-BOLOS application can only run on an onboarded device, so\n // if an app is open we can safely consider the device onboarded\n // without reading the OS version.\n target: \"Success\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n onboarded: true,\n }),\n }),\n },\n ],\n },\n GetOsVersion: {\n invoke: {\n src: \"getOsVersion\",\n onDone: {\n target: \"OnboardingResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n updateSessionFromOsVersion(_.event.output.data);\n return {\n ..._.context._internalState,\n osVersionMetadata: _.event.output.data,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n OnboardingResultCheck: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n guard: \"isOnboardedFromOsVersion\",\n target: \"Success\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n onboarded: true,\n }),\n }),\n },\n {\n target: \"Error\",\n actions: \"assignErrorDeviceNotOnboarded\",\n },\n ],\n },\n UserActionUnlockDevice: {\n // we wait for the device to be unlocked (default timeout is 15s)\n entry: \"assignUserActionUnlockNeeded\",\n exit: \"assignNoUserActionNeeded\",\n invoke: {\n id: \"UserActionUnlockDevice\",\n src: \"waitForDeviceUnlock\",\n input: (_) => ({\n unlockTimeout,\n }),\n onDone: {\n target: \"AppAndVersionCheck\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n locked: false,\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorDeviceLocked\",\n },\n },\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (args) => {\n // TODO: instead we should rely on the current state (\"Success\" or \"Error\")\n const { context } = args;\n const { error, currentApp, currentAppVersion } = context._internalState;\n if (error) {\n return Left(error);\n }\n return Right<GetDeviceStatusDAOutput>({\n currentApp: currentApp!,\n currentAppVersion: currentAppVersion!,\n });\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const getAppAndVersion = () => {\n return internalApi.sendCommand(new GetAppAndVersionCommand());\n };\n\n const waitForDeviceUnlock = ({\n input,\n }: {\n input: { unlockTimeout: number };\n }) =>\n interval(1000).pipe(\n switchMap(() =>\n from(internalApi.sendCommand(new GetAppAndVersionCommand())),\n ),\n mergeMap((output) => {\n const isLocked =\n !isSuccessCommandResult(output) &&\n \"errorCode\" in output.error &&\n output.error.errorCode === \"5515\";\n if (isLocked) {\n return EMPTY; // Continue the polling\n }\n return of(undefined); // Complete the observable\n }),\n take(1),\n timeout(input.unlockTimeout),\n );\n\n return {\n getAppAndVersion,\n getOsVersion: () => internalApi.sendCommand(new GetOsVersionCommand()),\n waitForDeviceUnlock,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
5
- "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAC5B,OACE,SAAAC,EACA,QAAAC,EACA,YAAAC,EACA,YAAAC,EAEA,MAAAC,EACA,aAAAC,EACA,QAAAC,MACK,OACP,OAAS,WAAAC,MAAe,iBACxB,OAAS,UAAAC,EAAQ,kBAAAC,EAAgB,eAAAC,EAAa,SAAAC,MAAa,SAE3D,OAAS,0BAAAC,MAA8B,mCACvC,OACE,2BAAAC,MAEK,0CACP,OACE,uBAAAC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D,aAAc,IAAMe,EAAY,YAAY,IAAId,CAAqB,EACrE,oBA1B0B,CAAC,CAC3B,MAAAgC,CACF,IAGE5C,EAAS,GAAI,EAAE,KACbG,EAAU,IACRJ,EAAK2B,EAAY,YAAY,IAAIf,CAAyB,CAAC,CAC7D,EACAV,EAAU4C,GAEN,CAACnC,EAAuBmC,CAAM,GAC9B,cAAeA,EAAO,OACtBA,EAAO,MAAM,YAAc,OAEpB/C,EAEFI,EAAG,MAAS,CACpB,EACDE,EAAK,CAAC,EACNC,EAAQuC,EAAM,aAAa,CAC7B,EAMA,sBAAuB,IAAMlB,EAAY,sBAAsB,EAC/D,sBAAwBa,GACtBb,EAAY,sBAAsBa,CAAK,CAC3C,CACF,CACF",
6
- "names": ["Left", "Right", "EMPTY", "from", "interval", "mergeMap", "of", "switchMap", "take", "timeout", "assign", "fromObservable", "fromPromise", "setup", "isSuccessCommandResult", "GetAppAndVersionCommand", "GetOsVersionCommand", "DeviceStatus", "UserInteractionRequired", "DEFAULT_UNLOCK_TIMEOUT_MS", "DeviceLockedError", "DeviceNotOnboardedError", "XStateDeviceAction", "DeviceSessionStateType", "isDashboardName", "LEDGER_OS_NAME", "getDeviceStatusDAStateStep", "firmwareVersionFromOsVersion", "data", "GetDeviceStatusDeviceAction", "internalApi", "getAppAndVersion", "getOsVersion", "getDeviceSessionState", "setDeviceSessionState", "waitForDeviceUnlock", "unlockTimeout", "updateSessionFromOsVersion", "currentState", "context", "_", "sessionState", "sessionStateType", "state", "args", "error", "currentApp", "currentAppVersion", "input", "output"]
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetOsVersionCommand,\n type GetOsVersionCommandResult,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { DeviceNotOnboardedError } from \"@api/device-action/os/Errors\";\nimport { WaitForAppAndVersionDeviceAction } from \"@api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n type FirmwareVersion,\n} from \"@api/device-session/DeviceSessionState\";\nimport { isDashboardName } from \"@api/utils/AppName\";\n\nimport {\n type GetDeviceStatusDAError,\n type GetDeviceStatusDAInput,\n type GetDeviceStatusDAIntermediateValue,\n type GetDeviceStatusDAOutput,\n getDeviceStatusDAStateStep,\n} from \"./types\";\n\ntype GetDeviceStatusMachineInternalState = {\n readonly onboarded: boolean;\n readonly currentApp: string | null;\n readonly currentAppVersion: string | null;\n readonly osVersionMetadata: GetOsVersionResponse | null;\n readonly error: GetDeviceStatusDAError | null;\n};\n\nexport type MachineDependencies = {\n readonly getOsVersion: () => Promise<GetOsVersionCommandResult>;\n readonly getDeviceSessionState: () => DeviceSessionState;\n readonly setDeviceSessionState: (\n state: DeviceSessionState,\n ) => DeviceSessionState;\n};\n\nconst firmwareVersionFromOsVersion = (\n data: GetOsVersionResponse,\n): FirmwareVersion => ({\n mcu: data.mcuSephVersion,\n bootloader: data.mcuBootloaderVersion,\n os: data.seVersion,\n metadata: data,\n});\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class GetDeviceStatusDeviceAction extends XStateDeviceAction<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n > {\n type types = StateMachineTypes<\n GetDeviceStatusDAOutput,\n GetDeviceStatusDAInput,\n GetDeviceStatusDAError,\n GetDeviceStatusDAIntermediateValue,\n GetDeviceStatusMachineInternalState\n >;\n\n const { getOsVersion, getDeviceSessionState, setDeviceSessionState } =\n this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n const allowNonOnboardedDevice = this.input.allowNonOnboardedDevice ?? true;\n\n const updateSessionFromOsVersion = (data: GetOsVersionResponse) => {\n const currentState = getDeviceSessionState();\n if (currentState.sessionStateType === DeviceSessionStateType.Connected) {\n return;\n }\n setDeviceSessionState({\n ...currentState,\n firmwareVersion: firmwareVersionFromOsVersion(data),\n isSecureConnectionAllowed:\n data.secureElementFlags.isSecureConnectionAllowed,\n });\n };\n\n const waitForAppAndVersion = new WaitForAppAndVersionDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalApi);\n\n return setup({\n types: {\n input: {\n unlockTimeout,\n allowNonOnboardedDevice,\n } as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n waitForAppAndVersion,\n getOsVersion: fromPromise(getOsVersion),\n },\n guards: {\n isCurrentAppBolos: ({ context }) =>\n isDashboardName(context._internalState.currentApp),\n isOnboardedFromOsVersion: ({ context }) =>\n context._internalState.osVersionMetadata?.secureElementFlags\n .isOnboarded === true,\n isAllowedNonOnboardedDevice: ({ context }) => {\n const secureElementFlags =\n context._internalState.osVersionMetadata?.secureElementFlags;\n return (\n context.input.allowNonOnboardedDevice === true &&\n secureElementFlags?.isOnboarded === false\n );\n },\n hasError: ({ context }) => context._internalState.error !== null,\n },\n actions: {\n assignErrorDeviceNotOnboarded: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: new DeviceNotOnboardedError(),\n }),\n }),\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHEwBcAiYBuBLAxmAMpoCGaArrFnoQIL5q4D2AdgHQ0FgBKYpEAJ4BiANoAGALqJQAB2axcTNjJAAPRAFoArAHZx7AIwAmQ7oCcugMyHzANmMAWYwBoQgxI8vsAHOJM+VuLmVj5e2gC+EW6omDjcJORUXPSMLBwA8qwARsykAE4QuKxQAMIAFmD4ANZiUqryisqsqhoImo4O7OGhPj4h5n6Obh4IunZ2RoZ+ena6nYaGUTHoKcRklNTxqc3sWbkFRSUVVbWihtJIII1K6a1aVtoGTxOOjtbv84YjiObik7ofPM7GFDP9jNofMsQLE1olNmsGLsADLMGrFMqVGp1S5yBS3FRXNqaOzadjiHx2KyORbzcRBczmH4IbTOdjaabaKmdGy6XSRaIw1bbdZJLa0MBI9LsVHo45Ys4XBr45r3dps-n0ubaGxgx6PZlWULkkLBGmDCzGYzQ2Ei+HJEVStjsACqsDA+SdrBdrAANmjqmthBA2GB2MVsMxqmG3R6vT7-TU1hJcdcVXciYgglZycYQiYqRTQoZtMynDmbM4aW8rHYzD4BSs4hL7eLuF7Xe7PWk2AmA0GPflmPl2LJfeQAGbDgC2nbjPe9fv7IpTyqaGdAbXmxnZPkMNNM820VuZ+8M7Dsb3MznpwW31sFtpbGwdEo7dFksjorAgADUPYobAnNiIasGGEZRmGT4JC+bY7NKH5fj+-75IBrDAdUCAQfg5DpCmq5XDcqqZmMjgGDY-yGJeejjFRzJ2P47DZoEJb+Hyx42sKz5ioiC7sIh35-gB6QYcIg7DqO45oFO+SztBhCtrxuwCchwlAQqWGsJGOHNPh9SEemhKbogdLsIMTjmPuNF1nYZaOBW+5OPu9l1oCjZCs2ME8Y6fGIb6BC4WwdDYKQuDjtkvq8HAFC+mgokEXi65GeoiBguYZJOPSJa6Hm1hGsyuglkxxiUjYVjXlq7nyaKCI+cpn7+Tp6TBaF4WRXwsAxXFCpiEqBlJS0JFAo4vg+BCe55e8-QFUVVglVShjlWRtZ2FEgqsMwEBwKo1WKXVG5pgNaokmRZmQg4fyLHR7ieCNpjGPyx7aNo6UNo4nGeQpsFKdKax8AIoyJQSg3Ge0L07q9F3+Istk3Qg1IjUaZ7GNS-LlU4H1wt9+3OvseSFBiGFrsDx01mZ15mHooReFaVj0fZ5Jci5zissYIKY3a2NvnxsrVITCrE8RoMdDucxWgx1jpZCELDHDgKTC9jg6mNXKLDSHPcbV3O7LG3bNH2SYioLB3EmCI1-HuVL6Cj4hU6eNjsIVD3UrWfKXVCj5cV5Wvtr5n6CShaFE-1JMkWzPgXpCjh+Faw3Mjq5jdOlJhGvo-RzRr3uvr79VjgFzQtWFpARVFnWxcHQNCylCBm+eKPjJL4jWMEdNww4O46vSFVsfyD5Nlj3na9KRAUPghCwPAIdV20QIR7e-RzOYbNK98cN7ndgR-BSzgo+YmdfYPOfSgAovkQ75MbyVtItehmSrJgcijz2uHD+pmXyQSQnyVLs2tQA */\n id: \"GetDeviceStatusDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n const sessionState = getDeviceSessionState();\n const { sessionStateType } = sessionState;\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n allowNonOnboardedDevice: _.input.allowNonOnboardedDevice ?? true,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: getDeviceStatusDAStateStep.WAIT_FOR_APP_AND_VERSION,\n },\n _internalState: {\n onboarded: false,\n currentApp:\n sessionStateType ===\n DeviceSessionStateType.ReadyWithoutSecureChannel\n ? sessionState.currentApp.name\n : null,\n currentAppVersion: null,\n osVersionMetadata: null,\n error: null,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"WaitForAppAndVersion\",\n },\n },\n WaitForAppAndVersion: {\n // We check the current app and version using the getAppAndVersion\n // command. This command is supported both on the dashboard (BOLOS)\n // and inside applications, so it is used to determine the currently\n // running app before deciding whether to read the OS version.\n invoke: {\n src: \"waitForAppAndVersion\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n requiredUserInteraction:\n _.event.snapshot.context.intermediateValue\n .requiredUserInteraction,\n }),\n }),\n },\n onDone: {\n target: \"WaitForAppAndVersionResultCheck\",\n actions: assign({\n _internalState: (_): GetDeviceStatusMachineInternalState => {\n return _.event.output.caseOf<GetDeviceStatusMachineInternalState>(\n {\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n Right: (output) => {\n const state: DeviceSessionState =\n getDeviceSessionState();\n if (\n state.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n // Update the current app\n setDeviceSessionState({\n ...state,\n currentApp: output,\n });\n } else {\n setDeviceSessionState({\n deviceModelId: state.deviceModelId,\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: output,\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n }\n return {\n ..._.context._internalState,\n currentApp: output.name,\n currentAppVersion: output.version,\n };\n },\n },\n );\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n WaitForAppAndVersionResultCheck: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n target: \"OnboardingCheck\",\n },\n ],\n },\n OnboardingCheck: {\n entry: assign({\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n requiredUserInteraction: UserInteractionRequired.None,\n step: getDeviceStatusDAStateStep.ONBOARD_CHECK,\n }),\n }),\n always: [\n {\n // The OS version (and thus the onboarding flag) can only be read\n // on the dashboard. If we are inside an application, fetching it\n // would fail, so we only fetch it when the current app is BOLOS.\n guard: \"isCurrentAppBolos\",\n target: \"GetOsVersion\",\n },\n {\n // A non-BOLOS application can only run on an onboarded device, so\n // if an app is open we can safely consider the device onboarded\n // without reading the OS version.\n target: \"Success\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n onboarded: true,\n }),\n }),\n },\n ],\n },\n GetOsVersion: {\n invoke: {\n src: \"getOsVersion\",\n onDone: {\n target: \"OnboardingResultCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n updateSessionFromOsVersion(_.event.output.data);\n return {\n ..._.context._internalState,\n osVersionMetadata: _.event.output.data,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n OnboardingResultCheck: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n guard: \"isOnboardedFromOsVersion\",\n target: \"Success\",\n actions: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n onboarded: true,\n }),\n }),\n },\n {\n guard: \"isAllowedNonOnboardedDevice\",\n target: \"Success\",\n },\n {\n target: \"Error\",\n actions: \"assignErrorDeviceNotOnboarded\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (args) => {\n // TODO: instead we should rely on the current state (\"Success\" or \"Error\")\n const { context } = args;\n const { error, currentApp, currentAppVersion } = context._internalState;\n if (error) {\n return Left(error);\n }\n return Right<GetDeviceStatusDAOutput>({\n currentApp: currentApp!,\n currentAppVersion: currentAppVersion!,\n });\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n return {\n getOsVersion: () => internalApi.sendCommand(new GetOsVersionCommand()),\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
5
+ "mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAC5B,OAAS,UA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AE,QAAQ,eACb,MAAOA,EAAE,MAAM,OAAO,KACxB,CAEJ,CAAC,CACH,EACA,QAAS,CACP,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,sBAAuB,CACrB,OAAQ,CACN,CACE,MAAO,WACP,OAAQ,OACV,EACA,CACE,MAAO,2BACP,OAAQ,UACR,QAAS5B,EAAO,CACd,eAAiB4B,IAAO,CACtB,GAAGA,EAAE,QAAQ,eACb,UAAW,EACb,EACF,CAAC,CACH,EACA,CACE,MAAO,8BACP,OAAQ,SACV,EACA,CACE,OAAQ,QACR,QAAS,+BACX,CACF,CACF,EACA,QAAS,CACP,KAAM,OACR,EACA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAASM,GAAS,CAEhB,KAAM,CAAE,QAAAR,CAAQ,EAAIQ,EACd,CAAE,MAAAH,EAAO,WAAAI,EAAY,kBAAAC,CAAkB,EAAIV,EAAQ,eACzD,OAAIK,EACKjC,EAAKiC,CAAK,EAEZhC,EAA+B,CACpC,WAAYoC,EACZ,kBAAmBC,CACrB,CAAC,CACH,CACF,CAAC,CACH,CAEA,oBAAoBnB,EAA+C,CACjE,MAAO,CACL,aAAc,IAAMA,EAAY,YAAY,IAAIb,CAAqB,EACrE,sBAAuB,IAAMa,EAAY,sBAAsB,EAC/D,sBAAwBgB,GACtBhB,EAAY,sBAAsBgB,CAAK,CAC3C,CACF,CACF",
6
+ "names": ["Left", "Right", "assign", "fromPromise", "setup", "isSuccessCommandResult", "GetOsVersionCommand", "DeviceStatus", "UserInteractionRequired", "DEFAULT_UNLOCK_TIMEOUT_MS", "DeviceNotOnboardedError", "WaitForAppAndVersionDeviceAction", "XStateDeviceAction", "DeviceSessionStateType", "isDashboardName", "getDeviceStatusDAStateStep", "firmwareVersionFromOsVersion", "data", "GetDeviceStatusDeviceAction", "internalApi", "getOsVersion", "getDeviceSessionState", "setDeviceSessionState", "unlockTimeout", "allowNonOnboardedDevice", "updateSessionFromOsVersion", "currentState", "waitForAppAndVersion", "context", "secureElementFlags", "_", "sessionState", "sessionStateType", "error", "output", "state", "args", "currentApp", "currentAppVersion"]
7
7
  }