@ledgerhq/device-management-kit 0.0.0-develop-20250106155719 → 0.0.0-rnble-transport-20250219100517
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/README.md +27 -31
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/package.json +12 -8
- 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/DeviceManagementKitBuilder.test.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKitBuilder.test.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/apdu/utils/ByteArrayParser.test.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ByteArrayParser.test.js.map +2 -2
- package/lib/cjs/src/api/command/model/CommandResult.js.map +1 -1
- package/lib/cjs/src/api/command/os/LoadCertificateCommand.js +2 -0
- package/lib/cjs/src/api/command/os/LoadCertificateCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/LoadCertificateCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/LoadCertificateCommand.test.js.map +7 -0
- 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 +3 -3
- package/lib/cjs/src/api/command/utils/CommandUtils.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.js.map +3 -3
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
- 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/__test-utils__/setupTestMachine.js +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +2 -2
- package/lib/cjs/src/api/device-action/__test-utils__/testDeviceActionStates.js +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/testDeviceActionStates.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +2 -0
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +7 -0
- 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/ListApps/ListAppsDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.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/SendCommandInAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +3 -3
- 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-action/xstate-utils/XStateDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
- 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 +3 -3
- package/lib/cjs/src/api/index.js +1 -1
- package/lib/cjs/src/api/index.js.map +3 -3
- package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js +1 -1
- package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +2 -2
- package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
- package/lib/cjs/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +2 -2
- package/lib/cjs/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js +1 -1
- package/lib/cjs/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js.map +2 -2
- package/lib/cjs/src/api/transport/model/DeviceApduSender.js +2 -0
- package/lib/cjs/src/api/transport/model/DeviceApduSender.js.map +7 -0
- package/lib/cjs/src/api/transport/model/DeviceConnectionFactory.stub.js +1 -1
- package/lib/cjs/src/api/transport/model/DeviceConnectionFactory.stub.js.map +2 -2
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +2 -0
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +7 -0
- package/lib/cjs/src/api/transport/model/DiscoveredDevice.js +1 -1
- package/lib/cjs/src/api/transport/model/DiscoveredDevice.js.map +1 -1
- package/lib/cjs/src/api/transport/model/Errors.js +1 -1
- package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
- package/lib/cjs/src/api/transport/model/TransportConnectedDevice.stub.js +1 -1
- package/lib/cjs/src/api/transport/model/TransportConnectedDevice.stub.js.map +2 -2
- package/lib/cjs/src/api/transport/model/TransportDiscoveredDevice.js +1 -1
- package/lib/cjs/src/api/transport/model/TransportDiscoveredDevice.js.map +1 -1
- package/lib/cjs/src/api/transport/model/__mocks__/TransportMock.js +1 -1
- package/lib/cjs/src/api/transport/model/__mocks__/TransportMock.js.map +2 -2
- package/lib/cjs/src/api/types.js.map +1 -1
- package/lib/cjs/src/api/utils/Base64String.test.js +1 -1
- package/lib/cjs/src/api/utils/Base64String.test.js.map +2 -2
- package/lib/cjs/src/api/utils/HexaString.js +1 -1
- package/lib/cjs/src/api/utils/HexaString.js.map +2 -2
- package/lib/cjs/src/api/utils/HexaString.test.js +1 -1
- package/lib/cjs/src/api/utils/HexaString.test.js.map +2 -2
- package/lib/cjs/src/di.js +1 -1
- package/lib/cjs/src/di.js.map +3 -3
- package/lib/cjs/src/di.stub.js +1 -1
- package/lib/cjs/src/di.stub.js.map +2 -2
- package/lib/cjs/src/internal/config/data/LocalConfigDataSource.test.js +1 -1
- package/lib/cjs/src/internal/config/data/LocalConfigDataSource.test.js.map +3 -3
- package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.test.js +1 -1
- package/lib/cjs/src/internal/config/data/RemoteConfigDataSource.test.js.map +2 -2
- package/lib/cjs/src/internal/config/data/__mocks__/LocalConfigDataSource.js +1 -1
- package/lib/cjs/src/internal/config/data/__mocks__/LocalConfigDataSource.js.map +2 -2
- package/lib/cjs/src/internal/config/data/__mocks__/RemoteConfigDataSource.js +1 -1
- package/lib/cjs/src/internal/config/data/__mocks__/RemoteConfigDataSource.js.map +2 -2
- package/lib/cjs/src/internal/config/service/DefaultConfigService.test.js +1 -1
- package/lib/cjs/src/internal/config/service/DefaultConfigService.test.js.map +2 -2
- package/lib/cjs/src/internal/config/use-case/GetDmkVersionUseCase.test.js +1 -1
- package/lib/cjs/src/internal/config/use-case/GetDmkVersionUseCase.test.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/model/DeviceSession.stub.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSession.stub.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
- package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.test.js +1 -1
- package/lib/cjs/src/internal/device-session/service/DefaultApduReceiverService.test.js.map +2 -2
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
- 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 +3 -3
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.js +1 -1
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.js.map +3 -3
- 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 +3 -3
- 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 +3 -3
- package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
- package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +2 -2
- package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js +1 -1
- package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js.map +2 -2
- package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +1 -1
- package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.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.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/Firmware.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Firmware.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +2 -2
- 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/secure-channel/data/DefaultSecureChannelDataSource.js +2 -0
- package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +2 -0
- package/lib/cjs/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/data/SecureChannelDataSource.js +2 -0
- package/lib/cjs/src/internal/secure-channel/data/SecureChannelDataSource.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js +2 -0
- package/lib/cjs/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +2 -0
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +2 -0
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/di/secureChannelTypes.js +2 -0
- package/lib/cjs/src/internal/secure-channel/di/secureChannelTypes.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/model/Const.js +2 -0
- package/lib/cjs/src/internal/secure-channel/model/Const.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/model/Errors.js +2 -0
- package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/model/Params.js +2 -0
- package/lib/cjs/src/internal/secure-channel/model/Params.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js +2 -0
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +2 -0
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js +2 -0
- package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js.map +7 -0
- 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 +3 -3
- 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/cjs/src/internal/transport/service/DefaultTransportService.js +1 -1
- package/lib/cjs/src/internal/transport/service/DefaultTransportService.js.map +3 -3
- package/lib/cjs/src/internal/transport/service/DefaultTransportService.test.js +1 -1
- package/lib/cjs/src/internal/transport/service/DefaultTransportService.test.js.map +2 -2
- package/lib/cjs/src/internal/transport/service/TransportService.js +1 -1
- package/lib/cjs/src/internal/transport/service/TransportService.js.map +1 -1
- package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
- package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
- package/lib/esm/package.json +12 -8
- 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/DeviceManagementKitBuilder.test.js +1 -1
- package/lib/esm/src/api/DeviceManagementKitBuilder.test.js.map +2 -2
- package/lib/esm/src/api/apdu/utils/ByteArrayParser.test.js +1 -1
- package/lib/esm/src/api/apdu/utils/ByteArrayParser.test.js.map +2 -2
- package/lib/esm/src/api/command/model/CommandResult.js.map +1 -1
- package/lib/esm/src/api/command/os/LoadCertificateCommand.js +2 -0
- package/lib/esm/src/api/command/os/LoadCertificateCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/LoadCertificateCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/LoadCertificateCommand.test.js.map +7 -0
- 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 +3 -3
- package/lib/esm/src/api/command/utils/CommandUtils.js +1 -1
- package/lib/esm/src/api/command/utils/CommandUtils.js.map +3 -3
- package/lib/esm/src/api/command/utils/CommandUtils.test.js +1 -1
- package/lib/esm/src/api/command/utils/CommandUtils.test.js.map +3 -3
- 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/__test-utils__/setupTestMachine.js +1 -1
- package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +2 -2
- package/lib/esm/src/api/device-action/__test-utils__/testDeviceActionStates.js +1 -1
- package/lib/esm/src/api/device-action/__test-utils__/testDeviceActionStates.js.map +3 -3
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -0
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +7 -0
- 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/ListApps/ListAppsDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.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-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
- 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 +3 -3
- package/lib/esm/src/api/index.js +1 -1
- package/lib/esm/src/api/index.js.map +3 -3
- package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js +1 -1
- package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +2 -2
- package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js +1 -1
- package/lib/esm/src/api/logger-subscriber/service/WebLogsExporterLogger.test.js.map +2 -2
- package/lib/esm/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js +1 -1
- package/lib/esm/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.js.map +2 -2
- package/lib/esm/src/api/transport/model/DeviceApduSender.js +1 -0
- package/lib/esm/src/api/transport/model/DeviceApduSender.js.map +7 -0
- package/lib/esm/src/api/transport/model/DeviceConnectionFactory.stub.js +1 -1
- package/lib/esm/src/api/transport/model/DeviceConnectionFactory.stub.js.map +2 -2
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +2 -0
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +7 -0
- package/lib/esm/src/api/transport/model/Errors.js +1 -1
- package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
- package/lib/esm/src/api/transport/model/TransportConnectedDevice.stub.js +1 -1
- package/lib/esm/src/api/transport/model/TransportConnectedDevice.stub.js.map +2 -2
- package/lib/esm/src/api/transport/model/__mocks__/TransportMock.js +1 -1
- package/lib/esm/src/api/transport/model/__mocks__/TransportMock.js.map +2 -2
- package/lib/esm/src/api/utils/Base64String.test.js +1 -1
- package/lib/esm/src/api/utils/Base64String.test.js.map +2 -2
- package/lib/esm/src/api/utils/HexaString.js +1 -1
- package/lib/esm/src/api/utils/HexaString.js.map +2 -2
- package/lib/esm/src/api/utils/HexaString.test.js +1 -1
- package/lib/esm/src/api/utils/HexaString.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/di.stub.js +1 -1
- package/lib/esm/src/di.stub.js.map +2 -2
- package/lib/esm/src/internal/config/data/LocalConfigDataSource.test.js +1 -1
- package/lib/esm/src/internal/config/data/LocalConfigDataSource.test.js.map +3 -3
- package/lib/esm/src/internal/config/data/RemoteConfigDataSource.test.js +1 -1
- package/lib/esm/src/internal/config/data/RemoteConfigDataSource.test.js.map +2 -2
- package/lib/esm/src/internal/config/data/__mocks__/LocalConfigDataSource.js +1 -1
- package/lib/esm/src/internal/config/data/__mocks__/LocalConfigDataSource.js.map +2 -2
- package/lib/esm/src/internal/config/data/__mocks__/RemoteConfigDataSource.js +1 -1
- package/lib/esm/src/internal/config/data/__mocks__/RemoteConfigDataSource.js.map +2 -2
- package/lib/esm/src/internal/config/service/DefaultConfigService.test.js +1 -1
- package/lib/esm/src/internal/config/service/DefaultConfigService.test.js.map +2 -2
- package/lib/esm/src/internal/config/use-case/GetDmkVersionUseCase.test.js +1 -1
- package/lib/esm/src/internal/config/use-case/GetDmkVersionUseCase.test.js.map +2 -2
- 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/model/DeviceSession.stub.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSession.stub.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
- package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.test.js +1 -1
- package/lib/esm/src/internal/device-session/service/DefaultApduReceiverService.test.js.map +2 -2
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js +1 -1
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
- 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 +3 -3
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.js +1 -1
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.js.map +3 -3
- 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 +3 -3
- 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 +3 -3
- package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
- package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +2 -2
- package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js +1 -1
- package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.js.map +2 -2
- package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +1 -1
- package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.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/service/DefaultManagerApiService.js +1 -1
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +2 -2
- 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/secure-channel/data/DefaultSecureChannelDataSource.js +2 -0
- package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js +2 -0
- package/lib/esm/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/data/SecureChannelDataSource.js +1 -0
- package/lib/esm/src/internal/secure-channel/data/SecureChannelDataSource.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js +2 -0
- package/lib/esm/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +2 -0
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +2 -0
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/di/secureChannelTypes.js +2 -0
- package/lib/esm/src/internal/secure-channel/di/secureChannelTypes.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/model/Const.js +2 -0
- package/lib/esm/src/internal/secure-channel/model/Const.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/model/Errors.js +2 -0
- package/lib/esm/src/internal/secure-channel/model/Errors.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/model/Params.js +1 -0
- package/lib/esm/src/internal/secure-channel/model/Params.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js +2 -0
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +2 -0
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/service/SecureChannelService.js +1 -0
- package/lib/esm/src/internal/secure-channel/service/SecureChannelService.js.map +7 -0
- 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 +3 -3
- 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/esm/src/internal/transport/service/DefaultTransportService.js +1 -1
- package/lib/esm/src/internal/transport/service/DefaultTransportService.js.map +3 -3
- package/lib/esm/src/internal/transport/service/DefaultTransportService.test.js +1 -1
- package/lib/esm/src/internal/transport/service/DefaultTransportService.test.js.map +2 -2
- package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
- package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
- package/lib/types/src/api/DeviceManagementKit.d.ts +1 -1
- 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/command/os/LoadCertificateCommand.d.ts +25 -0
- package/lib/types/src/api/command/os/LoadCertificateCommand.d.ts.map +1 -0
- package/lib/types/src/api/command/os/LoadCertificateCommand.test.d.ts +2 -0
- package/lib/types/src/api/command/os/LoadCertificateCommand.test.d.ts.map +1 -0
- package/lib/types/src/api/command/utils/CommandUtils.d.ts +1 -0
- package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
- package/lib/types/src/api/device-action/DeviceAction.d.ts +6 -1
- package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts +2 -1
- package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
- package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
- package/lib/types/src/api/device-action/__test-utils__/testDeviceActionStates.d.ts +5 -2
- package/lib/types/src/api/device-action/__test-utils__/testDeviceActionStates.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts +40 -0
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.d.ts +2 -0
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +19 -0
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -0
- 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/index.d.ts +3 -0
- package/lib/types/src/api/index.d.ts.map +1 -1
- package/lib/types/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.d.ts +1 -1
- package/lib/types/src/api/logger-subscriber/service/__mocks__/ConsoleLogger.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DeviceApduSender.d.ts +17 -0
- package/lib/types/src/api/transport/model/DeviceApduSender.d.ts.map +1 -0
- package/lib/types/src/api/transport/model/DeviceConnectionFactory.stub.d.ts +1 -1
- package/lib/types/src/api/transport/model/DeviceConnectionFactory.stub.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +60 -0
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -0
- package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts +2 -0
- package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/Errors.d.ts +41 -26
- package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/TransportDiscoveredDevice.d.ts +2 -0
- package/lib/types/src/api/transport/model/TransportDiscoveredDevice.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/__mocks__/TransportMock.d.ts +7 -7
- package/lib/types/src/api/transport/model/__mocks__/TransportMock.d.ts.map +1 -1
- package/lib/types/src/api/types.d.ts +2 -1
- package/lib/types/src/api/types.d.ts.map +1 -1
- package/lib/types/src/api/utils/HexaString.d.ts +1 -1
- package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
- package/lib/types/src/di.d.ts.map +1 -1
- package/lib/types/src/di.stub.d.ts +1 -1
- package/lib/types/src/di.stub.d.ts.map +1 -1
- package/lib/types/src/internal/config/data/__mocks__/LocalConfigDataSource.d.ts +1 -1
- package/lib/types/src/internal/config/data/__mocks__/LocalConfigDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/config/data/__mocks__/RemoteConfigDataSource.d.ts +3 -3
- package/lib/types/src/internal/config/data/__mocks__/RemoteConfigDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +10 -5
- package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts +2 -1
- package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/use-case/CloseSessionsUseCase.d.ts +4 -2
- package/lib/types/src/internal/device-session/use-case/CloseSessionsUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts +3 -1
- package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/use-case/ListenToKnownDevicesUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/use-case/StartDiscoveringUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.d.ts +5 -5
- package/lib/types/src/internal/logger-publisher/service/DefaultLoggerPublisherService.stub.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +4 -3
- 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 +24 -0
- 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 +3 -3
- package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Firmware.d.ts +4 -0
- package/lib/types/src/internal/manager-api/model/Firmware.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts +18 -0
- package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.d.ts +2 -0
- package/lib/types/src/internal/secure-channel/data/DefaultSecureChannelDataSource.test.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts +52 -0
- package/lib/types/src/internal/secure-channel/data/SecureChannelDataSource.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.d.ts +10 -0
- package/lib/types/src/internal/secure-channel/data/__mocks__/DefaultSecureChannelDataSource.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts +9 -0
- package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/di/secureChannelModule.test.d.ts +2 -0
- package/lib/types/src/internal/secure-channel/di/secureChannelModule.test.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/di/secureChannelTypes.d.ts +6 -0
- package/lib/types/src/internal/secure-channel/di/secureChannelTypes.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/model/Const.d.ts +2 -0
- package/lib/types/src/internal/secure-channel/model/Const.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/model/Errors.d.ts +8 -0
- package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/model/Params.d.ts +86 -0
- package/lib/types/src/internal/secure-channel/model/Params.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +21 -0
- package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.test.d.ts +2 -0
- package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.test.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts +21 -0
- package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -0
- package/lib/types/src/internal/transport/service/DefaultTransportService.d.ts +2 -0
- package/lib/types/src/internal/transport/service/DefaultTransportService.d.ts.map +1 -1
- package/lib/types/src/internal/transport/service/TransportService.d.ts +2 -0
- package/lib/types/src/internal/transport/service/TransportService.d.ts.map +1 -1
- package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts +7 -6
- package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +13 -9
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../../src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.ts"],
|
4
|
-
"sourcesContent": ["
|
5
|
-
"mappings": "
|
6
|
-
"names": ["Left", "Right", "assign", "createMachine", "ApduBuilder", "CommandResultFactory", "makeDeviceActionInternalApiMock", "testDeviceActionStates", "DeviceActionStatus", "UserInteractionRequired", "UnknownDAError", "OpenAppDeviceAction", "UnknownDeviceExchangeError", "SendCommandInAppDeviceAction", "setupOpenAppDAMock", "error", "sendMyCommand", "extractDependenciesMock", "apiSendCommandMock", "commandParams", "mockedCommandResponse", "deviceAction", "TestCommand", "resolve", "reject", "
|
4
|
+
"sourcesContent": ["/* eslint @typescript-eslint/consistent-type-imports:0 */\nimport { Left, Right } from \"purify-ts\";\nimport { type Mock } from \"vitest\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { type Apdu } from \"@api/apdu/model/Apdu\";\nimport { ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { type Command } from \"@api/types\";\nimport { UnknownDeviceExchangeError } from \"@root/src\";\n\nimport { SendCommandInAppDeviceAction } from \"./SendCommandInAppDeviceAction\";\nimport {\n type SendCommandInAppDAError,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n} from \"./SendCommandInAppDeviceActionTypes\";\n\nvi.mock(\n \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\",\n async (importOriginal) => {\n const original =\n await importOriginal<\n typeof import(\"../OpenAppDeviceAction/OpenAppDeviceAction\")\n >();\n\n return {\n ...original,\n OpenAppDeviceAction: vi.fn(() => ({\n makeStateMachine: vi.fn(),\n })),\n };\n },\n);\n\nconst setupOpenAppDAMock = (error?: unknown) => {\n (OpenAppDeviceAction as Mock).mockImplementation(() => ({\n makeStateMachine: vi.fn().mockImplementation(() =>\n createMachine({\n initial: \"pending\",\n states: {\n pending: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n }),\n after: {\n 0: \"done\",\n },\n },\n done: {\n type: \"final\",\n },\n },\n output: () => (error ? Left(error) : Right(undefined)),\n }),\n ),\n }));\n};\n\ndescribe(\"SendCommandInAppDeviceAction\", () => {\n const sendMyCommand = vi.fn();\n\n const extractDependenciesMock = () => ({\n sendCommand: sendMyCommand,\n });\n\n const { sendCommand: apiSendCommandMock } = makeDeviceActionInternalApiMock();\n\n const commandParams = {\n paramString: \"aParameter\",\n paramNumber: 1234,\n };\n const mockedCommandResponse = {\n aNumber: 5678,\n aString: \"mockedResponseString\",\n };\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"without mocking extractDependencies\", () => {\n it(\"should call sendCommand on internalApi with the correct parameters\", async () => {\n setupOpenAppDAMock();\n apiSendCommandMock.mockResolvedValue(\n CommandResultFactory({ data: undefined }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n });\n await new Promise<void>((resolve, reject) => {\n deviceAction\n ._execute(makeDeviceActionInternalApiMock())\n .observable.subscribe({\n error: () => reject(),\n complete: () => resolve(),\n next: () => {},\n });\n });\n\n expect(apiSendCommandMock).toHaveBeenCalledWith(\n new TestCommand(commandParams),\n );\n });\n });\n\n describe(\"error cases\", () => {\n it(\"should error and output the error if the open app fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock(new UnknownDAError(\"Mocked error\"));\n\n const expectedStates: MyCommandSendCommandDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDAError(\"Mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n }),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n\n it(\"should error and output an error if the send command fails\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n sendMyCommand.mockResolvedValue(\n CommandResultFactory({\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandSendCommandDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n\n describe(\"success cases\", () => {\n it(\"should succeed and output the command result if the send command succeeds\", () =>\n new Promise<void>((resolve, reject) => {\n setupOpenAppDAMock();\n\n sendMyCommand.mockResolvedValue(\n CommandResultFactory({ data: mockedCommandResponse }),\n );\n\n const deviceAction = new SendCommandInAppDeviceAction({\n input: {\n command: new TestCommand(commandParams),\n appName: \"MyApp\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n });\n\n vi.spyOn(deviceAction, \"extractDependencies\").mockImplementation(\n extractDependenciesMock,\n );\n\n const expectedStates: MyCommandSendCommandDAState[] = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n },\n {\n status: DeviceActionStatus.Completed,\n output: mockedCommandResponse,\n },\n ];\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n {\n onDone: resolve,\n onError: reject,\n },\n );\n }));\n });\n});\n\ntype MyCommandResponse = {\n aNumber: number;\n aString: string;\n};\n\ntype MyCommandParams = {\n paramString: string;\n paramNumber: number;\n};\n\nclass TestCommand implements Command<MyCommandResponse, MyCommandParams> {\n params: MyCommandParams;\n constructor(params: MyCommandParams) {\n this.params = params;\n }\n getApdu(): Apdu {\n return new ApduBuilder({ cla: 0x00, ins: 0x01, p1: 0x02, p2: 0x03 })\n .add32BitUIntToData(this.params.paramNumber)\n .addAsciiStringToData(this.params.paramString)\n .build();\n }\n parseResponse() {\n return CommandResultFactory({ data: { aNumber: 1, aString: \"aString\" } });\n }\n}\n\ntype MyCommandSendCommandDAState = DeviceActionState<\n SendCommandInAppDAOutput<MyCommandResponse>,\n SendCommandInAppDAError<UnknownDAError>,\n SendCommandInAppDAIntermediateValue<\n UserInteractionRequired.None | UserInteractionRequired.VerifyAddress\n >\n>;\n"],
|
5
|
+
"mappings": "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",
|
6
|
+
"names": ["Left", "Right", "assign", "createMachine", "ApduBuilder", "CommandResultFactory", "makeDeviceActionInternalApiMock", "testDeviceActionStates", "DeviceActionStatus", "UserInteractionRequired", "UnknownDAError", "OpenAppDeviceAction", "UnknownDeviceExchangeError", "SendCommandInAppDeviceAction", "importOriginal", "setupOpenAppDAMock", "error", "sendMyCommand", "extractDependenciesMock", "apiSendCommandMock", "commandParams", "mockedCommandResponse", "deviceAction", "TestCommand", "resolve", "reject", "expectedStates", "params"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{
|
1
|
+
import{Observable as d,ReplaySubject as S,share as I}from"rxjs";import{createActor as y}from"xstate";import{DeviceActionStatus as a}from"../../device-action/model/DeviceActionState";class D{input;inspect=!1;constructor(t){this.input=t.input,this.inspect=!!t.inspect}_execute(t){const s=this.makeStateMachine(t),n=y(s,{input:this.input}),e=new S,c=r=>{const{context:i,status:p,output:m,error:h}=r;switch(p){case"active":e.next({status:a.Pending,intermediateValue:i.intermediateValue});break;case"done":m.caseOf({Left:o=>{e.next({status:a.Error,error:o})},Right:o=>{e.next({status:a.Completed,output:o})}}),e.complete();break;case"error":e.error(h),e.complete();break;case"stopped":e.next({status:a.Stopped}),e.complete();break;default:this._exhaustiveMatchingGuard(p)}},l=new d(r=>{const i=e.subscribe(r);return()=>{u.unsubscribe(),i.unsubscribe(),n.stop()}}),u=n.subscribe(c);return n.start(),{observable:l.pipe(I()),cancel:()=>{n.stop(),u.unsubscribe(),c(n.getSnapshot())}}}_exhaustiveMatchingGuard(t){throw console.log("_exhaustiveMatchingGuard status",t),new Error(`Unhandled status: ${t}`)}}export{D as XStateDeviceAction};
|
2
2
|
//# sourceMappingURL=XStateDeviceAction.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/device-action/xstate-utils/XStateDeviceAction.ts"],
|
4
|
-
"sourcesContent": ["import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { Observable, ReplaySubject, share } from \"rxjs\";\nimport {\n createActor,\n type SnapshotFrom,\n type StateMachine,\n type StateSchema,\n} from \"xstate\";\n\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\nimport { type StateMachineTypes } from \"./StateMachineTypes\";\n\nexport type DeviceActionStateMachine<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> = StateMachine<\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"context\"], // context\n /**\n * The following usages `any` are OK because this is just a wrapper around the\n * state machine and we are not directly going to use these types.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any, // event\n any, // children\n any, // actor\n any, // action\n any, // guard\n any, // delay\n any, // state value\n any, // tag\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"input\"],\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"output\"],\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any,\n any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateSchema\n>;\n\n/**\n * A DeviceAction that uses an XState state machine to execute.\n * It maps the state machine snapshots to the DeviceActionState.\n * This class is abstract and should be extended to implement the state machine.\n */\nexport abstract class XStateDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> implements DeviceAction<Output, Input, Error, IntermediateValue>\n{\n readonly input: Input;\n readonly inspect: boolean = false;\n\n /**\n *\n * @param input The input for the DeviceAction\n * @param inspect If true, the state machine will be inspected in the browser\n */\n constructor(args: { input: Input; inspect?: boolean }) {\n this.input = args.input;\n this.inspect = Boolean(args.inspect);\n }\n\n protected abstract makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >;\n\n _execute(\n internalApi: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const stateMachine = this.makeStateMachine(internalApi);\n\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n private _exhaustiveMatchingGuard(status: never): never {\n console.log(\"_exhaustiveMatchingGuard status\", status);\n throw new Error(`Unhandled status: ${status}`);\n }\n}\n"],
|
5
|
-
"mappings": "
|
6
|
-
"names": ["
|
4
|
+
"sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { Observable, ReplaySubject, share } from \"rxjs\";\nimport {\n createActor,\n type SnapshotFrom,\n type StateMachine,\n type StateSchema,\n} from \"xstate\";\n\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\nimport { type StateMachineTypes } from \"./StateMachineTypes\";\n\nexport type DeviceActionStateMachine<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> = StateMachine<\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"context\"], // context\n /**\n * The following usages `any` are OK because this is just a wrapper around the\n * state machine and we are not directly going to use these types.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any, // event\n any, // children\n any, // actor\n any, // action\n any, // guard\n any, // delay\n any, // state value\n any, // tag\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"input\"],\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"output\"],\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any,\n any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateSchema\n>;\n\n/**\n * A DeviceAction that uses an XState state machine to execute.\n * It maps the state machine snapshots to the DeviceActionState.\n * This class is abstract and should be extended to implement the state machine.\n */\nexport abstract class XStateDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> implements DeviceAction<Output, Input, Error, IntermediateValue>\n{\n readonly input: Input;\n readonly inspect: boolean = false;\n\n /**\n *\n * @param input The input for the DeviceAction\n * @param inspect If true, the state machine will be inspected in the browser\n */\n constructor(args: { input: Input; inspect?: boolean }) {\n this.input = args.input;\n this.inspect = Boolean(args.inspect);\n }\n\n protected abstract makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >;\n\n _execute(\n internalApi: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const stateMachine = this.makeStateMachine(internalApi);\n\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n // inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n private _exhaustiveMatchingGuard(status: never): never {\n console.log(\"_exhaustiveMatchingGuard status\", status);\n throw new Error(`Unhandled status: ${status}`);\n }\n}\n"],
|
5
|
+
"mappings": "AACA,OAAS,cAAAA,EAAY,iBAAAC,EAAe,SAAAC,MAAa,OACjD,OACE,eAAAC,MAIK,SAQP,OAEE,sBAAAC,MACK,6CA2DA,MAAeC,CAOtB,CACW,MACA,QAAmB,GAO5B,YAAYC,EAA2C,CACrD,KAAK,MAAQA,EAAK,MAClB,KAAK,QAAU,EAAQA,EAAK,OAC9B,CAYA,SACEC,EACiE,CACjE,MAAMC,EAAe,KAAK,iBAAiBD,CAAW,EAEhDE,EAAQN,EAAYK,EAAc,CACtC,MAAO,KAAK,KAGd,CAAC,EAQKE,EAAU,IAAIT,EAIdU,EACJC,GACG,CACH,KAAM,CAAE,QAAAC,EAAS,OAAAC,EAAQ,OAAAC,EAAQ,MAAAC,CAAM,EAAIJ,EAC3C,OAAQE,EAAQ,CACd,IAAK,SACHJ,EAAQ,KAAK,CACX,OAAQN,EAAmB,QAC3B,kBAAmBS,EAAQ,iBAC7B,CAAC,EACD,MACF,IAAK,OACHE,EAAO,OAAO,CACZ,KAAOE,GAAQ,CACbP,EAAQ,KAAK,CACX,OAAQN,EAAmB,MAC3B,MAAOa,CACT,CAAC,CACH,EACA,MAAQC,GAAW,CACjBR,EAAQ,KAAK,CACX,OAAQN,EAAmB,UAC3B,OAAQc,CACV,CAAC,CACH,CACF,CAAC,EACDR,EAAQ,SAAS,EACjB,MACF,IAAK,QAEHA,EAAQ,MAAMM,CAAK,EACnBN,EAAQ,SAAS,EACjB,MACF,IAAK,UACHA,EAAQ,KAAK,CACX,OAAQN,EAAmB,OAC7B,CAAC,EACDM,EAAQ,SAAS,EACjB,MACF,QACE,KAAK,yBAAyBI,CAAM,CACxC,CACF,EAEMK,EAAa,IAAInB,EAEpBoB,GAAe,CAChB,MAAMC,EAAsBX,EAAQ,UAAUU,CAAU,EACxD,MAAO,IAAM,CACXE,EAAkB,YAAY,EAC9BD,EAAoB,YAAY,EAChCZ,EAAM,KAAK,CACb,CACF,CAAC,EAEKa,EAAoBb,EAAM,UAAUE,CAAmB,EAC7D,OAAAF,EAAM,MAAM,EAEL,CACL,WAAYU,EAAW,KAAKjB,EAAM,CAAC,EACnC,OAAQ,IAAM,CACZO,EAAM,KAAK,EACXa,EAAkB,YAAY,EAC9BX,EAAoBF,EAAM,YAAY,CAAC,CACzC,CACF,CACF,CAEQ,yBAAyBK,EAAsB,CACrD,cAAQ,IAAI,kCAAmCA,CAAM,EAC/C,IAAI,MAAM,qBAAqBA,CAAM,EAAE,CAC/C,CACF",
|
6
|
+
"names": ["Observable", "ReplaySubject", "share", "createActor", "DeviceActionStatus", "XStateDeviceAction", "args", "internalApi", "stateMachine", "actor", "subject", "handleActorSnapshot", "snapshot", "context", "status", "output", "error", "err", "result", "observable", "subscriber", "subjectSubscription", "actorSubscription"]
|
7
7
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../src/api/device-session/DeviceSessionState.ts"],
|
4
|
-
"sourcesContent": ["import { type GetAppAndVersionResponse } from \"@api/command/os/GetAppAndVersionCommand\";\nimport { type BatteryStatusFlags } from \"@api/command/os/GetBatteryStatusCommand\";\nimport { type DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\n\n/**\n * The battery status of a device.\n */\nexport type BatteryStatus = {\n readonly level: number;\n readonly voltage: number;\n readonly temperature: number;\n readonly current: number;\n readonly status: BatteryStatusFlags;\n};\n\n/**\n * The firmware version of a device.\n */\nexport type FirmwareVersion = {\n /**\n * Microcontroller Unit version\n */\n readonly mcu: string;\n\n /**\n * Bootloader version\n */\n readonly bootloader: string;\n\n /**\n * Operating System version\n */\n readonly os: string;\n};\n\n/**\n * The current application running on a device. Alias of GetAppAndVersionResponse.\n */\nexport type RunningApp = GetAppAndVersionResponse;\n\n/**\n * The state types of a device session.\n */\nexport enum DeviceSessionStateType {\n Connected,\n ReadyWithoutSecureChannel,\n ReadyWithSecureChannel,\n}\n\ntype DeviceSessionBaseState = {\n readonly sessionStateType: DeviceSessionStateType;\n\n /**\n * The status of the device.\n */\n readonly deviceStatus: DeviceStatus;\n\n /**\n * The name of the device.\n */\n readonly deviceName?: string;\n};\n\ntype DeviceSessionReadyState = {\n /**\n * The battery status of the device.\n * TODO: This should not be optional, but it is not in the current implementation.\n */\n readonly batteryStatus?: BatteryStatus;\n\n /**\n * The firmware version of the device.\n * TODO: This should not be optional, but it is not in the current implementation.\n */\n readonly firmwareVersion?: FirmwareVersion;\n\n /**\n * The current application running on the device.\n */\n readonly currentApp: RunningApp;\n\n /**\n * The current applications installed on the device.\n */\n readonly installedApps: Application[];\n};\n\n/**\n * The state of a connected device session.\n */\nexport type ConnectedState = DeviceSessionBaseState & {\n /**\n * The type of the device session state.\n */\n readonly sessionStateType: DeviceSessionStateType.Connected;\n};\n\n/**\n * The state of a device session when it is ready without a secure channel.\n */\nexport type ReadyWithoutSecureChannelState = DeviceSessionBaseState &\n DeviceSessionReadyState & {\n /**\n * The type of the device session state.\n */\n readonly sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel;\n };\n\n/**\n * The state of a device session when it is ready with a secure channel.\n */\nexport type ReadyWithSecureChannelState = DeviceSessionBaseState &\n DeviceSessionReadyState & {\n /**\n * The type of the device session state.\n */\n readonly sessionStateType: DeviceSessionStateType.ReadyWithSecureChannel;\n };\n\n/**\n * The state of a device session.\n */\nexport type DeviceSessionState =\n | ConnectedState\n | ReadyWithoutSecureChannelState\n | ReadyWithSecureChannelState;\n"],
|
5
|
-
"mappings": "
|
4
|
+
"sourcesContent": ["import { type GetAppAndVersionResponse } from \"@api/command/os/GetAppAndVersionCommand\";\nimport { type BatteryStatusFlags } from \"@api/command/os/GetBatteryStatusCommand\";\nimport { type DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { type Application } from \"@internal/manager-api/model/Application\";\n\n/**\n * The battery status of a device.\n */\nexport type BatteryStatus = {\n readonly level: number;\n readonly voltage: number;\n readonly temperature: number;\n readonly current: number;\n readonly status: BatteryStatusFlags;\n};\n\n/**\n * The firmware version of a device.\n */\nexport type FirmwareVersion = {\n /**\n * Microcontroller Unit version\n */\n readonly mcu: string;\n\n /**\n * Bootloader version\n */\n readonly bootloader: string;\n\n /**\n * Operating System version\n */\n readonly os: string;\n};\n\n/**\n * The current application running on a device. Alias of GetAppAndVersionResponse.\n */\nexport type RunningApp = GetAppAndVersionResponse;\n\n/**\n * The state types of a device session.\n */\nexport enum DeviceSessionStateType {\n Connected,\n ReadyWithoutSecureChannel,\n ReadyWithSecureChannel,\n}\n\ntype DeviceSessionBaseState = {\n readonly sessionStateType: DeviceSessionStateType;\n\n /**\n * The status of the device.\n */\n readonly deviceStatus: DeviceStatus;\n\n /**\n * The model of the device.\n */\n readonly deviceModelId: DeviceModelId;\n\n /**\n * The name of the device.\n */\n readonly deviceName?: string;\n};\n\ntype DeviceSessionReadyState = {\n /**\n * The battery status of the device.\n * TODO: This should not be optional, but it is not in the current implementation.\n */\n readonly batteryStatus?: BatteryStatus;\n\n /**\n * The firmware version of the device.\n * TODO: This should not be optional, but it is not in the current implementation.\n */\n readonly firmwareVersion?: FirmwareVersion;\n\n /**\n * The current application running on the device.\n */\n readonly currentApp: RunningApp;\n\n /**\n * The current applications installed on the device.\n */\n readonly installedApps: Application[];\n};\n\n/**\n * The state of a connected device session.\n */\nexport type ConnectedState = DeviceSessionBaseState & {\n /**\n * The type of the device session state.\n */\n readonly sessionStateType: DeviceSessionStateType.Connected;\n};\n\n/**\n * The state of a device session when it is ready without a secure channel.\n */\nexport type ReadyWithoutSecureChannelState = DeviceSessionBaseState &\n DeviceSessionReadyState & {\n /**\n * The type of the device session state.\n */\n readonly sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel;\n };\n\n/**\n * The state of a device session when it is ready with a secure channel.\n */\nexport type ReadyWithSecureChannelState = DeviceSessionBaseState &\n DeviceSessionReadyState & {\n /**\n * The type of the device session state.\n */\n readonly sessionStateType: DeviceSessionStateType.ReadyWithSecureChannel;\n };\n\n/**\n * The state of a device session.\n */\nexport type DeviceSessionState =\n | ConnectedState\n | ReadyWithoutSecureChannelState\n | ReadyWithSecureChannelState;\n"],
|
5
|
+
"mappings": "AA6CO,IAAKA,OACVA,IAAA,yBACAA,IAAA,yDACAA,IAAA,mDAHUA,OAAA",
|
6
6
|
"names": ["DeviceSessionStateType"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{deviceSessionStubBuilder as
|
1
|
+
import{deviceSessionStubBuilder as a}from"../../../internal/device-session/model/DeviceSession.stub";import{DeviceSessionNotFound as l}from"../../../internal/device-session/model/Errors";import{DefaultDeviceSessionService as f}from"../../../internal/device-session/service/DefaultDeviceSessionService";import{DefaultLoggerPublisherService as S}from"../../../internal/logger-publisher/service/DefaultLoggerPublisherService";import{AxiosManagerApiDataSource as m}from"../../../internal/manager-api/data/AxiosManagerApiDataSource";import{DefaultManagerApiService as v}from"../../../internal/manager-api/service/DefaultManagerApiService";import{DefaultSecureChannelDataSource as p}from"../../../internal/secure-channel/data/DefaultSecureChannelDataSource";import{DefaultSecureChannelService as g}from"../../../internal/secure-channel/service/DefaultSecureChannelService";import{ToggleDeviceSessionRefresherUseCase as t}from"./ToggleDeviceSessionRefresher";let e,r,i,o,n,c;describe("ToggleDeviceSessionRefresherUseCase",()=>{beforeEach(()=>{e=new S([],"get-connected-device-use-case-test"),r=new f(()=>e),n=new v(new m({})),c=new g(new p({}))}),afterEach(()=>{vi.clearAllMocks()}),describe("execute",()=>{it("should toggle the device session refresher",()=>{o=a({id:"fakeSessionId"},()=>e,n,c),r.addDeviceSession(o),i=new t(r,()=>e);const s=vi.spyOn(o,"toggleRefresher");i.execute({sessionId:"fakeSessionId",enabled:!1}),expect(s).toHaveBeenCalledWith(!1),o.close()}),it("should throw error when deviceSession is not found",()=>{i=new t(r,()=>e);try{i.execute({sessionId:"fakeSessionId",enabled:!1})}catch(s){expect(s).toBeInstanceOf(l)}})})});
|
2
2
|
//# sourceMappingURL=ToggleDeviceSessionRefresher.test.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/device-session/use-case/ToggleDeviceSessionRefresher.test.ts"],
|
4
|
-
"sourcesContent": ["import { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type DeviceSession } from \"@internal/device-session/model/DeviceSession\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DeviceSessionNotFound } from \"@internal/device-session/model/Errors\";\nimport { 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 { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\n\nimport { ToggleDeviceSessionRefresherUseCase } from \"./ToggleDeviceSessionRefresher\";\n\nlet logger: LoggerPublisherService;\nlet sessionService: DeviceSessionService;\nlet useCase: ToggleDeviceSessionRefresherUseCase;\nlet deviceSession: DeviceSession;\nlet managerApi: ManagerApiService;\ndescribe(\"ToggleDeviceSessionRefresherUseCase\", () => {\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService(\n [],\n \"get-connected-device-use-case-test\",\n );\n sessionService = new DefaultDeviceSessionService(() => logger);\n managerApi = new DefaultManagerApiService(\n new AxiosManagerApiDataSource({
|
5
|
-
"mappings": "
|
6
|
-
"names": ["deviceSessionStubBuilder", "DeviceSessionNotFound", "DefaultDeviceSessionService", "DefaultLoggerPublisherService", "AxiosManagerApiDataSource", "DefaultManagerApiService", "ToggleDeviceSessionRefresherUseCase", "logger", "sessionService", "useCase", "deviceSession", "managerApi", "spy", "error"]
|
4
|
+
"sourcesContent": ["import { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type DeviceSession } from \"@internal/device-session/model/DeviceSession\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DeviceSessionNotFound } from \"@internal/device-session/model/Errors\";\nimport { 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 { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { ToggleDeviceSessionRefresherUseCase } from \"./ToggleDeviceSessionRefresher\";\n\nlet logger: LoggerPublisherService;\nlet sessionService: DeviceSessionService;\nlet useCase: ToggleDeviceSessionRefresherUseCase;\nlet deviceSession: DeviceSession;\nlet managerApi: ManagerApiService;\nlet secureChannel: SecureChannelService;\ndescribe(\"ToggleDeviceSessionRefresherUseCase\", () => {\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService(\n [],\n \"get-connected-device-use-case-test\",\n );\n sessionService = new DefaultDeviceSessionService(() => logger);\n managerApi = new DefaultManagerApiService(\n new AxiosManagerApiDataSource({} as DmkConfig),\n );\n secureChannel = new DefaultSecureChannelService(\n new DefaultSecureChannelDataSource({} as DmkConfig),\n );\n });\n\n afterEach(() => {\n vi.clearAllMocks();\n });\n\n describe(\"execute\", () => {\n it(\"should toggle the device session refresher\", () => {\n // given\n deviceSession = deviceSessionStubBuilder(\n { id: \"fakeSessionId\" },\n () => logger,\n managerApi,\n secureChannel,\n );\n sessionService.addDeviceSession(deviceSession);\n useCase = new ToggleDeviceSessionRefresherUseCase(\n sessionService,\n () => logger,\n );\n\n const spy = vi.spyOn(deviceSession, \"toggleRefresher\");\n\n // when\n useCase.execute({ sessionId: \"fakeSessionId\", enabled: false });\n\n // then\n expect(spy).toHaveBeenCalledWith(false);\n deviceSession.close();\n });\n\n it(\"should throw error when deviceSession is not found\", () => {\n // given\n useCase = new ToggleDeviceSessionRefresherUseCase(\n sessionService,\n () => logger,\n );\n\n // when\n try {\n useCase.execute({ sessionId: \"fakeSessionId\", enabled: false });\n } catch (error) {\n // then\n expect(error).toBeInstanceOf(DeviceSessionNotFound);\n }\n });\n });\n});\n"],
|
5
|
+
"mappings": "AAGA,OAAS,4BAAAA,MAAgC,oDACzC,OAAS,yBAAAC,MAA6B,wCACtC,OAAS,+BAAAC,MAAmC,+DAE5C,OAAS,iCAAAC,MAAqC,mEAC9C,OAAS,6BAAAC,MAAiC,uDAC1C,OAAS,4BAAAC,MAAgC,yDAEzC,OAAS,kCAAAC,MAAsC,+DAC/C,OAAS,+BAAAC,MAAmC,+DAG5C,OAAS,uCAAAC,MAA2C,iCAEpD,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACJ,SAAS,sCAAuC,IAAM,CACpD,WAAW,IAAM,CACfL,EAAS,IAAIN,EACX,CAAC,EACD,oCACF,EACAO,EAAiB,IAAIR,EAA4B,IAAMO,CAAM,EAC7DI,EAAa,IAAIR,EACf,IAAID,EAA0B,CAAC,CAAc,CAC/C,EACAU,EAAgB,IAAIP,EAClB,IAAID,EAA+B,CAAC,CAAc,CACpD,CACF,CAAC,EAED,UAAU,IAAM,CACd,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,6CAA8C,IAAM,CAErDM,EAAgBZ,EACd,CAAE,GAAI,eAAgB,EACtB,IAAMS,EACNI,EACAC,CACF,EACAJ,EAAe,iBAAiBE,CAAa,EAC7CD,EAAU,IAAIH,EACZE,EACA,IAAMD,CACR,EAEA,MAAMM,EAAM,GAAG,MAAMH,EAAe,iBAAiB,EAGrDD,EAAQ,QAAQ,CAAE,UAAW,gBAAiB,QAAS,EAAM,CAAC,EAG9D,OAAOI,CAAG,EAAE,qBAAqB,EAAK,EACtCH,EAAc,MAAM,CACtB,CAAC,EAED,GAAG,qDAAsD,IAAM,CAE7DD,EAAU,IAAIH,EACZE,EACA,IAAMD,CACR,EAGA,GAAI,CACFE,EAAQ,QAAQ,CAAE,UAAW,gBAAiB,QAAS,EAAM,CAAC,CAChE,OAASK,EAAO,CAEd,OAAOA,CAAK,EAAE,eAAef,CAAqB,CACpD,CACF,CAAC,CACH,CAAC,CACH,CAAC",
|
6
|
+
"names": ["deviceSessionStubBuilder", "DeviceSessionNotFound", "DefaultDeviceSessionService", "DefaultLoggerPublisherService", "AxiosManagerApiDataSource", "DefaultManagerApiService", "DefaultSecureChannelDataSource", "DefaultSecureChannelService", "ToggleDeviceSessionRefresherUseCase", "logger", "sessionService", "useCase", "deviceSession", "managerApi", "secureChannel", "spy", "error"]
|
7
7
|
}
|
package/lib/esm/src/api/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{Apdu as
|
1
|
+
import{Apdu as r}from"./apdu/model/Apdu";import{APDU_MAX_PAYLOAD as p,ApduBuilder as m}from"./apdu/utils/ApduBuilder";import{ApduParser as n}from"./apdu/utils/ApduParser";export*from"./apdu/utils/AppBuilderError";import{ByteArrayBuilder as f}from"./apdu/utils/ByteArrayBuilder";import{ByteArrayParser as c}from"./apdu/utils/ByteArrayParser";import{InvalidStatusWordError as A}from"./command/Errors";import{CommandResultFactory as D,CommandResultStatus as S,isSuccessCommandResult as v}from"./command/model/CommandResult";import{CloseAppCommand as C}from"./command/os/CloseAppCommand";import{GetAppAndVersionCommand as g}from"./command/os/GetAppAndVersionCommand";import{BatteryStatusType as L,GetBatteryStatusCommand as G}from"./command/os/GetBatteryStatusCommand";import{GetOsVersionCommand as E}from"./command/os/GetOsVersionCommand";import{ListAppsCommand as b}from"./command/os/ListAppsCommand";import{LoadCertificateCommand as I}from"./command/os/LoadCertificateCommand";import{OpenAppCommand as h}from"./command/os/OpenAppCommand";import{isCommandErrorCode as V}from"./command/utils/CommandErrors";import{CommandUtils as _}from"./command/utils/CommandUtils";import{GlobalCommandError as W,GlobalCommandErrorHandler as k}from"./command/utils/GlobalCommandError";import{DeviceModel as K,DeviceModelId as X,LEDGER_VENDOR_ID as q}from"./device/DeviceModel";import{DeviceStatus as N}from"./device/DeviceStatus";import{DeviceActionStatus as j}from"./device-action/model/DeviceActionState";import{UserInteractionRequired as J}from"./device-action/model/UserInteractionRequired";import{CallTaskInAppDeviceAction as Z}from"./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction";import{UnknownDAError as ee}from"./device-action/os/Errors";import{GetDeviceStatusDeviceAction as re}from"./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction";import{GoToDashboardDeviceAction as pe}from"./device-action/os/GoToDashboard/GoToDashboardDeviceAction";import{ListAppsDeviceAction as ie}from"./device-action/os/ListApps/ListAppsDeviceAction";import{ListAppsWithMetadataDeviceAction as ae}from"./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction";import{OpenAppDeviceAction as fe}from"./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction";import{SendCommandInAppDeviceAction as ce}from"./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction";import{XStateDeviceAction as Ae}from"./device-action/xstate-utils/XStateDeviceAction";import{StaticDeviceModelDataSource as De}from"./device-model/data/StaticDeviceModelDataSource";import{BleDeviceInfos as ve}from"./device-model/model/BleDeviceInfos";import{TransportDeviceModel as Ce}from"./device-model/model/DeviceModel";import{ApduResponse as ge}from"./device-session/ApduResponse";export*from"./device-session/data/FramerConst";import{DeviceSessionStateType as Ge}from"./device-session/DeviceSessionState";import{defaultApduReceiverServiceStubBuilder as Ee}from"./device-session/service/DefaultApduReceiverService.stub";import{defaultApduSenderServiceStubBuilder as be}from"./device-session/service/DefaultApduSenderService.stub";import{FramerUtils as Ie}from"./device-session/utils/FramerUtils";import{DeviceManagementKit as he}from"./DeviceManagementKit";import{DeviceManagementKitBuilder as Ve}from"./DeviceManagementKitBuilder";export*from"./Error";import{LogLevel as He}from"./logger-subscriber/model/LogLevel";import{ConsoleLogger as ke}from"./logger-subscriber/service/ConsoleLogger";import{WebLogsExporterLogger as Ke}from"./logger-subscriber/service/WebLogsExporterLogger";import{ConnectedDevice as qe}from"./transport/model/ConnectedDevice";import{DeviceConnectionStateMachine as Ne}from"./transport/model/DeviceConnectionStateMachine";export*from"./transport/model/Errors";import{TransportConnectedDevice as ze}from"./transport/model/TransportConnectedDevice";import{connectedDeviceStubBuilder as Qe}from"./transport/model/TransportConnectedDevice.stub";export*from"./types";import{base64StringToBuffer as eo,isBase64String as oo}from"./utils/Base64String";import{bufferToHexaString as to,hexaStringToBuffer as po,isHexaString as mo}from"./utils/HexaString";export{p as APDU_MAX_PAYLOAD,r as Apdu,m as ApduBuilder,n as ApduParser,ge as ApduResponse,L as BatteryStatusType,ve as BleDeviceInfos,f as ByteArrayBuilder,c as ByteArrayParser,Z as CallTaskInAppDeviceAction,C as CloseAppCommand,D as CommandResultFactory,S as CommandResultStatus,_ as CommandUtils,qe as ConnectedDevice,ke as ConsoleLogger,j as DeviceActionStatus,Ne as DeviceConnectionStateMachine,he as DeviceManagementKit,Ve as DeviceManagementKitBuilder,K as DeviceModel,X as DeviceModelId,Ge as DeviceSessionStateType,N as DeviceStatus,Ie as FramerUtils,g as GetAppAndVersionCommand,G as GetBatteryStatusCommand,re as GetDeviceStatusDeviceAction,E as GetOsVersionCommand,W as GlobalCommandError,k as GlobalCommandErrorHandler,pe as GoToDashboardDeviceAction,A as InvalidStatusWordError,q as LEDGER_VENDOR_ID,b as ListAppsCommand,ie as ListAppsDeviceAction,ae as ListAppsWithMetadataDeviceAction,I as LoadCertificateCommand,He as LogLevel,h as OpenAppCommand,fe as OpenAppDeviceAction,ce as SendCommandInAppDeviceAction,De as StaticDeviceModelDataSource,ze as TransportConnectedDevice,Ce as TransportDeviceModel,ee as UnknownDAError,J as UserInteractionRequired,Ke as WebLogsExporterLogger,Ae as XStateDeviceAction,eo as base64StringToBuffer,to as bufferToHexaString,Qe as connectedDeviceStubBuilder,Ee as defaultApduReceiverServiceStubBuilder,be as defaultApduSenderServiceStubBuilder,po as hexaStringToBuffer,oo as isBase64String,V as isCommandErrorCode,mo as isHexaString,v as isSuccessCommandResult};
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../src/api/index.ts"],
|
4
|
-
"sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport { InvalidStatusWordError } from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { UnknownDAError } from \"@api/device-action/os/Errors\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
|
5
|
-
"mappings": "AAEA,OAAS,QAAAA,MAAY,uBACrB,OAAS,oBAAAC,EAAkB,eAAAC,MAAmB,8BAC9C,OAAS,cAAAC,MAAkB,6BAC3B,WAAc,kCACd,OAAS,oBAAAC,MAAwB,mCACjC,OAAS,mBAAAC,MAAuB,kCAChC,OAAS,0BAAAC,MAA8B,sBACvC,OACE,wBAAAC,EACA,uBAAAC,EACA,0BAAAC,MACK,mCACP,OAAS,mBAAAC,MAAuB,kCAChC,OACE,2BAAAC,MAEK,0CACP,OACE,qBAAAC,EAEA,2BAAAC,MAEK,0CACP,OACE,uBAAAC,MAEK,sCACP,OAEE,mBAAAC,MAGK,kCACP,OAEE,kBAAAC,MACK,iCACP,OAAS,sBAAAC,MAA0B,mCACnC,OAAS,gBAAAC,MAAoB,kCAC7B,OACE,sBAAAC,EACA,6BAAAC,MACK,wCACP,OACE,eAAAC,EACA,iBAAAC,EACA,oBAAAC,MACK,0BACP,OAAS,gBAAAC,MAAoB,2BAE7B,OAEE,sBAAAC,MACK,6CACP,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,kBAAAC,
|
6
|
-
"names": ["Apdu", "APDU_MAX_PAYLOAD", "ApduBuilder", "ApduParser", "ByteArrayBuilder", "ByteArrayParser", "InvalidStatusWordError", "CommandResultFactory", "CommandResultStatus", "isSuccessCommandResult", "CloseAppCommand", "GetAppAndVersionCommand", "BatteryStatusType", "GetBatteryStatusCommand", "GetOsVersionCommand", "ListAppsCommand", "OpenAppCommand", "isCommandErrorCode", "CommandUtils", "GlobalCommandError", "GlobalCommandErrorHandler", "DeviceModel", "DeviceModelId", "LEDGER_VENDOR_ID", "DeviceStatus", "DeviceActionStatus", "UserInteractionRequired", "UnknownDAError", "GetDeviceStatusDeviceAction", "GoToDashboardDeviceAction", "ListAppsDeviceAction", "ListAppsWithMetadataDeviceAction", "OpenAppDeviceAction", "SendCommandInAppDeviceAction", "XStateDeviceAction", "StaticDeviceModelDataSource", "BleDeviceInfos", "TransportDeviceModel", "ApduResponse", "DeviceSessionStateType", "defaultApduReceiverServiceStubBuilder", "defaultApduSenderServiceStubBuilder", "FramerUtils", "DeviceManagementKit", "DeviceManagementKitBuilder", "LogLevel", "ConsoleLogger", "WebLogsExporterLogger", "ConnectedDevice", "TransportConnectedDevice", "connectedDeviceStubBuilder", "base64StringToBuffer", "isBase64String", "bufferToHexaString", "hexaStringToBuffer", "isHexaString"]
|
4
|
+
"sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport { InvalidStatusWordError } from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport { UnknownDAError } from \"@api/device-action/os/Errors\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport { DeviceConnectionStateMachine } from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
|
5
|
+
"mappings": "AAEA,OAAS,QAAAA,MAAY,uBACrB,OAAS,oBAAAC,EAAkB,eAAAC,MAAmB,8BAC9C,OAAS,cAAAC,MAAkB,6BAC3B,WAAc,kCACd,OAAS,oBAAAC,MAAwB,mCACjC,OAAS,mBAAAC,MAAuB,kCAChC,OAAS,0BAAAC,MAA8B,sBACvC,OACE,wBAAAC,EACA,uBAAAC,EACA,0BAAAC,MACK,mCACP,OAAS,mBAAAC,MAAuB,kCAChC,OACE,2BAAAC,MAEK,0CACP,OACE,qBAAAC,EAEA,2BAAAC,MAEK,0CACP,OACE,uBAAAC,MAEK,sCACP,OAEE,mBAAAC,MAGK,kCACP,OAEE,0BAAAC,MAEK,yCACP,OAEE,kBAAAC,MACK,iCACP,OAAS,sBAAAC,MAA0B,mCACnC,OAAS,gBAAAC,MAAoB,kCAC7B,OACE,sBAAAC,EACA,6BAAAC,MACK,wCACP,OACE,eAAAC,EACA,iBAAAC,EACA,oBAAAC,MACK,0BACP,OAAS,gBAAAC,MAAoB,2BAE7B,OAEE,sBAAAC,MACK,6CACP,OAAS,2BAAAC,MAA+B,mDACxC,OAAS,6BAAAC,MAAiC,4EAC1C,OAAS,kBAAAC,OAAsB,+BAC/B,OAAS,+BAAAC,OAAmC,oEAC5C,OAAS,6BAAAC,OAAiC,gEAC1C,OAAS,wBAAAC,OAA4B,sDACrC,OAAS,oCAAAC,OAAwC,8EACjD,OAAS,uBAAAC,OAA2B,gEACpC,OAAS,gCAAAC,OAAoC,kFAC7C,OAEE,sBAAAC,OACK,qDACP,OAAS,+BAAAC,OAAmC,qDAC5C,OAAS,kBAAAC,OAAsB,yCAC/B,OAAS,wBAAAC,OAA4B,sCACrC,OAAS,gBAAAC,OAAoB,mCAC7B,WAAc,uCACd,OAEE,0BAAAC,OACK,yCAEP,OAAS,yCAAAC,OAA6C,8DACtD,OAAS,uCAAAC,OAA2C,4DACpD,OAAS,eAAAC,OAAmB,wCAC5B,OAAS,uBAAAC,OAA2B,2BACpC,OAAS,8BAAAC,OAAkC,kCAC3C,WAAc,aACd,OAAS,YAAAC,OAAgB,wCACzB,OAAS,iBAAAC,OAAqB,+CAC9B,OAAS,yBAAAC,OAA6B,uDACtC,OAAS,mBAAAC,OAAuB,uCAChC,OAAS,gCAAAC,OAAoC,oDAC7C,WAAc,8BACd,OAAS,4BAAAC,OAAgC,gDACzC,OAAS,8BAAAC,OAAkC,qDAC3C,WAAc,aACd,OAAS,wBAAAC,GAAsB,kBAAAC,OAAsB,0BACrD,OACE,sBAAAC,GACA,sBAAAC,GACA,gBAAAC,OACK",
|
6
|
+
"names": ["Apdu", "APDU_MAX_PAYLOAD", "ApduBuilder", "ApduParser", "ByteArrayBuilder", "ByteArrayParser", "InvalidStatusWordError", "CommandResultFactory", "CommandResultStatus", "isSuccessCommandResult", "CloseAppCommand", "GetAppAndVersionCommand", "BatteryStatusType", "GetBatteryStatusCommand", "GetOsVersionCommand", "ListAppsCommand", "LoadCertificateCommand", "OpenAppCommand", "isCommandErrorCode", "CommandUtils", "GlobalCommandError", "GlobalCommandErrorHandler", "DeviceModel", "DeviceModelId", "LEDGER_VENDOR_ID", "DeviceStatus", "DeviceActionStatus", "UserInteractionRequired", "CallTaskInAppDeviceAction", "UnknownDAError", "GetDeviceStatusDeviceAction", "GoToDashboardDeviceAction", "ListAppsDeviceAction", "ListAppsWithMetadataDeviceAction", "OpenAppDeviceAction", "SendCommandInAppDeviceAction", "XStateDeviceAction", "StaticDeviceModelDataSource", "BleDeviceInfos", "TransportDeviceModel", "ApduResponse", "DeviceSessionStateType", "defaultApduReceiverServiceStubBuilder", "defaultApduSenderServiceStubBuilder", "FramerUtils", "DeviceManagementKit", "DeviceManagementKitBuilder", "LogLevel", "ConsoleLogger", "WebLogsExporterLogger", "ConnectedDevice", "DeviceConnectionStateMachine", "TransportConnectedDevice", "connectedDeviceStubBuilder", "base64StringToBuffer", "isBase64String", "bufferToHexaString", "hexaStringToBuffer", "isHexaString"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{LogLevel as t}from"../../logger-subscriber/model/LogLevel";import{ConsoleLogger as
|
1
|
+
import{LogLevel as t}from"../../logger-subscriber/model/LogLevel";import{ConsoleLogger as i}from"./ConsoleLogger";const d=vi.spyOn(console,"warn").mockImplementation(vi.fn()),n=vi.spyOn(console,"info").mockImplementation(vi.fn()),r=vi.spyOn(console,"debug").mockImplementation(vi.fn()),a=vi.spyOn(console,"error").mockImplementation(vi.fn()),s=vi.spyOn(console,"log").mockImplementation(vi.fn());let o;const e={data:{key:"value"},timestamp:1,tag:"tag"},l="message";describe("ConsoleLogger",()=>{afterAll(()=>{vi.restoreAllMocks()}),describe("default level (LogLevel.DEBUG)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new i}),describe("log",()=>{it("should log Info level",()=>{o.log(t.Info,l,e),expect(n).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Info level with a custom tag",()=>{const g="custom-tag";o.log(t.Info,l,{...e,tag:g}),expect(n).toHaveBeenCalledWith(`[${g}]`,l,e.data)}),it("should log Warn level",()=>{o.log(t.Warning,l,e),expect(d).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Debug level",()=>{o.log(t.Debug,l,e),expect(r).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Fatal level",()=>{o.log(t.Fatal,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should default to Log level if none present",()=>{o.log(null,l,e),expect(s).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Error level",()=>{o.log(t.Error,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)})})}),describe("custom level (LogLevel.Info)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new i(t.Info)}),describe("log",()=>{it("should log Info level",()=>{o.log(t.Info,l,e),expect(n).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Info level with a custom tag",()=>{const g="custom-tag";o.log(t.Info,l,{...e,tag:g}),expect(n).toHaveBeenCalledWith(`[${g}]`,l,e.data)}),it("should log Warn level",()=>{o.log(t.Warning,l,e),expect(d).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should not log Debug level",()=>{o.log(t.Debug,l,e),expect(r).not.toHaveBeenCalled()}),it("should default to Log level if none present",()=>{o.log(null,l,e),expect(s).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Error level",()=>{o.log(t.Error,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Fatal level",()=>{o.log(t.Fatal,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)})})}),describe("custom level (LogLevel.Warning)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new i(t.Warning)}),describe("log",()=>{it("should not log Info level",()=>{o.log(t.Info,l,e),expect(n).not.toHaveBeenCalled()}),it("should log Warn level",()=>{o.log(t.Warning,l,e),expect(d).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should not log Debug level",()=>{o.log(t.Debug,l,e),expect(r).not.toHaveBeenCalled()}),it("should default to Log level if none present",()=>{o.log(null,l,e),expect(s).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Error level",()=>{o.log(t.Error,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Fatal level",()=>{o.log(t.Fatal,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)})})}),describe("custom level (LogLevel.Error)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new i(t.Error)}),describe("log",()=>{it("should not log Info level",()=>{o.log(t.Info,l,e),expect(n).not.toHaveBeenCalled()}),it("should not log Warn level",()=>{o.log(t.Warning,l,e),expect(d).not.toHaveBeenCalled()}),it("should not log Debug level",()=>{o.log(t.Debug,l,e),expect(r).not.toHaveBeenCalled()}),it("should default to Log level if none present",()=>{o.log(null,l,e),expect(s).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Error level",()=>{o.log(t.Error,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Fatal level",()=>{o.log(t.Fatal,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)})})}),describe("custom level (LogLevel.Fatal)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new i(t.Fatal)}),describe("log",()=>{it("should not log Info level",()=>{o.log(t.Info,l,e),expect(n).not.toHaveBeenCalled()}),it("should not log Warn level",()=>{o.log(t.Warning,l,e),expect(d).not.toHaveBeenCalled()}),it("should not log Debug level",()=>{o.log(t.Debug,l,e),expect(r).not.toHaveBeenCalled()}),it("should log Fatal level",()=>{o.log(t.Fatal,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)})})})});
|
2
2
|
//# sourceMappingURL=ConsoleLogger.test.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/logger-subscriber/service/ConsoleLogger.test.ts"],
|
4
|
-
"sourcesContent": ["import { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nimport { type LogSubscriberOptions } from \"@api/logger-subscriber/model/LogSubscriberOptions\";\n\nimport { ConsoleLogger } from \"./ConsoleLogger\";\n\nconst warn =
|
5
|
-
"mappings": "AAAA,OAAS,YAAAA,MAAgB,wCAGzB,OAAS,iBAAAC,MAAqB,kBAE9B,MAAMC,EAAO,
|
4
|
+
"sourcesContent": ["import { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nimport { type LogSubscriberOptions } from \"@api/logger-subscriber/model/LogSubscriberOptions\";\n\nimport { ConsoleLogger } from \"./ConsoleLogger\";\n\nconst warn = vi.spyOn(console, \"warn\").mockImplementation(vi.fn());\nconst info = vi.spyOn(console, \"info\").mockImplementation(vi.fn());\nconst debug = vi.spyOn(console, \"debug\").mockImplementation(vi.fn());\nconst error = vi.spyOn(console, \"error\").mockImplementation(vi.fn());\nconst log = vi.spyOn(console, \"log\").mockImplementation(vi.fn());\n\nlet logger: ConsoleLogger;\nconst options: LogSubscriberOptions = {\n data: { key: \"value\" },\n timestamp: 1,\n tag: \"tag\",\n};\nconst message = \"message\";\n\ndescribe(\"ConsoleLogger\", () => {\n afterAll(() => {\n vi.restoreAllMocks();\n });\n\n describe(\"default level (LogLevel.DEBUG)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger();\n });\n\n describe(\"log\", () => {\n it(\"should log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Info level with a custom tag\", () => {\n const tag = \"custom-tag\";\n logger.log(LogLevel.Info, message, { ...options, tag });\n expect(info).toHaveBeenCalledWith(`[${tag}]`, message, options.data);\n });\n\n it(\"should log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should default to Log level if none present\", () => {\n logger.log(null, message, options);\n expect(log).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Error level\", () => {\n logger.log(LogLevel.Error, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n });\n });\n\n describe(\"custom level (LogLevel.Info)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger(LogLevel.Info);\n });\n\n describe(\"log\", () => {\n it(\"should log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Info level with a custom tag\", () => {\n const tag = \"custom-tag\";\n logger.log(LogLevel.Info, message, { ...options, tag });\n expect(info).toHaveBeenCalledWith(`[${tag}]`, message, options.data);\n });\n\n it(\"should log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should not log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).not.toHaveBeenCalled();\n });\n\n it(\"should default to Log level if none present\", () => {\n logger.log(null, message, options);\n expect(log).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Error level\", () => {\n logger.log(LogLevel.Error, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n });\n });\n\n describe(\"custom level (LogLevel.Warning)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger(LogLevel.Warning);\n });\n\n describe(\"log\", () => {\n it(\"should not log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).not.toHaveBeenCalled();\n });\n\n it(\"should log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should not log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).not.toHaveBeenCalled();\n });\n\n it(\"should default to Log level if none present\", () => {\n logger.log(null, message, options);\n expect(log).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Error level\", () => {\n logger.log(LogLevel.Error, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n });\n });\n\n describe(\"custom level (LogLevel.Error)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger(LogLevel.Error);\n });\n\n describe(\"log\", () => {\n it(\"should not log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).not.toHaveBeenCalled();\n });\n\n it(\"should not log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).not.toHaveBeenCalled();\n });\n\n it(\"should not log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).not.toHaveBeenCalled();\n });\n\n it(\"should default to Log level if none present\", () => {\n logger.log(null, message, options);\n expect(log).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Error level\", () => {\n logger.log(LogLevel.Error, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n });\n });\n\n describe(\"custom level (LogLevel.Fatal)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger(LogLevel.Fatal);\n });\n\n describe(\"log\", () => {\n it(\"should not log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).not.toHaveBeenCalled();\n });\n\n it(\"should not log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).not.toHaveBeenCalled();\n });\n\n it(\"should not log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).not.toHaveBeenCalled();\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n });\n });\n});\n"],
|
5
|
+
"mappings": "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",
|
6
6
|
"names": ["LogLevel", "ConsoleLogger", "warn", "info", "debug", "error", "log", "logger", "options", "message", "tag"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{deviceModelStubBuilder as n}from"../../device-model/model/DeviceModel.stub";import{DeviceSession as a}from"../../../internal/device-session/model/DeviceSession";import{getJSONStringifyReplacer as r}from"./WebLogsExporterLogger";describe("getJSONStringifyReplacer",()=>{it("should return a function that replaces Uint8Array correctly",()=>{const e=r(),t=new Uint8Array([1,2,3]),c=e("key",t);expect(c).toEqual({hex:"0x010203",readableHex:"01 02 03",value:"1,2,3"})}),it("should return a function that replaces DeviceSession",()=>{const e=n(),t=r(),c={deviceModel:n(),type:"USB",id:"mockedDeviceId",sendApdu:
|
1
|
+
import{deviceModelStubBuilder as n}from"../../device-model/model/DeviceModel.stub";import{DeviceSession as a}from"../../../internal/device-session/model/DeviceSession";import{getJSONStringifyReplacer as r}from"./WebLogsExporterLogger";describe("getJSONStringifyReplacer",()=>{it("should return a function that replaces Uint8Array correctly",()=>{const e=r(),t=new Uint8Array([1,2,3]),c=e("key",t);expect(c).toEqual({hex:"0x010203",readableHex:"01 02 03",value:"1,2,3"})}),it("should return a function that replaces DeviceSession",()=>{const e=n(),t=r(),c={deviceModel:n(),type:"USB",id:"mockedDeviceId",sendApdu:vi.fn(),transport:"USB"},i=new a({connectedDevice:c,id:"mockedSessionId"},vi.fn(),{},{}),o=JSON.stringify(i,t),s=`{"id":"mockedSessionId","connectedDevice":{"deviceModel":${JSON.stringify(e)},"type":"USB","id":"mockedDeviceId"}}`;i.close(),expect(o).toEqual(s)}),it("should return a function that replaces circular references",()=>{const e={name:"Alice"};e.self=e;const t='{"name":"Alice","self":"[Circular]"}',c=JSON.stringify(e,r());expect(c).toEqual(t)})});
|
2
2
|
//# sourceMappingURL=WebLogsExporterLogger.test.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/logger-subscriber/service/WebLogsExporterLogger.test.ts"],
|
4
|
-
"sourcesContent": ["import { deviceModelStubBuilder } from \"@api/device-model/model/DeviceModel.stub\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport { DeviceSession } from \"@internal/device-session/model/DeviceSession\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\n\nimport { getJSONStringifyReplacer } from \"./WebLogsExporterLogger\";\n\ndescribe(\"getJSONStringifyReplacer\", () => {\n it(\"should return a function that replaces Uint8Array correctly\", () => {\n const replacer = getJSONStringifyReplacer();\n const value = new Uint8Array([1, 2, 3]);\n const result = replacer(\"key\", value);\n expect(result).toEqual({\n hex: \"0x010203\",\n readableHex: \"01 02 03\",\n value: \"1,2,3\",\n });\n });\n\n it(\"should return a function that replaces DeviceSession\", () => {\n const stubDeviceModel = deviceModelStubBuilder();\n const replacer = getJSONStringifyReplacer();\n\n const connectedDevice: TransportConnectedDevice = {\n deviceModel: deviceModelStubBuilder(),\n type: \"USB\",\n id: \"mockedDeviceId\",\n sendApdu:
|
5
|
-
"mappings": "AAAA,OAAS,0BAAAA,MAA8B,2CAEvC,OAAS,iBAAAC,MAAqB,+
|
4
|
+
"sourcesContent": ["import { deviceModelStubBuilder } from \"@api/device-model/model/DeviceModel.stub\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport { DeviceSession } from \"@internal/device-session/model/DeviceSession\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { getJSONStringifyReplacer } from \"./WebLogsExporterLogger\";\n\ndescribe(\"getJSONStringifyReplacer\", () => {\n it(\"should return a function that replaces Uint8Array correctly\", () => {\n const replacer = getJSONStringifyReplacer();\n const value = new Uint8Array([1, 2, 3]);\n const result = replacer(\"key\", value);\n expect(result).toEqual({\n hex: \"0x010203\",\n readableHex: \"01 02 03\",\n value: \"1,2,3\",\n });\n });\n\n it(\"should return a function that replaces DeviceSession\", () => {\n const stubDeviceModel = deviceModelStubBuilder();\n const replacer = getJSONStringifyReplacer();\n\n const connectedDevice: TransportConnectedDevice = {\n deviceModel: deviceModelStubBuilder(),\n type: \"USB\",\n id: \"mockedDeviceId\",\n sendApdu: vi.fn(),\n transport: \"USB\",\n };\n\n const value = new DeviceSession(\n {\n connectedDevice,\n id: \"mockedSessionId\",\n },\n vi.fn(),\n {} as ManagerApiService,\n {} as SecureChannelService,\n );\n const result = JSON.stringify(value, replacer);\n const expected = `{\"id\":\"mockedSessionId\",\"connectedDevice\":{\"deviceModel\":${JSON.stringify(\n stubDeviceModel,\n )},\"type\":\"USB\",\"id\":\"mockedDeviceId\"}}`;\n value.close();\n expect(result).toEqual(expected);\n });\n\n it(\"should return a function that replaces circular references\", () => {\n interface CircularObject {\n name: string;\n self?: CircularObject;\n }\n\n const obj: CircularObject = { name: \"Alice\" };\n obj.self = obj;\n\n const expected = '{\"name\":\"Alice\",\"self\":\"[Circular]\"}';\n const result = JSON.stringify(obj, getJSONStringifyReplacer());\n expect(result).toEqual(expected);\n });\n});\n"],
|
5
|
+
"mappings": "AAAA,OAAS,0BAAAA,MAA8B,2CAEvC,OAAS,iBAAAC,MAAqB,+CAI9B,OAAS,4BAAAC,MAAgC,0BAEzC,SAAS,2BAA4B,IAAM,CACzC,GAAG,8DAA+D,IAAM,CACtE,MAAMC,EAAWD,EAAyB,EACpCE,EAAQ,IAAI,WAAW,CAAC,EAAG,EAAG,CAAC,CAAC,EAChCC,EAASF,EAAS,MAAOC,CAAK,EACpC,OAAOC,CAAM,EAAE,QAAQ,CACrB,IAAK,WACL,YAAa,WACb,MAAO,OACT,CAAC,CACH,CAAC,EAED,GAAG,uDAAwD,IAAM,CAC/D,MAAMC,EAAkBN,EAAuB,EACzCG,EAAWD,EAAyB,EAEpCK,EAA4C,CAChD,YAAaP,EAAuB,EACpC,KAAM,MACN,GAAI,iBACJ,SAAU,GAAG,GAAG,EAChB,UAAW,KACb,EAEMI,EAAQ,IAAIH,EAChB,CACE,gBAAAM,EACA,GAAI,iBACN,EACA,GAAG,GAAG,EACN,CAAC,EACD,CAAC,CACH,EACMF,EAAS,KAAK,UAAUD,EAAOD,CAAQ,EACvCK,EAAW,4DAA4D,KAAK,UAChFF,CACF,CAAC,wCACDF,EAAM,MAAM,EACZ,OAAOC,CAAM,EAAE,QAAQG,CAAQ,CACjC,CAAC,EAED,GAAG,6DAA8D,IAAM,CAMrE,MAAMC,EAAsB,CAAE,KAAM,OAAQ,EAC5CA,EAAI,KAAOA,EAEX,MAAMD,EAAW,uCACXH,EAAS,KAAK,UAAUI,EAAKP,EAAyB,CAAC,EAC7D,OAAOG,CAAM,EAAE,QAAQG,CAAQ,CACjC,CAAC,CACH,CAAC",
|
6
6
|
"names": ["deviceModelStubBuilder", "DeviceSession", "getJSONStringifyReplacer", "replacer", "value", "result", "stubDeviceModel", "connectedDevice", "expected", "obj"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
class e{log=
|
1
|
+
class e{log=vi.fn()}export{e as ConsoleLogger};
|
2
2
|
//# sourceMappingURL=ConsoleLogger.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../../src/api/logger-subscriber/service/__mocks__/ConsoleLogger.ts"],
|
4
|
-
"sourcesContent": ["export class ConsoleLogger {\n log =
|
5
|
-
"mappings": "AAAO,MAAMA,CAAc,CACzB,IAAM,
|
4
|
+
"sourcesContent": ["export class ConsoleLogger {\n log = vi.fn();\n}\n"],
|
5
|
+
"mappings": "AAAO,MAAMA,CAAc,CACzB,IAAM,GAAG,GAAG,CACd",
|
6
6
|
"names": ["ConsoleLogger"]
|
7
7
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
//# sourceMappingURL=DeviceApduSender.js.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
class
|
1
|
+
class n{constructor(){}create=vi.fn().mockImplementation(()=>({sendApdu:vi.fn()}))}export{n as DeviceConnectionFactoryStub};
|
2
2
|
//# sourceMappingURL=DeviceConnectionFactory.stub.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/transport/model/DeviceConnectionFactory.stub.ts"],
|
4
|
-
"sourcesContent": ["export class DeviceConnectionFactoryStub {\n constructor() {}\n\n create =
|
5
|
-
"mappings": "AAAO,MAAMA,CAA4B,CACvC,aAAc,CAAC,CAEf,OAAS,
|
4
|
+
"sourcesContent": ["export class DeviceConnectionFactoryStub {\n constructor() {}\n\n create = vi.fn().mockImplementation(() => ({\n sendApdu: vi.fn(),\n }));\n}\n"],
|
5
|
+
"mappings": "AAAO,MAAMA,CAA4B,CACvC,aAAc,CAAC,CAEf,OAAS,GAAG,GAAG,EAAE,mBAAmB,KAAO,CACzC,SAAU,GAAG,GAAG,CAClB,EAAE,CACJ",
|
6
6
|
"names": ["DeviceConnectionFactoryStub"]
|
7
7
|
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{Left as s,Maybe as A,Nothing as g,Right as m}from"purify-ts";import{assign as d,createActor as v,emit as D,setup as y}from"xstate";import{CommandUtils as h}from"../../command/utils/CommandUtils";import{UnknownDeviceExchangeError as R}from"../../Error";import{AlreadySendingApduError as C,DeviceDisconnectedBeforeSendingApdu as T,DeviceDisconnectedWhileSendingError as p}from"./Errors";class w{deviceId;deviceAdpuSender;machineActor;timeoutDuration;timeout=null;startReconnectionTimeout(){this.timeout=setTimeout(()=>{this.machineActor.send({type:"ReconnectionTimedOut"})},this.timeoutDuration)}constructor(n){this.deviceId=n.deviceId,this.deviceAdpuSender=n.deviceApduSender,this.timeoutDuration=n.timeoutDuration,this.machineActor=v(S({sendApduFn:(o,t)=>this.sendApduToDeviceConnection(o,t),startReconnectionTimeout:()=>this.startReconnectionTimeout(),cancelReconnectionTimeout:()=>{this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},onTerminated:n.onTerminated,closeConnection:()=>{this.deviceAdpuSender.closeConnection()}})),this.machineActor.start()}sendApduToDeviceConnection(n,o){console.log("[sendApduToDeviceConnection] called",n,o),this.deviceAdpuSender.sendApdu(n,o).then(t=>{t.caseOf({Left:i=>{console.log("[sendApduToDeviceConnection] got error response",i),this.machineActor.send({type:"ApduSendingError",error:i})},Right:i=>{console.log("[sendApduToDeviceConnection] got successful response",i),this.machineActor.send({type:"ApduResponseReceived",apduResponse:i})}})}).catch(t=>{console.log("[sendApduToDeviceConnection] caught error",t),this.machineActor.send({type:"ApduSendingError",error:new R(t)})})}getDependencies(){return this.deviceAdpuSender.getDependencies()}setDependencies(n){this.deviceAdpuSender.setDependencies(n)}getDeviceId(){return this.deviceId}sendApdu(n,o){return new Promise(t=>{this.machineActor.send({type:"SendApduCalled",apdu:n,triggersDisconnection:!!o,responseCallback:t})})}async setupConnection(){await this.deviceAdpuSender.setupConnection()}eventDeviceAttached(){this.machineActor.send({type:"DeviceAttached"})}eventDeviceDetached(){this.machineActor.send({type:"DeviceDetached"})}closeConnection(){this.machineActor.send({type:"CloseConnectionCalled"})}}function S({sendApduFn:a,startReconnectionTimeout:n,cancelReconnectionTimeout:o,onTerminated:t,closeConnection:i}){return y({types:{},actions:{startTimer:()=>{n()},cancelTimer:()=>{o()},reconnectionTimeoutEvent:D({type:"ReconnectionTimedOut"}),sendApdu:({context:e})=>{e.apduInProgress.caseOf({Just:({apdu:c})=>{a(c,!1)},Nothing:()=>{console.error("sendApdu called while no apdu in progress")}})},sendApduResponse:({context:e},c)=>{e.apduInProgress.caseOf({Just:({responseCallback:r})=>{r(c.response)},Nothing:()=>{console.error("sendApduResponse called while no apdu in progress")}})},cleanupContext:d({apduInProgress:g}),signalTermination:()=>{t()},closeConnection:async()=>{try{await i()}catch(e){console.error("Error closing connection",e)}}},guards:{isApduThatTriggersDisconnection:({context:e},c)=>e.apduInProgress.caseOf({Just:({triggersDisconnection:r,apdu:u})=>{const l=(r||h.isApduThatTriggersDisconnection(u))&&h.isSuccessResponse(c.apduResponse);return console.log("isApduThatTriggersDisconnection",l,u),l},Nothing:()=>!1})}}).createMachine({id:"deviceConnection",initial:"Connected",context:{apduInProgress:g},states:{Connected:{on:{DeviceDetached:{target:"WaitingForReconnection"},SendApduCalled:{target:"SendingApdu",actions:d({apduInProgress:({event:e})=>A.of({apdu:e.apdu,triggersDisconnection:e.triggersDisconnection,responseCallback:e.responseCallback})})},CloseConnectionCalled:{target:"Terminated"}}},SendingApdu:{entry:"sendApdu",on:{ApduResponseReceived:[{guard:{type:"isApduThatTriggersDisconnection",params:({event:e})=>({apduResponse:e.apduResponse})},target:"WaitingForReconnection",actions:[{type:"sendApduResponse",params:({event:e})=>({response:m(e.apduResponse)})},{type:"cleanupContext"}]},{target:"Connected",actions:[{type:"sendApduResponse",params:({event:e})=>({response:m(e.apduResponse)})},{type:"cleanupContext"}]}],ApduSendingError:{target:"Connected",actions:[{type:"sendApduResponse",params:({event:e})=>({response:s(e.error)})},"cleanupContext"]},DeviceDetached:{target:"WaitingForReconnection",actions:[{type:"sendApduResponse",params:{response:s(new p)}},"cleanupContext"]},CloseConnectionCalled:{target:"Terminated",actions:[{type:"sendApduResponse",params:{response:s(new p)}},"cleanupContext"]},SendApduCalled:{actions:({event:e})=>{console.log("EXTRA SendApduCalled while in state: SendingApdu state"),e.responseCallback(s(new C))}}}},WaitingForReconnection:{entry:"startTimer",on:{DeviceAttached:{target:"Connected",actions:"cancelTimer"},SendApduCalled:{target:"WaitingForReconnectionWithQueuedSendApdu",actions:d({apduInProgress:({event:e})=>A.of({apdu:e.apdu,triggersDisconnection:e.triggersDisconnection,responseCallback:e.responseCallback})})},ReconnectionTimedOut:{target:"Terminated"},CloseConnectionCalled:{target:"Terminated"}}},WaitingForReconnectionWithQueuedSendApdu:{on:{DeviceAttached:{target:"SendingApdu",actions:"cancelTimer"},ReconnectionTimedOut:{target:"Terminated",actions:[{type:"sendApduResponse",params:{response:s(new T)}},{type:"cleanupContext"}]},CloseConnectionCalled:{target:"Terminated",actions:[{type:"sendApduResponse",params:{response:s(new p)}},"cleanupContext"]},SendApduCalled:{actions:({event:e})=>{console.log("EXTRA SendApduCalled while in state:WaitingForReconnectionWithQueuedSendApdu"),e.responseCallback(s(new C))}}}},Terminated:{entry:["signalTermination","closeConnection"],type:"final"}}})}export{w as DeviceConnectionStateMachine};
|
2
|
+
//# sourceMappingURL=DeviceConnectionStateMachine.js.map
|