@ledgerhq/device-management-kit 0.0.0-develop-20250106155719 → 0.0.0-webhid-20250124103640
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.
- package/lib/cjs/package.json +4 -1
- package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKit.test.js.map +2 -2
- package/lib/cjs/src/api/DeviceManagementKitBuilder.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKitBuilder.js.map +2 -2
- package/lib/cjs/src/api/DmkConfig.js +1 -1
- package/lib/cjs/src/api/DmkConfig.js.map +1 -1
- package/lib/cjs/src/api/command/model/CommandResult.js.map +1 -1
- package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
- package/lib/cjs/src/api/command/use-case/SendCommandUseCase.test.js.map +2 -2
- package/lib/cjs/src/api/command/utils/CommandUtils.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.js.map +2 -2
- package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +1 -1
- package/lib/cjs/src/api/device-session/DeviceSessionState.js +1 -1
- package/lib/cjs/src/api/device-session/DeviceSessionState.js.map +2 -2
- package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js +1 -1
- package/lib/cjs/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js.map +2 -2
- package/lib/cjs/src/api/types.js.map +1 -1
- package/lib/cjs/src/di.js +1 -1
- package/lib/cjs/src/di.js.map +2 -2
- package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
- package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
- package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +2 -2
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +2 -2
- package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +1 -1
- package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +2 -2
- package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
- package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.test.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/model/Const.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Const.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/model/Errors.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Errors.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/model/Params.js +2 -0
- package/lib/cjs/src/internal/manager-api/model/Params.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.test.js.map +2 -2
- package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
- package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
- package/lib/esm/package.json +4 -1
- package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
- package/lib/esm/src/api/DeviceManagementKit.test.js.map +2 -2
- package/lib/esm/src/api/DeviceManagementKitBuilder.js +1 -1
- package/lib/esm/src/api/DeviceManagementKitBuilder.js.map +3 -3
- package/lib/esm/src/api/command/model/CommandResult.js.map +1 -1
- package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js +1 -1
- package/lib/esm/src/api/command/use-case/SendCommandUseCase.test.js.map +2 -2
- package/lib/esm/src/api/command/utils/CommandUtils.js +1 -1
- package/lib/esm/src/api/command/utils/CommandUtils.js.map +2 -2
- package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
- package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-session/DeviceSessionState.js.map +2 -2
- package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js +1 -1
- package/lib/esm/src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.js.map +2 -2
- package/lib/esm/src/di.js +1 -1
- package/lib/esm/src/di.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
- package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
- package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +2 -2
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +2 -2
- package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js +1 -1
- package/lib/esm/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map +2 -2
- package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
- package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.test.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/GetConnectedDeviceUseCase.test.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ListConnectedDevicesUseCase.test.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ListenToConnectedDeviceUseCase.test.js.map +2 -2
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
- package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
- package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
- package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
- package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
- package/lib/esm/src/internal/manager-api/model/Const.js +1 -1
- package/lib/esm/src/internal/manager-api/model/Const.js.map +3 -3
- package/lib/esm/src/internal/manager-api/model/Errors.js +1 -1
- package/lib/esm/src/internal/manager-api/model/Errors.js.map +3 -3
- package/lib/esm/src/internal/manager-api/model/Params.js +1 -0
- package/lib/esm/src/internal/manager-api/model/Params.js.map +7 -0
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js +1 -1
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.test.js.map +2 -2
- package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
- package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
- package/lib/types/src/api/DeviceManagementKitBuilder.d.ts.map +1 -1
- package/lib/types/src/api/DmkConfig.d.ts +1 -0
- package/lib/types/src/api/DmkConfig.d.ts.map +1 -1
- package/lib/types/src/api/command/model/CommandResult.d.ts +1 -2
- package/lib/types/src/api/command/model/CommandResult.d.ts.map +1 -1
- package/lib/types/src/api/device-action/DeviceAction.d.ts +1 -1
- package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts +1 -0
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts +1 -0
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-session/DeviceSessionState.d.ts +5 -0
- package/lib/types/src/api/device-session/DeviceSessionState.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/Errors.d.ts +26 -26
- package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
- package/lib/types/src/api/types.d.ts +1 -1
- package/lib/types/src/api/types.d.ts.map +1 -1
- package/lib/types/src/di.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +15 -5
- package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +70 -2
- package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +6 -0
- package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Const.d.ts +1 -0
- package/lib/types/src/internal/manager-api/model/Const.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Errors.d.ts +6 -0
- package/lib/types/src/internal/manager-api/model/Errors.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Params.d.ts +86 -0
- package/lib/types/src/internal/manager-api/model/Params.d.ts.map +1 -0
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +5 -2
@@ -1,2 +1,2 @@
|
|
1
|
-
import{DEFAULT_MANAGER_API_BASE_URL as e,DEFAULT_MOCK_SERVER_BASE_URL as t}from"../internal/manager-api/model/Const";import{DeviceManagementKit as
|
1
|
+
import{DEFAULT_MANAGER_API_BASE_URL as e,DEFAULT_MOCK_SERVER_BASE_URL as t,DEFAULT_WEB_SOCKET_BASE_URL as i}from"../internal/manager-api/model/Const";import{DeviceManagementKit as o}from"./DeviceManagementKit";class g{stub=!1;loggers=[];transports=[];config={managerApiUrl:e,mockUrl:t,webSocketUrl:i};build(){return new o({stub:this.stub,transports:this.transports,loggers:this.loggers,config:this.config})}setStub(r){return this.stub=r,this}addTransport(r){return this.transports.push(r),this}addLogger(r){return this.loggers.push(r),this}addConfig(r){return this.config={...this.config,...r},this}}export{g as DeviceManagementKitBuilder};
|
2
2
|
//# sourceMappingURL=DeviceManagementKitBuilder.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../src/api/DeviceManagementKitBuilder.ts"],
|
4
|
-
"sourcesContent": ["import {\n DEFAULT_MANAGER_API_BASE_URL,\n DEFAULT_MOCK_SERVER_BASE_URL,\n} from \"@internal/manager-api/model/Const\";\n\nimport { type LoggerSubscriberService } from \"./logger-subscriber/service/LoggerSubscriberService\";\nimport { type TransportFactory } from \"./transport/model/Transport\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\nimport { type DmkConfig } from \"./DmkConfig\";\n\n/**\n * Builder for the `DeviceManagementKit` class.\n *\n * @example\n * ```\n * const dmk = new LedgerDeviceManagementKitBuilder()\n * .setStub(false)\n * .addTransport((args) => transportFactory(args))\n * .addTransport(transportFactory)\n * .addLogger(myLogger)\n * .build();\n * ```\n */\nexport class DeviceManagementKitBuilder {\n private stub = false;\n private readonly loggers: LoggerSubscriberService[] = [];\n private readonly transports: TransportFactory[] = [];\n private config: DmkConfig = {\n managerApiUrl: DEFAULT_MANAGER_API_BASE_URL,\n mockUrl: DEFAULT_MOCK_SERVER_BASE_URL,\n };\n\n build(): DeviceManagementKit {\n return new DeviceManagementKit({\n stub: this.stub,\n transports: this.transports,\n loggers: this.loggers,\n config: this.config,\n });\n }\n\n setStub(stubbed: boolean): DeviceManagementKitBuilder {\n this.stub = stubbed;\n return this;\n }\n\n addTransport(transport: TransportFactory): DeviceManagementKitBuilder {\n this.transports.push(transport);\n return this;\n }\n\n /**\n * Add a logger to the SDK that will receive its logs\n */\n addLogger(logger: LoggerSubscriberService): DeviceManagementKitBuilder {\n this.loggers.push(logger);\n return this;\n }\n\n addConfig(config: Partial<DmkConfig>): DeviceManagementKitBuilder {\n this.config = {\n ...this.config,\n ...config,\n };\n return this;\n }\n}\n"],
|
5
|
-
"mappings": "AAAA,OACE,gCAAAA,EACA,gCAAAC,MACK,oCAIP,OAAS,uBAAAC,MAA2B,wBAgB7B,MAAMC,CAA2B,CAC9B,KAAO,GACE,QAAqC,CAAC,EACtC,WAAiC,CAAC,EAC3C,OAAoB,CAC1B,
|
6
|
-
"names": ["DEFAULT_MANAGER_API_BASE_URL", "DEFAULT_MOCK_SERVER_BASE_URL", "DeviceManagementKit", "DeviceManagementKitBuilder", "stubbed", "transport", "logger", "config"]
|
4
|
+
"sourcesContent": ["import {\n DEFAULT_MANAGER_API_BASE_URL,\n DEFAULT_MOCK_SERVER_BASE_URL,\n DEFAULT_WEB_SOCKET_BASE_URL,\n} from \"@internal/manager-api/model/Const\";\n\nimport { type LoggerSubscriberService } from \"./logger-subscriber/service/LoggerSubscriberService\";\nimport { type TransportFactory } from \"./transport/model/Transport\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\nimport { type DmkConfig } from \"./DmkConfig\";\n\n/**\n * Builder for the `DeviceManagementKit` class.\n *\n * @example\n * ```\n * const dmk = new LedgerDeviceManagementKitBuilder()\n * .setStub(false)\n * .addTransport((args) => transportFactory(args))\n * .addTransport(transportFactory)\n * .addLogger(myLogger)\n * .build();\n * ```\n */\nexport class DeviceManagementKitBuilder {\n private stub = false;\n private readonly loggers: LoggerSubscriberService[] = [];\n private readonly transports: TransportFactory[] = [];\n private config: DmkConfig = {\n managerApiUrl: DEFAULT_MANAGER_API_BASE_URL,\n mockUrl: DEFAULT_MOCK_SERVER_BASE_URL,\n webSocketUrl: DEFAULT_WEB_SOCKET_BASE_URL,\n };\n\n build(): DeviceManagementKit {\n return new DeviceManagementKit({\n stub: this.stub,\n transports: this.transports,\n loggers: this.loggers,\n config: this.config,\n });\n }\n\n setStub(stubbed: boolean): DeviceManagementKitBuilder {\n this.stub = stubbed;\n return this;\n }\n\n addTransport(transport: TransportFactory): DeviceManagementKitBuilder {\n this.transports.push(transport);\n return this;\n }\n\n /**\n * Add a logger to the SDK that will receive its logs\n */\n addLogger(logger: LoggerSubscriberService): DeviceManagementKitBuilder {\n this.loggers.push(logger);\n return this;\n }\n\n addConfig(config: Partial<DmkConfig>): DeviceManagementKitBuilder {\n this.config = {\n ...this.config,\n ...config,\n };\n return this;\n }\n}\n"],
|
5
|
+
"mappings": "AAAA,OACE,gCAAAA,EACA,gCAAAC,EACA,+BAAAC,MACK,oCAIP,OAAS,uBAAAC,MAA2B,wBAgB7B,MAAMC,CAA2B,CAC9B,KAAO,GACE,QAAqC,CAAC,EACtC,WAAiC,CAAC,EAC3C,OAAoB,CAC1B,cAAeJ,EACf,QAASC,EACT,aAAcC,CAChB,EAEA,OAA6B,CAC3B,OAAO,IAAIC,EAAoB,CAC7B,KAAM,KAAK,KACX,WAAY,KAAK,WACjB,QAAS,KAAK,QACd,OAAQ,KAAK,MACf,CAAC,CACH,CAEA,QAAQE,EAA8C,CACpD,YAAK,KAAOA,EACL,IACT,CAEA,aAAaC,EAAyD,CACpE,YAAK,WAAW,KAAKA,CAAS,EACvB,IACT,CAKA,UAAUC,EAA6D,CACrE,YAAK,QAAQ,KAAKA,CAAM,EACjB,IACT,CAEA,UAAUC,EAAwD,CAChE,YAAK,OAAS,CACZ,GAAG,KAAK,OACR,GAAGA,CACL,EACO,IACT,CACF",
|
6
|
+
"names": ["DEFAULT_MANAGER_API_BASE_URL", "DEFAULT_MOCK_SERVER_BASE_URL", "DEFAULT_WEB_SOCKET_BASE_URL", "DeviceManagementKit", "DeviceManagementKitBuilder", "stubbed", "transport", "logger", "config"]
|
7
7
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/command/model/CommandResult.ts"],
|
4
|
-
"sourcesContent": ["import {\n type InvalidBatteryDataError,\n type InvalidBatteryStatusTypeError,\n type InvalidResponseFormatError,\n type InvalidStatusWordError,\n} from \"@api/command/Errors\";\nimport { type GlobalCommandErrorStatusCode } from \"@api/command/utils/GlobalCommandError\";\nimport {\n type DeviceExchangeError,\n type UnknownDeviceExchangeError,\n} from \"@api/Error\";\n\nexport enum CommandResultStatus {\n Error = \"ERROR\",\n Success = \"SUCCESS\",\n}\
|
4
|
+
"sourcesContent": ["import {\n type InvalidBatteryDataError,\n type InvalidBatteryStatusTypeError,\n type InvalidResponseFormatError,\n type InvalidStatusWordError,\n} from \"@api/command/Errors\";\nimport { type GlobalCommandErrorStatusCode } from \"@api/command/utils/GlobalCommandError\";\nimport {\n type DeviceExchangeError,\n type UnknownDeviceExchangeError,\n} from \"@api/Error\";\n\nexport enum CommandResultStatus {\n Error = \"ERROR\",\n Success = \"SUCCESS\",\n}\nexport type CommandSuccessResult<Data> = {\n status: CommandResultStatus.Success;\n data: Data;\n};\nexport type CommandErrorResult<SpecificErrorCodes = void> = {\n error:\n | DeviceExchangeError<SpecificErrorCodes | GlobalCommandErrorStatusCode>\n | InvalidBatteryDataError\n | InvalidBatteryStatusTypeError\n | InvalidResponseFormatError\n | InvalidStatusWordError\n | UnknownDeviceExchangeError;\n status: CommandResultStatus.Error;\n};\nexport type CommandResult<Data, SpecificErrorCodes = void> =\n | CommandSuccessResult<Data>\n | CommandErrorResult<SpecificErrorCodes>;\n\nexport function CommandResultFactory<Data, SpecificErrorCodes = void>({\n data,\n error,\n}:\n | { data: Data; error?: undefined }\n | {\n data?: undefined;\n error:\n | DeviceExchangeError<SpecificErrorCodes>\n | InvalidBatteryDataError\n | InvalidBatteryStatusTypeError\n | InvalidResponseFormatError\n | InvalidStatusWordError\n | UnknownDeviceExchangeError;\n }): CommandResult<Data, SpecificErrorCodes> {\n if (error) {\n return {\n status: CommandResultStatus.Error,\n error,\n };\n }\n return {\n status: CommandResultStatus.Success,\n data,\n };\n}\n\nexport function isSuccessCommandResult<Data, StatusCode>(\n result: CommandResult<Data, StatusCode>,\n): result is CommandSuccessResult<Data> {\n return result.status === CommandResultStatus.Success;\n}\n"],
|
5
5
|
"mappings": "AAYO,IAAKA,OACVA,EAAA,MAAQ,QACRA,EAAA,QAAU,UAFAA,OAAA,IAsBL,SAASC,EAAsD,CACpE,KAAAC,EACA,MAAAC,CACF,EAWgD,CAC9C,OAAIA,EACK,CACL,OAAQ,QACR,MAAAA,CACF,EAEK,CACL,OAAQ,UACR,KAAAD,CACF,CACF,CAEO,SAASE,EACdC,EACsC,CACtC,OAAOA,EAAO,SAAW,SAC3B",
|
6
6
|
"names": ["CommandResultStatus", "CommandResultFactory", "data", "error", "isSuccessCommandResult", "result"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{Left as u}from"purify-ts";import{CommandResultStatus as r}from"../../command/model/CommandResult";import{deviceSessionStubBuilder as p}from"../../../internal/device-session/model/DeviceSession.stub";import{DefaultDeviceSessionService as S}from"../../../internal/device-session/service/DefaultDeviceSessionService";import{DefaultLoggerPublisherService as f}from"../../../internal/logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as
|
1
|
+
import{Left as u}from"purify-ts";import{CommandResultStatus as r}from"../../command/model/CommandResult";import{deviceSessionStubBuilder as p}from"../../../internal/device-session/model/DeviceSession.stub";import{DefaultDeviceSessionService as S}from"../../../internal/device-session/service/DefaultDeviceSessionService";import{DefaultLoggerPublisherService as f}from"../../../internal/logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as g}from"../../../internal/manager-api/data/AxiosManagerApiDataSource";import{DefaultManagerApiService as v}from"../../../internal/manager-api/service/DefaultManagerApiService";import{SendCommandUseCase as a}from"./SendCommandUseCase";let s,o,n,c;const m="fakeSessionId";let i;describe("SendCommandUseCase",()=>{beforeEach(()=>{s=new f([],"send-command-use-case"),o=new S(()=>s),c=new g({}),n=new v(c),i={getApdu:jest.fn(),parseResponse:jest.fn()}}),afterEach(()=>{jest.restoreAllMocks()}),it("should send a command to a connected device",async()=>{const e=p({},()=>s,n);o.addDeviceSession(e);const t=new a(o,()=>s);jest.spyOn(e,"sendCommand").mockResolvedValue({status:r.Success,data:void 0});const d=await t.execute({sessionId:m,command:i});e.close(),expect(d).toStrictEqual({status:r.Success,data:void 0})}),it("should throw an error if the session is not found",async()=>{const e=new a(o,()=>s);jest.spyOn(o,"getDeviceSessionById").mockReturnValue(u({_tag:"DeviceSessionNotFound"}));const t=e.execute({sessionId:m,command:i});await expect(t).rejects.toMatchObject({_tag:"DeviceSessionNotFound"})})});
|
2
2
|
//# sourceMappingURL=SendCommandUseCase.test.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/command/use-case/SendCommandUseCase.test.ts"],
|
4
|
-
"sourcesContent": ["import { Left } from \"purify-ts\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { CommandResultStatus } from \"@api/command/model/CommandResult\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DefaultDeviceSessionService } from \"@internal/device-session/service/DefaultDeviceSessionService\";\nimport { type DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport { AxiosManagerApiDataSource } from \"@internal/manager-api/data/AxiosManagerApiDataSource\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\n\nimport { SendCommandUseCase } from \"./SendCommandUseCase\";\n\nlet logger: LoggerPublisherService;\nlet sessionService: DeviceSessionService;\nlet managerApi: ManagerApiService;\nlet managerApiDataSource: ManagerApiDataSource;\nconst fakeSessionId = \"fakeSessionId\";\nlet command: Command<{ status: string }>;\n\ndescribe(\"SendCommandUseCase\", () => {\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService([], \"send-command-use-case\");\n sessionService = new DefaultDeviceSessionService(() => logger);\n managerApiDataSource = new AxiosManagerApiDataSource({
|
5
|
-
"mappings": "AAAA,OAAS,QAAAA,MAAY,YAGrB,OAAS,uBAAAC,MAA2B,
|
4
|
+
"sourcesContent": ["import { Left } from \"purify-ts\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { CommandResultStatus } from \"@api/command/model/CommandResult\";\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DefaultDeviceSessionService } from \"@internal/device-session/service/DefaultDeviceSessionService\";\nimport { type DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport { AxiosManagerApiDataSource } from \"@internal/manager-api/data/AxiosManagerApiDataSource\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\n\nimport { SendCommandUseCase } from \"./SendCommandUseCase\";\n\nlet logger: LoggerPublisherService;\nlet sessionService: DeviceSessionService;\nlet managerApi: ManagerApiService;\nlet managerApiDataSource: ManagerApiDataSource;\nconst fakeSessionId = \"fakeSessionId\";\nlet command: Command<{ status: string }>;\n\ndescribe(\"SendCommandUseCase\", () => {\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService([], \"send-command-use-case\");\n sessionService = new DefaultDeviceSessionService(() => logger);\n managerApiDataSource = new AxiosManagerApiDataSource({} as DmkConfig);\n managerApi = new DefaultManagerApiService(managerApiDataSource);\n command = {\n getApdu: jest.fn(),\n parseResponse: jest.fn(),\n };\n });\n\n afterEach(() => {\n jest.restoreAllMocks();\n });\n\n it(\"should send a command to a connected device\", async () => {\n const deviceSession = deviceSessionStubBuilder(\n {},\n () => logger,\n managerApi,\n );\n sessionService.addDeviceSession(deviceSession);\n const useCase = new SendCommandUseCase(sessionService, () => logger);\n\n jest.spyOn(deviceSession, \"sendCommand\").mockResolvedValue({\n status: CommandResultStatus.Success,\n data: undefined,\n });\n\n const response = await useCase.execute<{ status: string }, void, void>({\n sessionId: fakeSessionId,\n command,\n });\n\n deviceSession.close();\n\n expect(response).toStrictEqual({\n status: CommandResultStatus.Success,\n data: undefined,\n });\n });\n\n it(\"should throw an error if the session is not found\", async () => {\n const useCase = new SendCommandUseCase(sessionService, () => logger);\n jest\n .spyOn(sessionService, \"getDeviceSessionById\")\n .mockReturnValue(Left({ _tag: \"DeviceSessionNotFound\" }));\n\n const res = useCase.execute<{ status: string }, void, void>({\n sessionId: fakeSessionId,\n command,\n });\n\n await expect(res).rejects.toMatchObject({ _tag: \"DeviceSessionNotFound\" });\n });\n});\n"],
|
5
|
+
"mappings": "AAAA,OAAS,QAAAA,MAAY,YAGrB,OAAS,uBAAAC,MAA2B,mCAGpC,OAAS,4BAAAC,MAAgC,oDACzC,OAAS,+BAAAC,MAAmC,+DAE5C,OAAS,iCAAAC,MAAqC,mEAC9C,OAAS,6BAAAC,MAAiC,uDAE1C,OAAS,4BAAAC,MAAgC,yDAGzC,OAAS,sBAAAC,MAA0B,uBAEnC,IAAIC,EACAC,EACAC,EACAC,EACJ,MAAMC,EAAgB,gBACtB,IAAIC,EAEJ,SAAS,qBAAsB,IAAM,CACnC,WAAW,IAAM,CACfL,EAAS,IAAIJ,EAA8B,CAAC,EAAG,uBAAuB,EACtEK,EAAiB,IAAIN,EAA4B,IAAMK,CAAM,EAC7DG,EAAuB,IAAIN,EAA0B,CAAC,CAAc,EACpEK,EAAa,IAAIJ,EAAyBK,CAAoB,EAC9DE,EAAU,CACR,QAAS,KAAK,GAAG,EACjB,cAAe,KAAK,GAAG,CACzB,CACF,CAAC,EAED,UAAU,IAAM,CACd,KAAK,gBAAgB,CACvB,CAAC,EAED,GAAG,8CAA+C,SAAY,CAC5D,MAAMC,EAAgBZ,EACpB,CAAC,EACD,IAAMM,EACNE,CACF,EACAD,EAAe,iBAAiBK,CAAa,EAC7C,MAAMC,EAAU,IAAIR,EAAmBE,EAAgB,IAAMD,CAAM,EAEnE,KAAK,MAAMM,EAAe,aAAa,EAAE,kBAAkB,CACzD,OAAQb,EAAoB,QAC5B,KAAM,MACR,CAAC,EAED,MAAMe,EAAW,MAAMD,EAAQ,QAAwC,CACrE,UAAWH,EACX,QAAAC,CACF,CAAC,EAEDC,EAAc,MAAM,EAEpB,OAAOE,CAAQ,EAAE,cAAc,CAC7B,OAAQf,EAAoB,QAC5B,KAAM,MACR,CAAC,CACH,CAAC,EAED,GAAG,oDAAqD,SAAY,CAClE,MAAMc,EAAU,IAAIR,EAAmBE,EAAgB,IAAMD,CAAM,EACnE,KACG,MAAMC,EAAgB,sBAAsB,EAC5C,gBAAgBT,EAAK,CAAE,KAAM,uBAAwB,CAAC,CAAC,EAE1D,MAAMiB,EAAMF,EAAQ,QAAwC,CAC1D,UAAWH,EACX,QAAAC,CACF,CAAC,EAED,MAAM,OAAOI,CAAG,EAAE,QAAQ,cAAc,CAAE,KAAM,uBAAwB,CAAC,CAC3E,CAAC,CACH,CAAC",
|
6
6
|
"names": ["Left", "CommandResultStatus", "deviceSessionStubBuilder", "DefaultDeviceSessionService", "DefaultLoggerPublisherService", "AxiosManagerApiDataSource", "DefaultManagerApiService", "SendCommandUseCase", "logger", "sessionService", "managerApi", "managerApiDataSource", "fakeSessionId", "command", "deviceSession", "useCase", "response", "res"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
class
|
1
|
+
class s{static isValidStatusCode(e){return e.length===2}static isSuccessResponse({statusCode:e}){return s.isValidStatusCode(e)?e[0]===144&&e[1]===0:!1}static isLockedDeviceResponse({statusCode:e}){return s.isValidStatusCode(e)?e[0]===85&&e[1]===21:!1}}export{s as CommandUtils};
|
2
2
|
//# sourceMappingURL=CommandUtils.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/command/utils/CommandUtils.ts"],
|
4
|
-
"sourcesContent": ["import { type ApduResponse } from \"@api/device-session/ApduResponse\";\n\nexport class CommandUtils {\n static isValidStatusCode(statusCode: Uint8Array) {\n return statusCode.length === 2;\n }\n\n static isSuccessResponse({ statusCode }: ApduResponse) {\n if (!
|
5
|
-
"mappings": "AAEO,MAAMA,CAAa,CACxB,OAAO,kBAAkBC,EAAwB,CAC/C,OAAOA,EAAW,SAAW,CAC/B,CAEA,OAAO,kBAAkB,CAAE,WAAAA,CAAW,EAAiB,CACrD,
|
4
|
+
"sourcesContent": ["import { type ApduResponse } from \"@api/device-session/ApduResponse\";\n\nexport class CommandUtils {\n static isValidStatusCode(statusCode: Uint8Array) {\n return statusCode.length === 2;\n }\n\n static isSuccessResponse({ statusCode }: ApduResponse) {\n if (!CommandUtils.isValidStatusCode(statusCode)) {\n return false;\n }\n\n return statusCode[0] === 0x90 && statusCode[1] === 0x00;\n }\n\n static isLockedDeviceResponse({ statusCode }: ApduResponse) {\n if (!CommandUtils.isValidStatusCode(statusCode)) {\n return false;\n }\n\n return statusCode[0] === 0x55 && statusCode[1] === 0x15;\n }\n}\n"],
|
5
|
+
"mappings": "AAEO,MAAMA,CAAa,CACxB,OAAO,kBAAkBC,EAAwB,CAC/C,OAAOA,EAAW,SAAW,CAC/B,CAEA,OAAO,kBAAkB,CAAE,WAAAA,CAAW,EAAiB,CACrD,OAAKD,EAAa,kBAAkBC,CAAU,EAIvCA,EAAW,CAAC,IAAM,KAAQA,EAAW,CAAC,IAAM,EAH1C,EAIX,CAEA,OAAO,uBAAuB,CAAE,WAAAA,CAAW,EAAiB,CAC1D,OAAKD,EAAa,kBAAkBC,CAAU,EAIvCA,EAAW,CAAC,IAAM,IAAQA,EAAW,CAAC,IAAM,GAH1C,EAIX,CACF",
|
6
6
|
"names": ["CommandUtils", "statusCode"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
const e=jest.fn(),t=jest.fn(),
|
1
|
+
const e=jest.fn(),t=jest.fn(),n=jest.fn(),s=jest.fn(),i=jest.fn();function o(){return{sendCommand:e,getDeviceSessionState:t,getDeviceSessionStateObservable:n,setDeviceSessionState:s,getManagerApiService:i}}export{o as makeDeviceActionInternalApiMock};
|
2
2
|
//# sourceMappingURL=makeInternalApi.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/device-action/__test-utils__/makeInternalApi.ts"],
|
4
|
-
"sourcesContent": ["import { type InternalApi } from \"@api/device-action/DeviceAction\";\n\nconst sendCommandMock = jest.fn();\nconst apiGetDeviceSessionStateMock = jest.fn();\nconst apiGetDeviceSessionStateObservableMock = jest.fn();\nconst setDeviceSessionStateMock = jest.fn();\nconst
|
5
|
-
"mappings": "AAEA,MAAMA,EAAkB,KAAK,GAAG,EAC1BC,EAA+B,KAAK,GAAG,EACvCC,EAAyC,KAAK,GAAG,EACjDC,EAA4B,KAAK,GAAG,EACpCC,
|
6
|
-
"names": ["sendCommandMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "setDeviceSessionStateMock", "
|
4
|
+
"sourcesContent": ["import { type InternalApi } from \"@api/device-action/DeviceAction\";\n\nconst sendCommandMock = jest.fn();\nconst apiGetDeviceSessionStateMock = jest.fn();\nconst apiGetDeviceSessionStateObservableMock = jest.fn();\nconst setDeviceSessionStateMock = jest.fn();\nconst getManagerApiServiceMock = jest.fn();\n\nexport function makeDeviceActionInternalApiMock(): jest.Mocked<InternalApi> {\n return {\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n getDeviceSessionStateObservable: apiGetDeviceSessionStateObservableMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n getManagerApiService: getManagerApiServiceMock,\n };\n}\n"],
|
5
|
+
"mappings": "AAEA,MAAMA,EAAkB,KAAK,GAAG,EAC1BC,EAA+B,KAAK,GAAG,EACvCC,EAAyC,KAAK,GAAG,EACjDC,EAA4B,KAAK,GAAG,EACpCC,EAA2B,KAAK,GAAG,EAElC,SAASC,GAA4D,CAC1E,MAAO,CACL,YAAaL,EACb,sBAAuBC,EACvB,gCAAiCC,EACjC,sBAAuBC,EACvB,qBAAsBC,CACxB,CACF",
|
6
|
+
"names": ["sendCommandMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "setDeviceSessionStateMock", "getManagerApiServiceMock", "makeDeviceActionInternalApiMock"]
|
7
7
|
}
|
package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{interval as
|
1
|
+
import{interval as h,Observable as k}from"rxjs";import{CommandResultFactory as v}from"../../../command/model/CommandResult";import{GLOBAL_ERRORS as T,GlobalCommandError as g}from"../../../command/utils/GlobalCommandError";import{DeviceModelId as S}from"../../../device/DeviceModel";import{DeviceStatus as i}from"../../../device/DeviceStatus";import{makeDeviceActionInternalApiMock as a}from"../../../device-action/__test-utils__/makeInternalApi";import{testDeviceActionStates as d}from"../../../device-action/__test-utils__/testDeviceActionStates";import{DeviceActionStatus as t}from"../../../device-action/model/DeviceActionState";import{UserInteractionRequired as c}from"../../../device-action/model/UserInteractionRequired";import{DeviceLockedError as x,DeviceNotOnboardedError as L,UnknownDAError as E}from"../../../device-action/os/Errors";import{DeviceSessionStateType as o}from"../../../device-session/DeviceSessionState";import{GetDeviceStatusDeviceAction as p}from"./GetDeviceStatusDeviceAction";describe("GetDeviceStatusDeviceAction",()=>{const D=jest.fn(),m=jest.fn(),C=jest.fn(),f=jest.fn(),y=jest.fn();function l(){return{getAppAndVersion:D,getDeviceSessionState:m,waitForDeviceUnlock:C,setDeviceSessionState:f,isDeviceOnboarded:y}}const{sendCommand:O,getDeviceSessionState:R,getDeviceSessionStateObservable:V}=a();beforeEach(()=>{jest.resetAllMocks(),y.mockReturnValue(!0)}),describe("without overriding `extractDependencies`",()=>{it("should run the device action with an unlocked device",r=>{const e=new p({input:{unlockTimeout:500}});R.mockReturnValue({sessionStateType:o.Connected,deviceStatus:i.CONNECTED,deviceModelId:S.FLEX}),O.mockResolvedValue(v({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:c.None},status:t.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.Completed}];d(e,n,a(),r)}),it("should run the device action with a locked device",r=>{const e=new p({input:{unlockTimeout:500}});R.mockReturnValue({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.FLEX}),V.mockImplementation(()=>new k(s=>{const u=h(50).subscribe({next:A=>{A>2?(s.next({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.FLEX}),s.complete()):s.next({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.FLEX})}});return()=>{u.unsubscribe()}})),O.mockResolvedValue(v({data:{name:"BOLOS",version:"1.0.0"}}));const n=[{intermediateValue:{requiredUserInteraction:c.UnlockDevice},status:t.Pending},{intermediateValue:{requiredUserInteraction:c.None},status:t.Pending},{output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"},status:t.Completed}];d(e,n,a(),r)})}),describe("success cases",()=>{it("should return the device status if the device is unlocked",r=>{m.mockReturnValue({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),D.mockResolvedValue(v({data:{name:"BOLOS",version:"1.0.0"}}));const e=new p({input:{unlockTimeout:void 0}});jest.spyOn(e,"extractDependencies").mockReturnValue(l());const n=[{intermediateValue:{requiredUserInteraction:c.None},status:t.Pending},{status:t.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];d(e,n,a(),r)}),it("should return the device status if the device is locked and the user unlocks the device",r=>{m.mockReturnValue({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),D.mockResolvedValue(v({data:{name:"BOLOS",version:"1.0.0"}})),C.mockImplementation(()=>new k(s=>{const u=h(50).subscribe({next:A=>{A>2?(s.next({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),s.complete()):s.next({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{u.unsubscribe()}}));const e=new p({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(l());const n=[{intermediateValue:{requiredUserInteraction:c.UnlockDevice},status:t.Pending},{intermediateValue:{requiredUserInteraction:c.None},status:t.Pending},{status:t.Completed,output:{currentApp:"BOLOS",currentAppVersion:"1.0.0"}}];d(e,n,a(),r)})}),describe("errors cases",()=>{it("should end in an error if the device is not onboarded",r=>{m.mockReturnValue({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),y.mockReturnValue(!1);const e=new p({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(l());const n=[{error:new L,status:t.Error}];d(e,n,a(),r)}),it("should end in an error if the device is locked and the user does not unlock",r=>{m.mockReturnValue({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),V.mockImplementation(()=>new k(s=>{const u=h(200).subscribe({next:()=>{s.next({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.FLEX})}});return()=>{u.unsubscribe()}}));const e=new p({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(l());const n=[{intermediateValue:{requiredUserInteraction:c.UnlockDevice},status:t.Pending},{error:new x("Device locked."),status:t.Error}];d(e,n,a(),r)}),it("should end in an error if the GetAppAndVersion command fails",r=>{m.mockReturnValue({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}});const e=new g({...T[5501],errorCode:"5501"});D.mockResolvedValue(v({error:e})),C.mockImplementation(()=>new k(u=>{const A=h(50).subscribe({next:b=>{b>2?(u.next({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),u.complete()):u.next({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}})}});return()=>{A.unsubscribe()}}));const n=new p({input:{unlockTimeout:500}});jest.spyOn(n,"extractDependencies").mockReturnValue(l());const s=[{intermediateValue:{requiredUserInteraction:c.UnlockDevice},status:t.Pending},{intermediateValue:{requiredUserInteraction:c.None},status:t.Pending},{error:e,status:t.Error}];d(n,s,a(),r)}),it("should end in an error if getAppAndVersion actor throws an error",r=>{m.mockReturnValue({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.LOCKED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"}}),D.mockImplementation(()=>{throw new E("error")}),C.mockImplementation(()=>new k(s=>{s.complete()}));const e=new p({input:{unlockTimeout:500}});jest.spyOn(e,"extractDependencies").mockReturnValue(l());const n=[{intermediateValue:{requiredUserInteraction:c.UnlockDevice},status:t.Pending},{intermediateValue:{requiredUserInteraction:c.None},status:t.Pending},{error:new E("error"),status:t.Error}];d(e,n,a(),r)})}),it("should emit a stopped state if the action is cancelled",r=>{R.mockReturnValue({sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,currentApp:{name:"mockedCurrentApp",version:"1.0.0"},installedApps:[],deviceModelId:S.FLEX}),O.mockResolvedValue(v({data:{name:"BOLOS",version:"1.0.0"}}));const e=new p({input:{unlockTimeout:500}}),n=[{status:t.Pending,intermediateValue:{requiredUserInteraction:c.None}},{status:t.Stopped}],{cancel:s}=d(e,n,a(),r);s()})});
|
2
2
|
//# sourceMappingURL=GetDeviceStatusDeviceAction.test.js.map
|
package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../../src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.ts"],
|
4
|
-
"sourcesContent": ["import { interval, Observable } from \"rxjs\";\n\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport {\n GLOBAL_ERRORS,\n GlobalCommandError,\n} from \"@api/command/utils/GlobalCommandError\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport { DeviceActionStatus } from \"@api/device-action/model/DeviceActionState\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport {\n DeviceLockedError,\n DeviceNotOnboardedError,\n UnknownDAError,\n} from \"@api/device-action/os/Errors\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\n\nimport { GetDeviceStatusDeviceAction } from \"./GetDeviceStatusDeviceAction\";\nimport { type GetDeviceStatusDAState } from \"./types\";\n\ndescribe(\"GetDeviceStatusDeviceAction\", () => {\n const getAppAndVersionMock = jest.fn();\n const getDeviceSessionStateMock = jest.fn();\n const waitForDeviceUnlockMock = jest.fn();\n const setDeviceSessionState = jest.fn();\n const isDeviceOnboardedMock = jest.fn();\n\n function extractDependenciesMock() {\n return {\n getAppAndVersion: getAppAndVersionMock,\n getDeviceSessionState: getDeviceSessionStateMock,\n waitForDeviceUnlock: waitForDeviceUnlockMock,\n setDeviceSessionState: setDeviceSessionState,\n isDeviceOnboarded: isDeviceOnboardedMock,\n };\n }\n\n const {\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n getDeviceSessionStateObservable: apiGetDeviceSessionStateObservableMock,\n } = makeDeviceActionInternalApiMock();\n beforeEach(() => {\n jest.resetAllMocks();\n isDeviceOnboardedMock.mockReturnValue(true);\n });\n\n describe(\"without overriding `extractDependencies`\", () => {\n it(\"should run the device action with an unlocked device\", (done) => {\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n });\n\n sendCommandMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should run the device action with a locked device\", (done) => {\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n });\n\n apiGetDeviceSessionStateObservableMock.mockImplementation(\n () =>\n new Observable((o) => {\n const inner = interval(50).subscribe({\n next: (i) => {\n if (i > 2) {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n });\n o.complete();\n } else {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n });\n }\n },\n });\n\n return () => {\n inner.unsubscribe();\n };\n }),\n );\n\n sendCommandMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"success cases\", () => {\n it(\"should return the device status if the device is unlocked\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: undefined },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Completed,\n output: {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should return the device status if the device is locked and the user unlocks the device\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n waitForDeviceUnlockMock.mockImplementation(\n () =>\n new Observable((o) => {\n const inner = interval(50).subscribe({\n next: (i) => {\n if (i > 2) {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n o.complete();\n } else {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n }\n },\n });\n\n return () => {\n inner.unsubscribe();\n };\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Completed,\n output: {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"errors cases\", () => {\n it(\"should end in an error if the device is not onboarded\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n isDeviceOnboardedMock.mockReturnValue(false);\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n error: new DeviceNotOnboardedError(),\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should end in an error if the device is locked and the user does not unlock\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n apiGetDeviceSessionStateObservableMock.mockImplementation(\n () =>\n new Observable((o) => {\n const inner = interval(200).subscribe({\n next: () => {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n });\n },\n });\n\n return () => {\n inner.unsubscribe();\n };\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n error: new DeviceLockedError(\"Device locked.\"),\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should end in an error if the GetAppAndVersion command fails\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n const error = new GlobalCommandError({\n ...GLOBAL_ERRORS[\"5501\"],\n errorCode: \"5501\",\n });\n\n getAppAndVersionMock.mockResolvedValue(CommandResultFactory({ error }));\n\n waitForDeviceUnlockMock.mockImplementation(\n () =>\n new Observable((o) => {\n const inner = interval(50).subscribe({\n next: (i) => {\n if (i > 2) {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n o.complete();\n } else {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n }\n },\n });\n\n return () => {\n inner.unsubscribe();\n };\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n error,\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should end in an error if getAppAndVersion actor throws an error\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n getAppAndVersionMock.mockImplementation(() => {\n throw new UnknownDAError(\"error\");\n });\n\n waitForDeviceUnlockMock.mockImplementation(\n () =>\n new Observable((o) => {\n o.complete();\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n error: new UnknownDAError(\"error\"),\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n it(\"should emit a stopped state if the action is cancelled\", (done) => {\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n });\n\n sendCommandMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Stopped,\n },\n ];\n\n const { cancel } = testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n cancel();\n });\n});\n"],
|
5
|
-
"mappings": "AAAA,OAAS,YAAAA,EAAU,cAAAC,MAAkB,OAErC,OAAS,wBAAAC,MAA4B,mCACrC,OACE,iBAAAC,EACA,sBAAAC,MACK,wCACP,OAAS,gBAAAC,MAAoB,2BAC7B,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,0BAAAC,MAA8B,2DACvC,OAAS,sBAAAC,MAA0B,6CACnC,OAAS,2BAAAC,MAA+B,mDACxC,OACE,qBAAAC,EACA,2BAAAC,EACA,kBAAAC,MACK,+BACP,OAAS,0BAAAC,MAA8B,yCAEvC,OAAS,+BAAAC,MAAmC,gCAG5C,SAAS,8BAA+B,IAAM,CAC5C,MAAMC,EAAuB,KAAK,GAAG,EAC/BC,EAA4B,KAAK,GAAG,EACpCC,EAA0B,KAAK,GAAG,EAClCC,EAAwB,KAAK,GAAG,EAChCC,EAAwB,KAAK,GAAG,EAEtC,SAASC,GAA0B,CACjC,MAAO,CACL,iBAAkBL,EAClB,sBAAuBC,EACvB,oBAAqBC,EACrB,sBAAuBC,EACvB,kBAAmBC,CACrB,CACF,CAEA,KAAM,CACJ,YAAaE,EACb,sBAAuBC,EACvB,gCAAiCC,CACnC,EAAIjB,EAAgC,EACpC,WAAW,IAAM,CACf,KAAK,cAAc,EACnBa,EAAsB,gBAAgB,EAAI,CAC5C,CAAC,EAED,SAAS,2CAA4C,IAAM,CACzD,GAAG,uDAAyDK,GAAS,CACnE,MAAMC,EAA6B,IAAIX,EAA4B,CACjE,MAAO,CAAE,cAAe,GAAI,CAC9B,CAAC,EAEDQ,EAA6B,gBAAgB,CAC3C,iBAAkBT,EAAuB,UACzC,aAAcR,EAAa,
|
6
|
-
"names": ["interval", "Observable", "CommandResultFactory", "GLOBAL_ERRORS", "GlobalCommandError", "DeviceStatus", "makeDeviceActionInternalApiMock", "testDeviceActionStates", "DeviceActionStatus", "UserInteractionRequired", "DeviceLockedError", "DeviceNotOnboardedError", "UnknownDAError", "DeviceSessionStateType", "GetDeviceStatusDeviceAction", "getAppAndVersionMock", "getDeviceSessionStateMock", "waitForDeviceUnlockMock", "setDeviceSessionState", "isDeviceOnboardedMock", "extractDependenciesMock", "sendCommandMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "done", "getDeviceStateDeviceAction", "expectedStates", "
|
4
|
+
"sourcesContent": ["import { interval, Observable } from \"rxjs\";\n\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport {\n GLOBAL_ERRORS,\n GlobalCommandError,\n} from \"@api/command/utils/GlobalCommandError\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport { DeviceActionStatus } from \"@api/device-action/model/DeviceActionState\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport {\n DeviceLockedError,\n DeviceNotOnboardedError,\n UnknownDAError,\n} from \"@api/device-action/os/Errors\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\n\nimport { GetDeviceStatusDeviceAction } from \"./GetDeviceStatusDeviceAction\";\nimport { type GetDeviceStatusDAState } from \"./types\";\n\ndescribe(\"GetDeviceStatusDeviceAction\", () => {\n const getAppAndVersionMock = jest.fn();\n const getDeviceSessionStateMock = jest.fn();\n const waitForDeviceUnlockMock = jest.fn();\n const setDeviceSessionState = jest.fn();\n const isDeviceOnboardedMock = jest.fn();\n\n function extractDependenciesMock() {\n return {\n getAppAndVersion: getAppAndVersionMock,\n getDeviceSessionState: getDeviceSessionStateMock,\n waitForDeviceUnlock: waitForDeviceUnlockMock,\n setDeviceSessionState: setDeviceSessionState,\n isDeviceOnboarded: isDeviceOnboardedMock,\n };\n }\n\n const {\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n getDeviceSessionStateObservable: apiGetDeviceSessionStateObservableMock,\n } = makeDeviceActionInternalApiMock();\n beforeEach(() => {\n jest.resetAllMocks();\n isDeviceOnboardedMock.mockReturnValue(true);\n });\n\n describe(\"without overriding `extractDependencies`\", () => {\n it(\"should run the device action with an unlocked device\", (done) => {\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: DeviceModelId.FLEX,\n });\n\n sendCommandMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should run the device action with a locked device\", (done) => {\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n deviceModelId: DeviceModelId.FLEX,\n });\n\n apiGetDeviceSessionStateObservableMock.mockImplementation(\n () =>\n new Observable((o) => {\n const inner = interval(50).subscribe({\n next: (i) => {\n if (i > 2) {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n deviceModelId: DeviceModelId.FLEX,\n });\n o.complete();\n } else {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n deviceModelId: DeviceModelId.FLEX,\n });\n }\n },\n });\n\n return () => {\n inner.unsubscribe();\n };\n }),\n );\n\n sendCommandMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"success cases\", () => {\n it(\"should return the device status if the device is unlocked\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: undefined },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Completed,\n output: {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should return the device status if the device is locked and the user unlocks the device\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n waitForDeviceUnlockMock.mockImplementation(\n () =>\n new Observable((o) => {\n const inner = interval(50).subscribe({\n next: (i) => {\n if (i > 2) {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n o.complete();\n } else {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n }\n },\n });\n\n return () => {\n inner.unsubscribe();\n };\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Completed,\n output: {\n currentApp: \"BOLOS\",\n currentAppVersion: \"1.0.0\",\n },\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"errors cases\", () => {\n it(\"should end in an error if the device is not onboarded\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n isDeviceOnboardedMock.mockReturnValue(false);\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n error: new DeviceNotOnboardedError(),\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should end in an error if the device is locked and the user does not unlock\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n apiGetDeviceSessionStateObservableMock.mockImplementation(\n () =>\n new Observable((o) => {\n const inner = interval(200).subscribe({\n next: () => {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n deviceModelId: DeviceModelId.FLEX,\n });\n },\n });\n\n return () => {\n inner.unsubscribe();\n };\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n error: new DeviceLockedError(\"Device locked.\"),\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should end in an error if the GetAppAndVersion command fails\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n const error = new GlobalCommandError({\n ...GLOBAL_ERRORS[\"5501\"],\n errorCode: \"5501\",\n });\n\n getAppAndVersionMock.mockResolvedValue(CommandResultFactory({ error }));\n\n waitForDeviceUnlockMock.mockImplementation(\n () =>\n new Observable((o) => {\n const inner = interval(50).subscribe({\n next: (i) => {\n if (i > 2) {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n o.complete();\n } else {\n o.next({\n sessionStateType:\n DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n }\n },\n });\n\n return () => {\n inner.unsubscribe();\n };\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n error,\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should end in an error if getAppAndVersion actor throws an error\", (done) => {\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.LOCKED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n });\n\n getAppAndVersionMock.mockImplementation(() => {\n throw new UnknownDAError(\"error\");\n });\n\n waitForDeviceUnlockMock.mockImplementation(\n () =>\n new Observable((o) => {\n o.complete();\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(getDeviceStateDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.UnlockDevice,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n error: new UnknownDAError(\"error\"),\n status: DeviceActionStatus.Error,\n },\n ];\n\n testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n it(\"should emit a stopped state if the action is cancelled\", (done) => {\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"mockedCurrentApp\", version: \"1.0.0\" },\n installedApps: [],\n deviceModelId: DeviceModelId.FLEX,\n });\n\n sendCommandMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.0.0\",\n },\n }),\n );\n\n const getDeviceStateDeviceAction = new GetDeviceStatusDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n const expectedStates: Array<GetDeviceStatusDAState> = [\n {\n status: DeviceActionStatus.Pending, // get app and version\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Stopped,\n },\n ];\n\n const { cancel } = testDeviceActionStates(\n getDeviceStateDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n cancel();\n });\n});\n"],
|
5
|
+
"mappings": "AAAA,OAAS,YAAAA,EAAU,cAAAC,MAAkB,OAErC,OAAS,wBAAAC,MAA4B,mCACrC,OACE,iBAAAC,EACA,sBAAAC,MACK,wCACP,OAAS,iBAAAC,MAAqB,0BAC9B,O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B,OAC7B,EACA,CACE,MAAO,IAAII,EAAe,OAAO,EACjC,OAAQJ,EAAmB,KAC7B,CACF,EAEAD,EACEkB,EACAC,EACApB,EAAgC,EAChCkB,CACF,CACF,CAAC,CACH,CAAC,EAED,GAAG,yDAA2DA,GAAS,CACrEF,EAA6B,gBAAgB,CAC3C,iBAAkBT,EAAuB,0BACzC,aAAcR,EAAa,UAC3B,WAAY,CAAE,KAAM,mBAAoB,QAAS,OAAQ,EACzD,cAAe,CAAC,EAChB,cAAeD,EAAc,IAC/B,CAAC,EAEDiB,EAAgB,kBACdpB,EAAqB,CACnB,KAAM,CACJ,KAAM,QACN,QAAS,OACX,CACF,CAAC,CACH,EAEA,MAAMwB,EAA6B,IAAIX,EAA4B,CACjE,MAAO,CAAE,cAAe,GAAI,CAC9B,CAAC,EAEKY,EAAgD,CACpD,CACE,OAAQlB,EAAmB,QAC3B,kBAAmB,CACjB,wBAAyBC,EAAwB,IACnD,CACF,EACA,CACE,OAAQD,EAAmB,OAC7B,CACF,EAEM,CAAE,OAAAuB,CAAO,EAAIxB,EACjBkB,EACAC,EACApB,EAAgC,EAChCkB,CACF,EACAO,EAAO,CACT,CAAC,CACH,CAAC",
|
6
|
+
"names": ["interval", "Observable", "CommandResultFactory", "GLOBAL_ERRORS", "GlobalCommandError", "DeviceModelId", "DeviceStatus", "makeDeviceActionInternalApiMock", "testDeviceActionStates", "DeviceActionStatus", "UserInteractionRequired", "DeviceLockedError", "DeviceNotOnboardedError", "UnknownDAError", "DeviceSessionStateType", "GetDeviceStatusDeviceAction", "getAppAndVersionMock", "getDeviceSessionStateMock", "waitForDeviceUnlockMock", "setDeviceSessionState", "isDeviceOnboardedMock", "extractDependenciesMock", "sendCommandMock", "apiGetDeviceSessionStateMock", "apiGetDeviceSessionStateObservableMock", "done", "getDeviceStateDeviceAction", "expectedStates", "o", "inner", "i", "error", "cancel"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{CommandResultFactory as i}from"../../../command/model/CommandResult";import{GLOBAL_ERRORS as g,GlobalCommandError as
|
1
|
+
import{CommandResultFactory as i}from"../../../command/model/CommandResult";import{GLOBAL_ERRORS as g,GlobalCommandError as f}from"../../../command/utils/GlobalCommandError";import{DeviceModelId as v}from"../../../device/DeviceModel";import{DeviceStatus as s}from"../../../device/DeviceStatus";import{makeDeviceActionInternalApiMock as a}from"../../../device-action/__test-utils__/makeInternalApi";import{setupGetDeviceStatusMock as c}from"../../../device-action/__test-utils__/setupTestMachine";import{testDeviceActionStates as u}from"../../../device-action/__test-utils__/testDeviceActionStates";import{DeviceActionStatus as e}from"../../../device-action/model/DeviceActionState";import{UserInteractionRequired as t}from"../../../device-action/model/UserInteractionRequired";import{UnknownDAError as V}from"../../../device-action/os/Errors";import{DeviceSessionStateType as d}from"../../../device-session/DeviceSessionState";import{UnknownDeviceExchangeError as h}from"../../../../../src";import{GoToDashboardDeviceAction as p}from"./GoToDashboardDeviceAction";jest.mock("@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction");describe("GoToDashboardDeviceAction",()=>{const m=jest.fn(),D=jest.fn(),l=jest.fn(),k=jest.fn();function A(){return{closeApp:m,getAppAndVersion:D,getDeviceSessionState:l,setDeviceSessionState:k}}const{sendCommand:N,getDeviceSessionState:S}=a();beforeEach(()=>{jest.resetAllMocks()}),describe("without overriding `extractDependencies`",()=>{it("should run the device action with device already on dashboard",o=>{c();const n=new p({input:{unlockTimeout:500}});S.mockReturnValue({sessionStateType:d.ReadyWithoutSecureChannel,deviceStatus:s.CONNECTED,currentApp:{name:"BOLOS",version:"1.5.0"},installedApps:[],deviceModelId:v.NANO_X});const r=[{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{output:void 0,status:e.Completed}];u(n,r,a(),o)}),it("should run the device action with device not on dashboard",o=>{c([{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]);const n=new p({input:{unlockTimeout:500}});S.mockReturnValue({sessionStateType:d.ReadyWithoutSecureChannel,deviceStatus:s.CONNECTED,currentApp:{name:"Bitcoin",version:"1.0.0"},installedApps:[],deviceModelId:v.NANO_X}),N.mockResolvedValueOnce(i({data:void 0})).mockResolvedValueOnce(i({data:{name:"BOLOS",version:"1.5.0"}}));const r=[{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{output:void 0,status:e.Completed}];u(n,r,a(),o)})}),describe("success cases",()=>{it("should success if the device is already on dashboard",o=>{c();const n=new p({input:{unlockTimeout:500}});l.mockReturnValue({sessionStateType:d.Connected,deviceStatus:s.CONNECTED,currentApp:{name:"BOLOS",version:"1.5.0"}}),D.mockReturnValue({app:"BOLOS",version:"1.5.0"}),jest.spyOn(n,"extractDependencies").mockReturnValue(A());const r=[{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{output:void 0,status:e.Completed}];u(n,r,a(),o)}),it("should success if the device is not on dashboard",o=>{c();const n=new p({input:{unlockTimeout:500}});jest.spyOn(n,"extractDependencies").mockReturnValue(A()),l.mockReturnValue({sessionStateType:d.Connected,deviceStatus:s.CONNECTED}),m.mockResolvedValue(i({data:void 0})),D.mockReturnValue(i({data:{name:"BOLOS",version:"1.5.0"}}));const r=[{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{output:void 0,status:e.Completed}];u(n,r,a(),o)})}),describe("error cases",()=>{it("should return an error if GetDeviceStatus return an error",o=>{c([new V("Unknown error")]);const n=new p({input:{unlockTimeout:500}});S.mockReturnValue({sessionStateType:d.ReadyWithoutSecureChannel,deviceStatus:s.CONNECTED,currentApp:{name:"BOLOS",version:"1.5.0"},installedApps:[],deviceModelId:v.NANO_X});const r=[{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{status:e.Error,error:new V("Unknown error")}];u(n,r,a(),o)}),describe("not on dashboard",()=>{it("should return an error if closeApp fails",o=>{c([{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]);const n=new p({input:{}});jest.spyOn(n,"extractDependencies").mockReturnValue(A()),l.mockReturnValue({sessionStateType:d.Connected,deviceStatus:s.CONNECTED,currentApp:"Bitcoin"}),m.mockReturnValue(i({error:new h("Close app failed")}));const r=[{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{status:e.Error,error:new h("Close app failed")}];u(n,r,a(),o)}),it("should return an error if getAppAndVersion fails",o=>{c([{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]);const n=new p({input:{unlockTimeout:500}}),r=new f({...g[5501],errorCode:"5501"});jest.spyOn(n,"extractDependencies").mockReturnValue(A()),l.mockReturnValue({sessionStateType:d.Connected,deviceStatus:s.CONNECTED,currentApp:"Bitcoin"}),m.mockResolvedValue(i({data:void 0})),D.mockResolvedValue(i({error:r}));const T=[{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{status:e.Error,error:r}];u(n,T,a(),o)}),it("should return an error if getAppAndVersion does not return an app name",o=>{c([{currentApp:"Bitcoin",currentAppVersion:"1.0.0"}]);const n=new p({input:{unlockTimeout:500}});jest.spyOn(n,"extractDependencies").mockReturnValue(A()),l.mockReturnValue({sessionStateType:d.Connected,deviceStatus:s.CONNECTED,currentApp:"Bitcoin"}),m.mockResolvedValue(i({data:void 0})),D.mockResolvedValue(i({data:{name:null,version:"1.0.0"}}));const r=[{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{intermediateValue:{requiredUserInteraction:t.None},status:e.Pending},{status:e.Error,error:new V("currentApp === null")}];u(n,r,a(),o)})})})});
|
2
2
|
//# sourceMappingURL=GoToDashboardDeviceAction.test.js.map
|
package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../../src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.test.ts"],
|
4
|
-
"sourcesContent": ["import { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport {\n GLOBAL_ERRORS,\n GlobalCommandError,\n} from \"@api/command/utils/GlobalCommandError\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { setupGetDeviceStatusMock } from \"@api/device-action/__test-utils__/setupTestMachine\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport { DeviceActionStatus } from \"@api/device-action/model/DeviceActionState\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport { UnknownDeviceExchangeError } from \"@root/src\";\n\nimport { GoToDashboardDeviceAction } from \"./GoToDashboardDeviceAction\";\nimport { type GoToDashboardDAState } from \"./types\";\n\njest.mock(\"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\");\n\ndescribe(\"GoToDashboardDeviceAction\", () => {\n const closeAppMock = jest.fn();\n const getAppAndVersionMock = jest.fn();\n const getDeviceSessionStateMock = jest.fn();\n const setDeviceSessionStateMock = jest.fn();\n\n function extractDependenciesMock() {\n return {\n closeApp: closeAppMock,\n getAppAndVersion: getAppAndVersionMock,\n getDeviceSessionState: getDeviceSessionStateMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n };\n }\n\n const {\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n } = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n describe(\"without overriding `extractDependencies`\", () => {\n it(\"should run the device action with device already on dashboard\", (done) => {\n setupGetDeviceStatusMock();\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"1.5.0\" },\n installedApps: [],\n });\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GetDeviceStatus events (mocked for tests)\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: undefined,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should run the device action with device not on dashboard\", (done) => {\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"Bitcoin\", version: \"1.0.0\" },\n installedApps: [],\n });\n\n sendCommandMock\n .mockResolvedValueOnce(CommandResultFactory({ data: undefined }))\n .mockResolvedValueOnce(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.5.0\",\n },\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: undefined,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"success cases\", () => {\n it(\"should success if the device is already on dashboard\", (done) => {\n setupGetDeviceStatusMock();\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"1.5.0\" },\n });\n\n getAppAndVersionMock.mockReturnValue({\n app: \"BOLOS\",\n version: \"1.5.0\",\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: undefined,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should success if the device is not on dashboard\", (done) => {\n setupGetDeviceStatusMock();\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n });\n\n closeAppMock.mockResolvedValue(CommandResultFactory({ data: undefined }));\n getAppAndVersionMock.mockReturnValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.5.0\",\n },\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: undefined,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"error cases\", () => {\n it(\"should return an error if GetDeviceStatus return an error\", (done) => {\n setupGetDeviceStatusMock([new UnknownDAError(\"Unknown error\")]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"1.5.0\" },\n installedApps: [],\n });\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Unknown error\"),\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n describe(\"not on dashboard\", () => {\n it(\"should return an error if closeApp fails\", (done) => {\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: {},\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: \"Bitcoin\",\n });\n\n closeAppMock.mockReturnValue(\n CommandResultFactory({\n error: new UnknownDeviceExchangeError(\"Close app failed\"),\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDeviceExchangeError(\"Close app failed\"),\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should return an error if getAppAndVersion fails\", (done) => {\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n const error = new GlobalCommandError({\n ...GLOBAL_ERRORS[\"5501\"],\n errorCode: \"5501\",\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: \"Bitcoin\",\n });\n\n closeAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n error,\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Error,\n error,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should return an error if getAppAndVersion does not return an app name\", (done) => {\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: \"Bitcoin\",\n });\n\n closeAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: null,\n version: \"1.0.0\",\n },\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"currentApp === null\"),\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n });\n});\n"],
|
5
|
-
"mappings": "AAAA,OAAS,wBAAAA,MAA4B,mCACrC,OACE,iBAAAC,EACA,sBAAAC,MACK,wCACP,OAAS,gBAAAC,MAAoB,2BAC7B,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,4BAAAC,MAAgC,qDACzC,OAAS,0BAAAC,MAA8B,2DACvC,OAAS,sBAAAC,MAA0B,6CACnC,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,kBAAAC,MAAsB,+BAC/B,OAAS,0BAAAC,MAA8B,yCACvC,OAAS,8BAAAC,MAAkC,YAE3C,OAAS,6BAAAC,MAAiC,8BAG1C,KAAK,KAAK,mEAAmE,EAE7E,SAAS,4BAA6B,IAAM,CAC1C,MAAMC,EAAe,KAAK,GAAG,EACvBC,EAAuB,KAAK,GAAG,EAC/BC,EAA4B,KAAK,GAAG,EACpCC,EAA4B,KAAK,GAAG,EAE1C,SAASC,GAA0B,CACjC,MAAO,CACL,SAAUJ,EACV,iBAAkBC,EAClB,sBAAuBC,EACvB,sBAAuBC,CACzB,CACF,CAEA,KAAM,CACJ,YAAaE,EACb,sBAAuBC,CACzB,EAAIf,EAAgC,EAEpC,WAAW,IAAM,CACf,KAAK,cAAc,CACrB,CAAC,EAED,SAAS,2CAA4C,IAAM,CACzD,GAAG,gEAAkEgB,GAAS,CAC5Ef,EAAyB,EAEzB,MAAMgB,EAA4B,IAAIT,EAA0B,CAC9D,MAAO,CAAE,cAAe,GAAI,CAC9B,CAAC,EAEDO,EAA6B,gBAAgB,CAC3C,iBAAkBT,EAAuB,0BACzC,aAAcP,EAAa,UAC3B,WAAY,CAAE,KAAM,QAAS,QAAS,OAAQ,EAC9C,cAAe,CAAC,
|
6
|
-
"names": ["CommandResultFactory", "GLOBAL_ERRORS", "GlobalCommandError", "DeviceStatus", "makeDeviceActionInternalApiMock", "setupGetDeviceStatusMock", "testDeviceActionStates", "DeviceActionStatus", "UserInteractionRequired", "UnknownDAError", "DeviceSessionStateType", "UnknownDeviceExchangeError", "GoToDashboardDeviceAction", "closeAppMock", "getAppAndVersionMock", "getDeviceSessionStateMock", "setDeviceSessionStateMock", "extractDependenciesMock", "sendCommandMock", "apiGetDeviceSessionStateMock", "done", "goToDashboardDeviceAction", "expectedStates", "error"]
|
4
|
+
"sourcesContent": ["import { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport {\n GLOBAL_ERRORS,\n GlobalCommandError,\n} from \"@api/command/utils/GlobalCommandError\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { setupGetDeviceStatusMock } from \"@api/device-action/__test-utils__/setupTestMachine\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport { DeviceActionStatus } from \"@api/device-action/model/DeviceActionState\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport { UnknownDeviceExchangeError } from \"@root/src\";\n\nimport { GoToDashboardDeviceAction } from \"./GoToDashboardDeviceAction\";\nimport { type GoToDashboardDAState } from \"./types\";\n\njest.mock(\"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\");\n\ndescribe(\"GoToDashboardDeviceAction\", () => {\n const closeAppMock = jest.fn();\n const getAppAndVersionMock = jest.fn();\n const getDeviceSessionStateMock = jest.fn();\n const setDeviceSessionStateMock = jest.fn();\n\n function extractDependenciesMock() {\n return {\n closeApp: closeAppMock,\n getAppAndVersion: getAppAndVersionMock,\n getDeviceSessionState: getDeviceSessionStateMock,\n setDeviceSessionState: setDeviceSessionStateMock,\n };\n }\n\n const {\n sendCommand: sendCommandMock,\n getDeviceSessionState: apiGetDeviceSessionStateMock,\n } = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n describe(\"without overriding `extractDependencies`\", () => {\n it(\"should run the device action with device already on dashboard\", (done) => {\n setupGetDeviceStatusMock();\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"1.5.0\" },\n installedApps: [],\n deviceModelId: DeviceModelId.NANO_X,\n });\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending, // GetDeviceStatus events (mocked for tests)\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: undefined,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should run the device action with device not on dashboard\", (done) => {\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"Bitcoin\", version: \"1.0.0\" },\n installedApps: [],\n deviceModelId: DeviceModelId.NANO_X,\n });\n\n sendCommandMock\n .mockResolvedValueOnce(CommandResultFactory({ data: undefined }))\n .mockResolvedValueOnce(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.5.0\",\n },\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: undefined,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"success cases\", () => {\n it(\"should success if the device is already on dashboard\", (done) => {\n setupGetDeviceStatusMock();\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"1.5.0\" },\n });\n\n getAppAndVersionMock.mockReturnValue({\n app: \"BOLOS\",\n version: \"1.5.0\",\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: undefined,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should success if the device is not on dashboard\", (done) => {\n setupGetDeviceStatusMock();\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n });\n\n closeAppMock.mockResolvedValue(CommandResultFactory({ data: undefined }));\n getAppAndVersionMock.mockReturnValue(\n CommandResultFactory({\n data: {\n name: \"BOLOS\",\n version: \"1.5.0\",\n },\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: undefined,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"error cases\", () => {\n it(\"should return an error if GetDeviceStatus return an error\", (done) => {\n setupGetDeviceStatusMock([new UnknownDAError(\"Unknown error\")]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n apiGetDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: { name: \"BOLOS\", version: \"1.5.0\" },\n installedApps: [],\n deviceModelId: DeviceModelId.NANO_X,\n });\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Unknown error\"),\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n describe(\"not on dashboard\", () => {\n it(\"should return an error if closeApp fails\", (done) => {\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: {},\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: \"Bitcoin\",\n });\n\n closeAppMock.mockReturnValue(\n CommandResultFactory({\n error: new UnknownDeviceExchangeError(\"Close app failed\"),\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDeviceExchangeError(\"Close app failed\"),\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should return an error if getAppAndVersion fails\", (done) => {\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n const error = new GlobalCommandError({\n ...GLOBAL_ERRORS[\"5501\"],\n errorCode: \"5501\",\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: \"Bitcoin\",\n });\n\n closeAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n error,\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Error,\n error,\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n\n it(\"should return an error if getAppAndVersion does not return an app name\", (done) => {\n setupGetDeviceStatusMock([\n {\n currentApp: \"Bitcoin\",\n currentAppVersion: \"1.0.0\",\n },\n ]);\n\n const goToDashboardDeviceAction = new GoToDashboardDeviceAction({\n input: { unlockTimeout: 500 },\n });\n\n jest\n .spyOn(goToDashboardDeviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n getDeviceSessionStateMock.mockReturnValue({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: \"Bitcoin\",\n });\n\n closeAppMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n getAppAndVersionMock.mockResolvedValue(\n CommandResultFactory({\n data: {\n name: null,\n version: \"1.0.0\",\n },\n }),\n );\n\n const expectedStates: Array<GoToDashboardDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"currentApp === null\"),\n },\n ];\n\n testDeviceActionStates(\n goToDashboardDeviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n });\n});\n"],
|
5
|
+
"mappings": "AAAA,OAAS,wBAAAA,MAA4B,mCACrC,OACE,iBAAAC,EACA,sBAAAC,MACK,wCACP,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,gBAAAC,MAAoB,2BAC7B,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,4BAAAC,MAAgC,qDACzC,OAAS,0BAAAC,MAA8B,2DACvC,OAAS,sBAAAC,MAA0B,6CACnC,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,kBAAAC,MAAsB,+BAC/B,OAAS,0BAAAC,MAA8B,yCACvC,OAAS,8BAAAC,MAAkC,YAE3C,OAAS,6BAAAC,MAAiC,8BAG1C,KAAK,KAAK,mEAAmE,EAE7E,SAAS,4BAA6B,IAAM,CAC1C,MAAMC,EAAe,KAAK,GAAG,EACvBC,EAAuB,KAAK,GAAG,EAC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IACnD,EACA,OAAQD,EAAmB,OAC7B,EACA,CACE,kBAAmB,CACjB,wBAAyBC,EAAwB,IACnD,EACA,OAAQD,EAAmB,OAC7B,EACA,CACE,OAAQA,EAAmB,MAC3B,MAAO,IAAIE,EAAe,qBAAqB,CACjD,CACF,EAEAH,EACEe,EACAC,EACAlB,EAAgC,EAChCgB,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
|
6
|
+
"names": ["CommandResultFactory", "GLOBAL_ERRORS", "GlobalCommandError", "DeviceModelId", "DeviceStatus", "makeDeviceActionInternalApiMock", "setupGetDeviceStatusMock", "testDeviceActionStates", "DeviceActionStatus", "UserInteractionRequired", "UnknownDAError", "DeviceSessionStateType", "UnknownDeviceExchangeError", "GoToDashboardDeviceAction", "closeAppMock", "getAppAndVersionMock", "getDeviceSessionStateMock", "setDeviceSessionStateMock", "extractDependenciesMock", "sendCommandMock", "apiGetDeviceSessionStateMock", "done", "goToDashboardDeviceAction", "expectedStates", "error"]
|
7
7
|
}
|
package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{Left as l,Right as
|
1
|
+
import{Left as l,Right as d}from"purify-ts";import{assign as s,fromCallback as M,fromPromise as y,setup as m}from"xstate";import{UserInteractionRequired as r}from"../../../device-action/model/UserInteractionRequired";import{DEFAULT_UNLOCK_TIMEOUT_MS as D}from"../../../device-action/os/Const";import{ListAppsDeviceAction as v}from"../../../device-action/os/ListApps/ListAppsDeviceAction";import{XStateDeviceAction as L}from"../../../device-action/xstate-utils/XStateDeviceAction";class O extends L{makeStateMachine(a){const{getAppsByHash:i,saveSessionState:o,getDeviceSessionState:c}=this.extractDependencies(a),p=this.input.unlockTimeout??D,A=new v({input:{unlockTimeout:p}}).makeStateMachine(a);return m({types:{input:{unlockTimeout:p},context:{},output:{}},actors:{listApps:A,getAppsByHash:y(i),saveSessionState:M(({input:t,sendBack:e})=>{const{appsWithMetadata:u}=t,h=u.filter(n=>n!==null),S={...c(),installedApps:h};try{o(S),e({type:"done"})}catch(n){e({type:"error",error:n})}})},guards:{hasError:({context:t})=>t._internalState.error!==null,hasNoAppsInstalled:({context:t})=>t._internalState.apps.length===0},actions:{assignErrorFromEvent:s({_internalState:t=>({...t.context._internalState,error:t.event.error})})}}).createMachine({id:"ListAppsWithMetadataDeviceAction",initial:"DeviceReady",context:t=>({input:t.input,_internalState:{error:null,apps:[],appsWithMetadata:[]},intermediateValue:{requiredUserInteraction:r.None}}),states:{DeviceReady:{always:{target:"ListApps"}},ListApps:{invoke:{id:"listApps",src:"listApps",input:t=>({unlockTimeout:t.context.input.unlockTimeout}),onSnapshot:{actions:s({intermediateValue:t=>t.event.snapshot.context.intermediateValue})},onDone:{target:"ListAppsCheck",actions:s({intermediateValue:t=>({requiredUserInteraction:r.None}),_internalState:t=>t.event.output.caseOf({Right:e=>({...t.context._internalState,apps:e}),Left:e=>({...t.context._internalState,error:e})})})}}},ListAppsCheck:{always:[{target:"Error",guard:"hasError"},{target:"Success",guard:"hasNoAppsInstalled",actions:s({_internalState:t=>({...t.context._internalState,appsWithMetadata:[]})})},{target:"FetchMetadata"}]},FetchMetadata:{invoke:{id:"getAppsByHash",src:"getAppsByHash",input:t=>t.context._internalState.apps,onDone:{target:"FetchMetadataCheck",actions:s({_internalState:t=>t.event.output.caseOf({Right:e=>({...t.context._internalState,appsWithMetadata:e}),Left:e=>({...t.context._internalState,error:e})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},FetchMetadataCheck:{always:[{target:"Error",guard:"hasError"},{target:"SaveSession"}]},SaveSession:{invoke:{src:"saveSessionState",input:t=>({appsWithMetadata:t.context._internalState.appsWithMetadata})},on:{done:{target:"Success"},error:{target:"Error",actions:"assignErrorFromEvent"}}},Success:{type:"final"},Error:{type:"final"}},output:t=>t.context._internalState.error?l(t.context._internalState.error):d(t.context._internalState.appsWithMetadata)})}extractDependencies(a){return{getAppsByHash:({input:i})=>a.getManagerApiService().getAppsByHash(i),getDeviceSessionState:()=>a.getDeviceSessionState(),saveSessionState:i=>a.setDeviceSessionState(i)}}}export{O as ListAppsWithMetadataDeviceAction};
|
2
2
|
//# sourceMappingURL=ListAppsWithMetadataDeviceAction.js.map
|