@ledgerhq/device-management-kit 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/package.json +1 -2
- package/lib/cjs/src/api/apdu/utils/ApduBuilder.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ApduBuilder.js.map +3 -3
- package/lib/cjs/src/api/command/Errors.js +1 -1
- package/lib/cjs/src/api/command/Errors.js.map +3 -3
- package/lib/cjs/src/api/command/model/CommandResult.js +1 -1
- package/lib/cjs/src/api/command/model/CommandResult.js.map +3 -3
- package/lib/cjs/src/api/command/os/BackupStorageCommand.js +2 -0
- package/lib/cjs/src/api/command/os/BackupStorageCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/BackupStorageCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/BackupStorageCommand.test.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetAppStorageInfoCommand.js +2 -0
- package/lib/cjs/src/api/command/os/GetAppStorageInfoCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetAppStorageInfoCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/GetAppStorageInfoCommand.test.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetBatteryStatusCommand.js +1 -1
- package/lib/cjs/src/api/command/os/GetBatteryStatusCommand.js.map +3 -3
- package/lib/cjs/src/api/command/os/GetBatteryStatusCommand.test.js +1 -1
- package/lib/cjs/src/api/command/os/GetBatteryStatusCommand.test.js.map +3 -3
- 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/device-action/__test-utils__/setupTestMachine.js +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/types.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.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/GoToDashboard/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.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/ListApps/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListApps/types.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 +3 -3
- 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/ListAppsWithMetadata/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListAppsWithMetadata/types.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 +3 -3
- 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 +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +3 -3
- 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 +3 -3
- 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 +3 -3
- package/lib/cjs/src/api/device-action/task/BackupAppStorageTask.js +2 -0
- package/lib/cjs/src/api/device-action/task/BackupAppStorageTask.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/BackupAppStorageTask.test.js +2 -0
- package/lib/cjs/src/api/device-action/task/BackupAppStorageTask.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/Errors.js +2 -0
- package/lib/cjs/src/api/device-action/task/Errors.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.js +1 -1
- package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.js.map +3 -3
- package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.test.js +1 -1
- package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js.map +3 -3
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js +1 -1
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +3 -3
- 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 +2 -2
- package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +1 -1
- package/lib/cjs/src/api/device-session/use-case/DisableDeviceSessionRefresher.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/model/DmkResult.js +2 -0
- package/lib/cjs/src/api/model/DmkResult.js.map +7 -0
- package/lib/cjs/src/api/model/DmkResult.test.js +2 -0
- package/lib/cjs/src/api/model/DmkResult.test.js.map +7 -0
- package/lib/cjs/src/api/network/DmkNetworkClient.js +2 -0
- package/lib/cjs/src/api/network/DmkNetworkClient.js.map +7 -0
- package/lib/cjs/src/api/network/DmkNetworkClient.test.js +2 -0
- package/lib/cjs/src/api/network/DmkNetworkClient.test.js.map +7 -0
- package/lib/cjs/src/api/network/DmkNetworkClientError.js +2 -0
- package/lib/cjs/src/api/network/DmkNetworkClientError.js.map +7 -0
- package/lib/cjs/src/api/network/DmkNetworkClientHelpers.js +2 -0
- package/lib/cjs/src/api/network/DmkNetworkClientHelpers.js.map +7 -0
- package/lib/cjs/src/api/network/DmkNetworkClientHelpers.test.js +2 -0
- package/lib/cjs/src/api/network/DmkNetworkClientHelpers.test.js.map +7 -0
- package/lib/cjs/src/api/storage/KeyValueStorage.js +2 -0
- package/lib/cjs/src/api/storage/KeyValueStorage.js.map +7 -0
- package/lib/cjs/src/api/types.js +1 -1
- package/lib/cjs/src/api/types.js.map +1 -1
- package/lib/cjs/src/api/utils/ApplicationChecker.js +2 -0
- package/lib/cjs/src/api/utils/ApplicationChecker.js.map +7 -0
- package/lib/cjs/src/api/utils/ApplicationChecker.test.js +2 -0
- package/lib/cjs/src/api/utils/ApplicationChecker.test.js.map +7 -0
- package/lib/cjs/src/api/utils/ApplicationResolver.js +2 -0
- package/lib/cjs/src/api/utils/ApplicationResolver.js.map +7 -0
- package/lib/cjs/src/api/utils/Base64String.js +1 -1
- package/lib/cjs/src/api/utils/Base64String.js.map +3 -3
- package/lib/cjs/src/api/utils/Base64String.test.js +1 -1
- package/lib/cjs/src/api/utils/Base64String.test.js.map +3 -3
- package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
- package/lib/cjs/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +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/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/manager-api/data/HttpManagerApiDataSource.js +2 -0
- package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.test.js +2 -0
- package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.test.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/data/__mocks__/HttpManagerApiDataSource.js +2 -0
- package/lib/cjs/src/internal/manager-api/data/__mocks__/HttpManagerApiDataSource.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
- 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 +3 -3
- 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/esm/package.json +1 -2
- package/lib/esm/src/api/apdu/utils/ApduBuilder.js +1 -1
- package/lib/esm/src/api/apdu/utils/ApduBuilder.js.map +3 -3
- package/lib/esm/src/api/command/Errors.js +1 -1
- package/lib/esm/src/api/command/Errors.js.map +3 -3
- package/lib/esm/src/api/command/model/CommandResult.js +1 -1
- package/lib/esm/src/api/command/model/CommandResult.js.map +3 -3
- package/lib/esm/src/api/command/os/BackupStorageCommand.js +2 -0
- package/lib/esm/src/api/command/os/BackupStorageCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/BackupStorageCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/BackupStorageCommand.test.js.map +7 -0
- package/lib/esm/src/api/command/os/GetAppStorageInfoCommand.js +2 -0
- package/lib/esm/src/api/command/os/GetAppStorageInfoCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/GetAppStorageInfoCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/GetAppStorageInfoCommand.test.js.map +7 -0
- package/lib/esm/src/api/command/os/GetBatteryStatusCommand.js +1 -1
- package/lib/esm/src/api/command/os/GetBatteryStatusCommand.js.map +3 -3
- package/lib/esm/src/api/command/os/GetBatteryStatusCommand.test.js +1 -1
- package/lib/esm/src/api/command/os/GetBatteryStatusCommand.test.js.map +3 -3
- 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/device-action/__test-utils__/setupTestMachine.js +1 -1
- package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +3 -3
- 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 +4 -4
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js +1 -0
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js.map +4 -4
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/types.js +1 -0
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/types.js.map +4 -4
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.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/GoToDashboard/types.js +1 -0
- package/lib/esm/src/api/device-action/os/GoToDashboard/types.js.map +4 -4
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -0
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js.map +4 -4
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.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/ListApps/types.js +1 -0
- package/lib/esm/src/api/device-action/os/ListApps/types.js.map +4 -4
- 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 +3 -3
- 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/ListAppsWithMetadata/types.js +1 -0
- package/lib/esm/src/api/device-action/os/ListAppsWithMetadata/types.js.map +4 -4
- 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 +3 -3
- 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/OpenAppDeviceAction/types.js +1 -0
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/types.js.map +4 -4
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -0
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js.map +4 -4
- 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 +3 -3
- 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/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js +1 -0
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +4 -4
- package/lib/esm/src/api/device-action/task/BackupAppStorageTask.js +2 -0
- package/lib/esm/src/api/device-action/task/BackupAppStorageTask.js.map +7 -0
- package/lib/esm/src/api/device-action/task/BackupAppStorageTask.test.js +2 -0
- package/lib/esm/src/api/device-action/task/BackupAppStorageTask.test.js.map +7 -0
- package/lib/esm/src/api/device-action/task/Errors.js +2 -0
- package/lib/esm/src/api/device-action/task/Errors.js.map +7 -0
- package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.js +1 -1
- package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.js.map +3 -3
- package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.test.js +1 -1
- package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.test.js.map +3 -3
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js +1 -1
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js.map +3 -3
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js +1 -1
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.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 +2 -2
- package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.test.js +1 -1
- package/lib/esm/src/api/device-session/use-case/DisableDeviceSessionRefresher.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/model/DmkResult.js +2 -0
- package/lib/esm/src/api/model/DmkResult.js.map +7 -0
- package/lib/esm/src/api/model/DmkResult.test.js +2 -0
- package/lib/esm/src/api/model/DmkResult.test.js.map +7 -0
- package/lib/esm/src/api/network/DmkNetworkClient.js +2 -0
- package/lib/esm/src/api/network/DmkNetworkClient.js.map +7 -0
- package/lib/esm/src/api/network/DmkNetworkClient.test.js +2 -0
- package/lib/esm/src/api/network/DmkNetworkClient.test.js.map +7 -0
- package/lib/esm/src/api/network/DmkNetworkClientError.js +2 -0
- package/lib/esm/src/api/network/DmkNetworkClientError.js.map +7 -0
- package/lib/esm/src/api/network/DmkNetworkClientHelpers.js +2 -0
- package/lib/esm/src/api/network/DmkNetworkClientHelpers.js.map +7 -0
- package/lib/esm/src/api/network/DmkNetworkClientHelpers.test.js +2 -0
- package/lib/esm/src/api/network/DmkNetworkClientHelpers.test.js.map +7 -0
- package/lib/esm/src/api/storage/KeyValueStorage.js +2 -0
- package/lib/esm/src/api/storage/KeyValueStorage.js.map +7 -0
- package/lib/esm/src/api/utils/ApplicationChecker.js +2 -0
- package/lib/esm/src/api/utils/ApplicationChecker.js.map +7 -0
- package/lib/esm/src/api/utils/ApplicationChecker.test.js +2 -0
- package/lib/esm/src/api/utils/ApplicationChecker.test.js.map +7 -0
- package/lib/esm/src/api/utils/ApplicationResolver.js +1 -0
- package/lib/esm/src/api/utils/ApplicationResolver.js.map +7 -0
- package/lib/esm/src/api/utils/Base64String.js +1 -1
- package/lib/esm/src/api/utils/Base64String.js.map +3 -3
- package/lib/esm/src/api/utils/Base64String.test.js +1 -1
- package/lib/esm/src/api/utils/Base64String.test.js.map +3 -3
- package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js +1 -1
- package/lib/esm/src/internal/device-session/service/DefaultDeviceSessionService.test.js.map +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/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/manager-api/data/HttpManagerApiDataSource.js +2 -0
- package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.js.map +7 -0
- package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.test.js +2 -0
- package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.test.js.map +7 -0
- package/lib/esm/src/internal/manager-api/data/__mocks__/{AxiosManagerApiDataSource.js → HttpManagerApiDataSource.js} +2 -2
- package/lib/esm/src/internal/manager-api/data/__mocks__/HttpManagerApiDataSource.js.map +7 -0
- package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
- package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
- 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 +3 -3
- 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/types/src/api/apdu/utils/ApduBuilder.d.ts +7 -0
- package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts.map +1 -1
- package/lib/types/src/api/command/Errors.d.ts +0 -20
- package/lib/types/src/api/command/Errors.d.ts.map +1 -1
- package/lib/types/src/api/command/model/CommandResult.d.ts +11 -17
- package/lib/types/src/api/command/model/CommandResult.d.ts.map +1 -1
- package/lib/types/src/api/command/os/BackupStorageCommand.d.ts +23 -0
- package/lib/types/src/api/command/os/BackupStorageCommand.d.ts.map +1 -0
- package/lib/types/src/api/command/os/BackupStorageCommand.test.d.ts +2 -0
- package/lib/types/src/api/command/os/BackupStorageCommand.test.d.ts.map +1 -0
- package/lib/types/src/api/command/os/GetAppStorageInfoCommand.d.ts +31 -0
- package/lib/types/src/api/command/os/GetAppStorageInfoCommand.d.ts.map +1 -0
- package/lib/types/src/api/command/os/GetAppStorageInfoCommand.test.d.ts +2 -0
- package/lib/types/src/api/command/os/GetAppStorageInfoCommand.test.d.ts.map +1 -0
- package/lib/types/src/api/command/os/GetBatteryStatusCommand.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/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts +9 -6
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +16 -7
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +16 -4
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceStatus/types.d.ts +6 -0
- package/lib/types/src/api/device-action/os/GetDeviceStatus/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.d.ts +1 -1
- package/lib/types/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts +9 -1
- package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +9 -1
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/ListApps/ListAppsDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/ListApps/types.d.ts +6 -0
- package/lib/types/src/api/device-action/os/ListApps/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/ListAppsWithMetadata/types.d.ts +8 -1
- package/lib/types/src/api/device-action/os/ListAppsWithMetadata/types.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 +12 -2
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +8 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/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 +9 -1
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-action/task/BackupAppStorageTask.d.ts +23 -0
- package/lib/types/src/api/device-action/task/BackupAppStorageTask.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/BackupAppStorageTask.test.d.ts +2 -0
- package/lib/types/src/api/device-action/task/BackupAppStorageTask.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/Errors.d.ts +12 -0
- package/lib/types/src/api/device-action/task/Errors.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.d.ts +5 -3
- package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.d.ts.map +1 -1
- package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts +7 -3
- package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts.map +1 -1
- package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/index.d.ts +13 -2
- package/lib/types/src/api/index.d.ts.map +1 -1
- package/lib/types/src/api/model/DmkResult.d.ts +24 -0
- package/lib/types/src/api/model/DmkResult.d.ts.map +1 -0
- package/lib/types/src/api/model/DmkResult.test.d.ts +2 -0
- package/lib/types/src/api/model/DmkResult.test.d.ts.map +1 -0
- package/lib/types/src/api/network/DmkNetworkClient.d.ts +97 -0
- package/lib/types/src/api/network/DmkNetworkClient.d.ts.map +1 -0
- package/lib/types/src/api/network/DmkNetworkClient.test.d.ts +2 -0
- package/lib/types/src/api/network/DmkNetworkClient.test.d.ts.map +1 -0
- package/lib/types/src/api/network/DmkNetworkClientError.d.ts +33 -0
- package/lib/types/src/api/network/DmkNetworkClientError.d.ts.map +1 -0
- package/lib/types/src/api/network/DmkNetworkClientHelpers.d.ts +73 -0
- package/lib/types/src/api/network/DmkNetworkClientHelpers.d.ts.map +1 -0
- package/lib/types/src/api/network/DmkNetworkClientHelpers.test.d.ts +2 -0
- package/lib/types/src/api/network/DmkNetworkClientHelpers.test.d.ts.map +1 -0
- package/lib/types/src/api/storage/KeyValueStorage.d.ts +7 -0
- package/lib/types/src/api/storage/KeyValueStorage.d.ts.map +1 -0
- package/lib/types/src/api/types.d.ts +2 -0
- package/lib/types/src/api/types.d.ts.map +1 -1
- package/lib/types/src/api/utils/ApplicationChecker.d.ts +14 -0
- package/lib/types/src/api/utils/ApplicationChecker.d.ts.map +1 -0
- package/lib/types/src/api/utils/ApplicationChecker.test.d.ts +2 -0
- package/lib/types/src/api/utils/ApplicationChecker.test.d.ts.map +1 -0
- package/lib/types/src/api/utils/ApplicationResolver.d.ts +12 -0
- package/lib/types/src/api/utils/ApplicationResolver.d.ts.map +1 -0
- package/lib/types/src/api/utils/Base64String.d.ts +1 -0
- package/lib/types/src/api/utils/Base64String.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/{AxiosManagerApiDataSource.d.ts → HttpManagerApiDataSource.d.ts} +3 -3
- package/lib/types/src/internal/manager-api/data/HttpManagerApiDataSource.d.ts.map +1 -0
- package/lib/types/src/internal/manager-api/data/HttpManagerApiDataSource.test.d.ts +2 -0
- package/lib/types/src/internal/manager-api/data/HttpManagerApiDataSource.test.d.ts.map +1 -0
- package/lib/types/src/internal/manager-api/data/__mocks__/{AxiosManagerApiDataSource.d.ts → HttpManagerApiDataSource.d.ts} +2 -2
- package/lib/types/src/internal/manager-api/data/__mocks__/HttpManagerApiDataSource.d.ts.map +1 -0
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +2 -3
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +0 -2
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +0 -7
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +0 -2
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +0 -7
- package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +0 -2
- package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +0 -7
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +0 -2
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +0 -7
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +0 -2
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +0 -7
- package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +0 -7
- package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +0 -1
- package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.test.d.ts +0 -2
- package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.test.d.ts.map +0 -1
- package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var s=require("./DmkNetworkClientError"),t=require("./DmkNetworkClientHelpers");describe("DmkNetworkClientHelpers",()=>{describe("joinPath",()=>{it("should return the base when the path is empty",()=>{expect((0,t.joinPath)("https://api.example.com","")).toBe("https://api.example.com")}),it("should insert a single slash when neither side has one",()=>{expect((0,t.joinPath)("https://api.example.com","items")).toBe("https://api.example.com/items")}),it("should collapse a trailing base slash with a leading path slash",()=>{expect((0,t.joinPath)("https://api.example.com/","/items")).toBe("https://api.example.com/items")}),it("should keep a single slash when only one side has one",()=>{expect((0,t.joinPath)("https://api.example.com/","items")).toBe("https://api.example.com/items"),expect((0,t.joinPath)("https://api.example.com","/items")).toBe("https://api.example.com/items")})}),describe("buildUrl",()=>{it("should keep an absolute URL as-is",()=>{const e=(0,t.buildUrl)({url:"https://api.example.com/items"});expect(e.toString()).toBe("https://api.example.com/items")}),it("should prepend the base URL to a relative path",()=>{const e=(0,t.buildUrl)({url:"/items",baseUrl:"https://api.example.com/"});expect(e.toString()).toBe("https://api.example.com/items")}),it("should ignore the base URL when the input URL is absolute",()=>{const e=(0,t.buildUrl)({url:"https://other.example.com/items",baseUrl:"https://api.example.com"});expect(e.toString()).toBe("https://other.example.com/items")}),it("should append query params and skip null/undefined entries",()=>{const e=(0,t.buildUrl)({url:"https://api.example.com/items",params:{chain:1,contract:"0xabc",active:!0,skip:null,alsoSkip:void 0}});expect(e.searchParams.get("chain")).toBe("1"),expect(e.searchParams.get("contract")).toBe("0xabc"),expect(e.searchParams.get("active")).toBe("true"),expect(e.searchParams.has("skip")).toBe(!1),expect(e.searchParams.has("alsoSkip")).toBe(!1)})}),describe("hasHeader",()=>{it("should find a header regardless of case",()=>{expect((0,t.hasHeader)({"Content-Type":"json"},"content-type")).toBe(!0),expect((0,t.hasHeader)({"content-type":"json"},"Content-Type")).toBe(!0)}),it("should return false when no matching header exists",()=>{expect((0,t.hasHeader)({Accept:"json"},"content-type")).toBe(!1),expect((0,t.hasHeader)({},"content-type")).toBe(!1)})}),describe("isRawBody",()=>{it("should accept native BodyInit values",()=>{expect((0,t.isRawBody)("raw-string")).toBe(!0),expect((0,t.isRawBody)(new ArrayBuffer(4))).toBe(!0),expect((0,t.isRawBody)(new Uint8Array([1,2,3]))).toBe(!0),expect((0,t.isRawBody)(new Blob(["a"]))).toBe(!0),expect((0,t.isRawBody)(new FormData)).toBe(!0),expect((0,t.isRawBody)(new URLSearchParams({a:"1"}))).toBe(!0),expect((0,t.isRawBody)(new ReadableStream)).toBe(!0)}),it("should reject plain objects and primitives",()=>{expect((0,t.isRawBody)({foo:"bar"})).toBe(!1),expect((0,t.isRawBody)([1,2,3])).toBe(!1),expect((0,t.isRawBody)(42)).toBe(!1),expect((0,t.isRawBody)(null)).toBe(!1),expect((0,t.isRawBody)(void 0)).toBe(!1)})}),describe("buildBodyAndHeaders",()=>{it("should merge default and per-request headers with per-request winning",()=>{const{headers:e}=(0,t.buildBodyAndHeaders)({method:"GET",body:void 0,defaultHeaders:{"X-Default":"default","X-Shared":"from-default"},perRequestHeaders:{"X-Shared":"overridden","X-Per":"per"}});expect(e).toEqual({"X-Default":"default","X-Shared":"overridden","X-Per":"per"})}),it("should not emit a body on GET/HEAD even when a body is provided",()=>{const e=(0,t.buildBodyAndHeaders)({method:"GET",body:{foo:"bar"},defaultHeaders:{}});expect(e.body).toBeUndefined(),expect(e.headers["Content-Type"]).toBeUndefined()}),it("should JSON-stringify plain objects and set the Content-Type",()=>{const e=(0,t.buildBodyAndHeaders)({method:"POST",body:{foo:"bar"},defaultHeaders:{}});expect(e.body).toBe(JSON.stringify({foo:"bar"})),expect(e.headers["Content-Type"]).toBe(t.JSON_CONTENT_TYPE)}),it("should not override an explicit Content-Type header",()=>{const e=(0,t.buildBodyAndHeaders)({method:"POST",body:{foo:"bar"},defaultHeaders:{},perRequestHeaders:{"content-type":"application/vnd.custom+json"}});expect(e.body).toBe(JSON.stringify({foo:"bar"})),expect(e.headers["content-type"]).toBe("application/vnd.custom+json"),expect(e.headers["Content-Type"]).toBeUndefined()}),it("should pass raw BodyInit values through unchanged without JSON headers",()=>{const e=new FormData;e.set("field","value");const o=(0,t.buildBodyAndHeaders)({method:"POST",body:e,defaultHeaders:{}});expect(o.body).toBe(e),expect(o.headers["Content-Type"]).toBeUndefined()}),it("should return an undefined body when the body itself is undefined",()=>{const e=(0,t.buildBodyAndHeaders)({method:"POST",body:void 0,defaultHeaders:{"X-Default":"d"}});expect(e.body).toBeUndefined(),expect(e.headers).toEqual({"X-Default":"d"})})}),describe("buildSignal",()=>{it("should return undefined when no timeout and no external signal",()=>{expect((0,t.buildSignal)({timeoutMs:void 0,externalSignal:void 0})).toBeUndefined()}),it("should return undefined when timeout is zero and no external signal",()=>{expect((0,t.buildSignal)({timeoutMs:0,externalSignal:void 0})).toBeUndefined()}),it("should return the external signal alone when no timeout is configured",()=>{const e=new AbortController,o=(0,t.buildSignal)({timeoutMs:void 0,externalSignal:e.signal});expect(o).toBe(e.signal)}),it("should return a timeout signal when only a timeout is configured",()=>{const e=(0,t.buildSignal)({timeoutMs:1e3,externalSignal:void 0});expect(e).toBeInstanceOf(AbortSignal)}),it("should use the provided timeout value for AbortSignal.timeout",()=>{const e=vi.spyOn(AbortSignal,"timeout");(0,t.buildSignal)({timeoutMs:50,externalSignal:void 0}),expect(e).toHaveBeenCalledWith(50),e.mockRestore()}),it("should compose both signals with AbortSignal.any when both are set",()=>{const e=vi.spyOn(AbortSignal,"any"),o=new AbortController,n=(0,t.buildSignal)({timeoutMs:100,externalSignal:o.signal});expect(n).toBeInstanceOf(AbortSignal),expect(e).toHaveBeenCalledTimes(1),e.mockRestore()})}),describe("parseBody",()=>{it("should return undefined for 'void' response type without consuming the body",async()=>{const e=new Response("ignored"),o=await(0,t.parseBody)(e,"void");expect(o).toBeUndefined(),expect(e.bodyUsed).toBe(!1)}),it("should return text for 'text' response type",async()=>{const e=new Response("plain-body");await expect((0,t.parseBody)(e,"text")).resolves.toBe("plain-body")}),it("should return a Blob for 'blob' response type",async()=>{const e=new Response("blob-body"),o=await(0,t.parseBody)(e,"blob");expect(o).toBeInstanceOf(Blob)}),it("should return an ArrayBuffer for 'arrayBuffer' response type",async()=>{const e=new Response(new Uint8Array([1,2,3])),o=await(0,t.parseBody)(e,"arrayBuffer");expect(o).toBeInstanceOf(ArrayBuffer),expect(new Uint8Array(o)).toEqual(new Uint8Array([1,2,3]))}),it("should parse JSON for 'json' response type",async()=>{const e=new Response(JSON.stringify({hello:"world"}));await expect((0,t.parseBody)(e,"json")).resolves.toEqual({hello:"world"})}),it("should resolve to undefined for an empty JSON body",async()=>{const e=new Response("");await expect((0,t.parseBody)(e,"json")).resolves.toBeUndefined()}),it("should throw a DmkNetworkClientError for malformed JSON",async()=>{const e=new Response("not-json",{status:200,statusText:"OK"}),o=await(0,t.parseBody)(e,"json").catch(r=>r);expect(o).toBeInstanceOf(s.DmkNetworkClientError);const n=o;expect(n.status).toBe(200),expect(n.statusText).toBe("OK"),expect(n.responseBody).toBe("not-json"),expect(n.cause).toBeInstanceOf(SyntaxError)})}),describe("safeReadText",()=>{it("should return the text body",async()=>{await expect((0,t.safeReadText)(new Response("hello"))).resolves.toBe("hello")}),it("should return undefined when reading the body throws",async()=>{const e={text:()=>Promise.reject(new Error("read failed"))};await expect((0,t.safeReadText)(e)).resolves.toBeUndefined()})}),describe("wrapFetchError",()=>{it("should wrap a generic Error with its message",()=>{const e=new TypeError("network down"),o=(0,t.wrapFetchError)({cause:e,externalSignal:void 0,timeoutMs:void 0});expect(o).toBeInstanceOf(s.DmkNetworkClientError),expect(o.message).toBe("network down"),expect(o.cause).toBe(e),expect(o.isTimeout).toBe(!1),expect(o.isAbort).toBe(!1)}),it("should fall back to a generic message for non-Error causes",()=>{const e=(0,t.wrapFetchError)({cause:"something",externalSignal:void 0,timeoutMs:void 0});expect(e.message).toBe("Network request failed"),expect(e.cause).toBe("something")}),it("should flag TimeoutError as a timeout",()=>{const e=new Error("timed out");e.name="TimeoutError";const o=(0,t.wrapFetchError)({cause:e,externalSignal:void 0,timeoutMs:10});expect(o.isTimeout).toBe(!0),expect(o.isAbort).toBe(!1),expect(o.message).toBe("Request timed out")}),it("should flag AbortError as a timeout when a timeout is configured and no external abort",()=>{const e=new Error("aborted");e.name="AbortError";const o=(0,t.wrapFetchError)({cause:e,externalSignal:void 0,timeoutMs:1e3});expect(o.isTimeout).toBe(!0),expect(o.isAbort).toBe(!1)}),it("should flag AbortError as an external abort when the caller signal is aborted",()=>{const e=new AbortController;e.abort();const o=new Error("aborted");o.name="AbortError";const n=(0,t.wrapFetchError)({cause:o,externalSignal:e.signal,timeoutMs:void 0});expect(n.isAbort).toBe(!0),expect(n.isTimeout).toBe(!1),expect(n.message).toBe("Request aborted")}),it("should treat AbortError with no timeout and no external abort as a plain abort",()=>{const e=new Error("aborted");e.name="AbortError";const o=(0,t.wrapFetchError)({cause:e,externalSignal:void 0,timeoutMs:void 0});expect(o.isTimeout).toBe(!1),expect(o.isAbort).toBe(!1),expect(o.message).toBe("Request aborted")})})});
|
|
2
|
+
//# sourceMappingURL=DmkNetworkClientHelpers.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/api/network/DmkNetworkClientHelpers.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { DmkNetworkClientError } from \"./DmkNetworkClientError\";\nimport {\n buildBodyAndHeaders,\n buildSignal,\n buildUrl,\n hasHeader,\n isRawBody,\n joinPath,\n JSON_CONTENT_TYPE,\n parseBody,\n safeReadText,\n wrapFetchError,\n} from \"./DmkNetworkClientHelpers\";\n\ndescribe(\"DmkNetworkClientHelpers\", () => {\n describe(\"joinPath\", () => {\n it(\"should return the base when the path is empty\", () => {\n expect(joinPath(\"https://api.example.com\", \"\")).toBe(\n \"https://api.example.com\",\n );\n });\n\n it(\"should insert a single slash when neither side has one\", () => {\n expect(joinPath(\"https://api.example.com\", \"items\")).toBe(\n \"https://api.example.com/items\",\n );\n });\n\n it(\"should collapse a trailing base slash with a leading path slash\", () => {\n expect(joinPath(\"https://api.example.com/\", \"/items\")).toBe(\n \"https://api.example.com/items\",\n );\n });\n\n it(\"should keep a single slash when only one side has one\", () => {\n expect(joinPath(\"https://api.example.com/\", \"items\")).toBe(\n \"https://api.example.com/items\",\n );\n expect(joinPath(\"https://api.example.com\", \"/items\")).toBe(\n \"https://api.example.com/items\",\n );\n });\n });\n\n describe(\"buildUrl\", () => {\n it(\"should keep an absolute URL as-is\", () => {\n const url = buildUrl({ url: \"https://api.example.com/items\" });\n expect(url.toString()).toBe(\"https://api.example.com/items\");\n });\n\n it(\"should prepend the base URL to a relative path\", () => {\n const url = buildUrl({\n url: \"/items\",\n baseUrl: \"https://api.example.com/\",\n });\n expect(url.toString()).toBe(\"https://api.example.com/items\");\n });\n\n it(\"should ignore the base URL when the input URL is absolute\", () => {\n const url = buildUrl({\n url: \"https://other.example.com/items\",\n baseUrl: \"https://api.example.com\",\n });\n expect(url.toString()).toBe(\"https://other.example.com/items\");\n });\n\n it(\"should append query params and skip null/undefined entries\", () => {\n const url = buildUrl({\n url: \"https://api.example.com/items\",\n params: {\n chain: 1,\n contract: \"0xabc\",\n active: true,\n skip: null,\n alsoSkip: undefined,\n },\n });\n expect(url.searchParams.get(\"chain\")).toBe(\"1\");\n expect(url.searchParams.get(\"contract\")).toBe(\"0xabc\");\n expect(url.searchParams.get(\"active\")).toBe(\"true\");\n expect(url.searchParams.has(\"skip\")).toBe(false);\n expect(url.searchParams.has(\"alsoSkip\")).toBe(false);\n });\n });\n\n describe(\"hasHeader\", () => {\n it(\"should find a header regardless of case\", () => {\n expect(hasHeader({ \"Content-Type\": \"json\" }, \"content-type\")).toBe(true);\n expect(hasHeader({ \"content-type\": \"json\" }, \"Content-Type\")).toBe(true);\n });\n\n it(\"should return false when no matching header exists\", () => {\n expect(hasHeader({ Accept: \"json\" }, \"content-type\")).toBe(false);\n expect(hasHeader({}, \"content-type\")).toBe(false);\n });\n });\n\n describe(\"isRawBody\", () => {\n it(\"should accept native BodyInit values\", () => {\n expect(isRawBody(\"raw-string\")).toBe(true);\n expect(isRawBody(new ArrayBuffer(4))).toBe(true);\n expect(isRawBody(new Uint8Array([1, 2, 3]))).toBe(true);\n expect(isRawBody(new Blob([\"a\"]))).toBe(true);\n expect(isRawBody(new FormData())).toBe(true);\n expect(isRawBody(new URLSearchParams({ a: \"1\" }))).toBe(true);\n expect(isRawBody(new ReadableStream())).toBe(true);\n });\n\n it(\"should reject plain objects and primitives\", () => {\n expect(isRawBody({ foo: \"bar\" })).toBe(false);\n expect(isRawBody([1, 2, 3])).toBe(false);\n expect(isRawBody(42)).toBe(false);\n expect(isRawBody(null)).toBe(false);\n expect(isRawBody(undefined)).toBe(false);\n });\n });\n\n describe(\"buildBodyAndHeaders\", () => {\n it(\"should merge default and per-request headers with per-request winning\", () => {\n const { headers } = buildBodyAndHeaders({\n method: \"GET\",\n body: undefined,\n defaultHeaders: { \"X-Default\": \"default\", \"X-Shared\": \"from-default\" },\n perRequestHeaders: { \"X-Shared\": \"overridden\", \"X-Per\": \"per\" },\n });\n expect(headers).toEqual({\n \"X-Default\": \"default\",\n \"X-Shared\": \"overridden\",\n \"X-Per\": \"per\",\n });\n });\n\n it(\"should not emit a body on GET/HEAD even when a body is provided\", () => {\n const result = buildBodyAndHeaders({\n method: \"GET\",\n body: { foo: \"bar\" },\n defaultHeaders: {},\n });\n expect(result.body).toBeUndefined();\n expect(result.headers[\"Content-Type\"]).toBeUndefined();\n });\n\n it(\"should JSON-stringify plain objects and set the Content-Type\", () => {\n const result = buildBodyAndHeaders({\n method: \"POST\",\n body: { foo: \"bar\" },\n defaultHeaders: {},\n });\n expect(result.body).toBe(JSON.stringify({ foo: \"bar\" }));\n expect(result.headers[\"Content-Type\"]).toBe(JSON_CONTENT_TYPE);\n });\n\n it(\"should not override an explicit Content-Type header\", () => {\n const result = buildBodyAndHeaders({\n method: \"POST\",\n body: { foo: \"bar\" },\n defaultHeaders: {},\n perRequestHeaders: { \"content-type\": \"application/vnd.custom+json\" },\n });\n expect(result.body).toBe(JSON.stringify({ foo: \"bar\" }));\n expect(result.headers[\"content-type\"]).toBe(\n \"application/vnd.custom+json\",\n );\n expect(result.headers[\"Content-Type\"]).toBeUndefined();\n });\n\n it(\"should pass raw BodyInit values through unchanged without JSON headers\", () => {\n const formData = new FormData();\n formData.set(\"field\", \"value\");\n const result = buildBodyAndHeaders({\n method: \"POST\",\n body: formData,\n defaultHeaders: {},\n });\n expect(result.body).toBe(formData);\n expect(result.headers[\"Content-Type\"]).toBeUndefined();\n });\n\n it(\"should return an undefined body when the body itself is undefined\", () => {\n const result = buildBodyAndHeaders({\n method: \"POST\",\n body: undefined,\n defaultHeaders: { \"X-Default\": \"d\" },\n });\n expect(result.body).toBeUndefined();\n expect(result.headers).toEqual({ \"X-Default\": \"d\" });\n });\n });\n\n describe(\"buildSignal\", () => {\n it(\"should return undefined when no timeout and no external signal\", () => {\n expect(\n buildSignal({\n timeoutMs: undefined,\n externalSignal: undefined,\n }),\n ).toBeUndefined();\n });\n\n it(\"should return undefined when timeout is zero and no external signal\", () => {\n expect(\n buildSignal({\n timeoutMs: 0,\n externalSignal: undefined,\n }),\n ).toBeUndefined();\n });\n\n it(\"should return the external signal alone when no timeout is configured\", () => {\n const controller = new AbortController();\n const signal = buildSignal({\n timeoutMs: undefined,\n externalSignal: controller.signal,\n });\n expect(signal).toBe(controller.signal);\n });\n\n it(\"should return a timeout signal when only a timeout is configured\", () => {\n const signal = buildSignal({\n timeoutMs: 1000,\n externalSignal: undefined,\n });\n expect(signal).toBeInstanceOf(AbortSignal);\n });\n\n it(\"should use the provided timeout value for AbortSignal.timeout\", () => {\n const timeoutSpy = vi.spyOn(AbortSignal, \"timeout\");\n buildSignal({\n timeoutMs: 50,\n externalSignal: undefined,\n });\n expect(timeoutSpy).toHaveBeenCalledWith(50);\n timeoutSpy.mockRestore();\n });\n\n it(\"should compose both signals with AbortSignal.any when both are set\", () => {\n const anySpy = vi.spyOn(AbortSignal, \"any\");\n const controller = new AbortController();\n const signal = buildSignal({\n timeoutMs: 100,\n externalSignal: controller.signal,\n });\n expect(signal).toBeInstanceOf(AbortSignal);\n expect(anySpy).toHaveBeenCalledTimes(1);\n anySpy.mockRestore();\n });\n });\n\n describe(\"parseBody\", () => {\n it(\"should return undefined for 'void' response type without consuming the body\", async () => {\n const response = new Response(\"ignored\");\n const result = await parseBody(response, \"void\");\n expect(result).toBeUndefined();\n expect(response.bodyUsed).toBe(false);\n });\n\n it(\"should return text for 'text' response type\", async () => {\n const response = new Response(\"plain-body\");\n await expect(parseBody(response, \"text\")).resolves.toBe(\"plain-body\");\n });\n\n it(\"should return a Blob for 'blob' response type\", async () => {\n const response = new Response(\"blob-body\");\n const result = await parseBody(response, \"blob\");\n expect(result).toBeInstanceOf(Blob);\n });\n\n it(\"should return an ArrayBuffer for 'arrayBuffer' response type\", async () => {\n const response = new Response(new Uint8Array([1, 2, 3]));\n const result = await parseBody(response, \"arrayBuffer\");\n expect(result).toBeInstanceOf(ArrayBuffer);\n expect(new Uint8Array(result as ArrayBuffer)).toEqual(\n new Uint8Array([1, 2, 3]),\n );\n });\n\n it(\"should parse JSON for 'json' response type\", async () => {\n const response = new Response(JSON.stringify({ hello: \"world\" }));\n await expect(parseBody(response, \"json\")).resolves.toEqual({\n hello: \"world\",\n });\n });\n\n it(\"should resolve to undefined for an empty JSON body\", async () => {\n const response = new Response(\"\");\n await expect(parseBody(response, \"json\")).resolves.toBeUndefined();\n });\n\n it(\"should throw a DmkNetworkClientError for malformed JSON\", async () => {\n const response = new Response(\"not-json\", {\n status: 200,\n statusText: \"OK\",\n });\n const error = await parseBody(response, \"json\").catch((e: unknown) => e);\n expect(error).toBeInstanceOf(DmkNetworkClientError);\n const dmkError = error as DmkNetworkClientError;\n expect(dmkError.status).toBe(200);\n expect(dmkError.statusText).toBe(\"OK\");\n expect(dmkError.responseBody).toBe(\"not-json\");\n expect(dmkError.cause).toBeInstanceOf(SyntaxError);\n });\n });\n\n describe(\"safeReadText\", () => {\n it(\"should return the text body\", async () => {\n await expect(safeReadText(new Response(\"hello\"))).resolves.toBe(\"hello\");\n });\n\n it(\"should return undefined when reading the body throws\", async () => {\n const response = {\n text: () => Promise.reject(new Error(\"read failed\")),\n } as unknown as Response;\n await expect(safeReadText(response)).resolves.toBeUndefined();\n });\n });\n\n describe(\"wrapFetchError\", () => {\n it(\"should wrap a generic Error with its message\", () => {\n const cause = new TypeError(\"network down\");\n const error = wrapFetchError({\n cause,\n externalSignal: undefined,\n timeoutMs: undefined,\n });\n expect(error).toBeInstanceOf(DmkNetworkClientError);\n expect(error.message).toBe(\"network down\");\n expect(error.cause).toBe(cause);\n expect(error.isTimeout).toBe(false);\n expect(error.isAbort).toBe(false);\n });\n\n it(\"should fall back to a generic message for non-Error causes\", () => {\n const error = wrapFetchError({\n cause: \"something\",\n externalSignal: undefined,\n timeoutMs: undefined,\n });\n expect(error.message).toBe(\"Network request failed\");\n expect(error.cause).toBe(\"something\");\n });\n\n it(\"should flag TimeoutError as a timeout\", () => {\n const cause = new Error(\"timed out\");\n cause.name = \"TimeoutError\";\n const error = wrapFetchError({\n cause,\n externalSignal: undefined,\n timeoutMs: 10,\n });\n expect(error.isTimeout).toBe(true);\n expect(error.isAbort).toBe(false);\n expect(error.message).toBe(\"Request timed out\");\n });\n\n it(\"should flag AbortError as a timeout when a timeout is configured and no external abort\", () => {\n const cause = new Error(\"aborted\");\n cause.name = \"AbortError\";\n const error = wrapFetchError({\n cause,\n externalSignal: undefined,\n timeoutMs: 1000,\n });\n expect(error.isTimeout).toBe(true);\n expect(error.isAbort).toBe(false);\n });\n\n it(\"should flag AbortError as an external abort when the caller signal is aborted\", () => {\n const controller = new AbortController();\n controller.abort();\n const cause = new Error(\"aborted\");\n cause.name = \"AbortError\";\n const error = wrapFetchError({\n cause,\n externalSignal: controller.signal,\n timeoutMs: undefined,\n });\n expect(error.isAbort).toBe(true);\n expect(error.isTimeout).toBe(false);\n expect(error.message).toBe(\"Request aborted\");\n });\n\n it(\"should treat AbortError with no timeout and no external abort as a plain abort\", () => {\n const cause = new Error(\"aborted\");\n cause.name = \"AbortError\";\n const error = wrapFetchError({\n cause,\n externalSignal: undefined,\n timeoutMs: undefined,\n });\n expect(error.isTimeout).toBe(false);\n expect(error.isAbort).toBe(false);\n expect(error.message).toBe(\"Request aborted\");\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAAsC,mCACtCC,EAWO,qCAEP,SAAS,0BAA2B,IAAM,CACxC,SAAS,WAAY,IAAM,CACzB,GAAG,gDAAiD,IAAM,CACxD,UAAO,YAAS,0BAA2B,EAAE,CAAC,EAAE,KAC9C,yBACF,CACF,CAAC,EAED,GAAG,yDAA0D,IAAM,CACjE,UAAO,YAAS,0BAA2B,OAAO,CAAC,EAAE,KACnD,+BACF,CACF,CAAC,EAED,GAAG,kEAAmE,IAAM,CAC1E,UAAO,YAAS,2BAA4B,QAAQ,CAAC,EAAE,KACrD,+BACF,CACF,CAAC,EAED,GAAG,wDAAyD,IAAM,CAChE,UAAO,YAAS,2BAA4B,OAAO,CAAC,EAAE,KACpD,+BACF,EACA,UAAO,YAAS,0BAA2B,QAAQ,CAAC,EAAE,KACpD,+BACF,CACF,CAAC,CACH,CAAC,EAED,SAAS,WAAY,IAAM,CACzB,GAAG,oCAAqC,IAAM,CAC5C,MAAMC,KAAM,YAAS,CAAE,IAAK,+BAAgC,CAAC,EAC7D,OAAOA,EAAI,SAAS,CAAC,EAAE,KAAK,+BAA+B,CAC7D,CAAC,EAED,GAAG,iDAAkD,IAAM,CACzD,MAAMA,KAAM,YAAS,CACnB,IAAK,SACL,QAAS,0BACX,CAAC,EACD,OAAOA,EAAI,SAAS,CAAC,EAAE,KAAK,+BAA+B,CAC7D,CAAC,EAED,GAAG,4DAA6D,IAAM,CACpE,MAAMA,KAAM,YAAS,CACnB,IAAK,kCACL,QAAS,yBACX,CAAC,EACD,OAAOA,EAAI,SAAS,CAAC,EAAE,KAAK,iCAAiC,CAC/D,CAAC,EAED,GAAG,6DAA8D,IAAM,CACrE,MAAMA,KAAM,YAAS,CACnB,IAAK,gCACL,OAAQ,CACN,MAAO,EACP,SAAU,QACV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F,IAAM,CACxF,MAAML,EAAa,IAAI,gBACvBA,EAAW,MAAM,EACjB,MAAMQ,EAAQ,IAAI,MAAM,SAAS,EACjCA,EAAM,KAAO,aACb,MAAMH,KAAQ,kBAAe,CAC3B,MAAAG,EACA,eAAgBR,EAAW,OAC3B,UAAW,MACb,CAAC,EACD,OAAOK,EAAM,OAAO,EAAE,KAAK,EAAI,EAC/B,OAAOA,EAAM,SAAS,EAAE,KAAK,EAAK,EAClC,OAAOA,EAAM,OAAO,EAAE,KAAK,iBAAiB,CAC9C,CAAC,EAED,GAAG,iFAAkF,IAAM,CACzF,MAAMG,EAAQ,IAAI,MAAM,SAAS,EACjCA,EAAM,KAAO,aACb,MAAMH,KAAQ,kBAAe,CAC3B,MAAAG,EACA,eAAgB,OAChB,UAAW,MACb,CAAC,EACD,OAAOH,EAAM,SAAS,EAAE,KAAK,EAAK,EAClC,OAAOA,EAAM,OAAO,EAAE,KAAK,EAAK,EAChC,OAAOA,EAAM,OAAO,EAAE,KAAK,iBAAiB,CAC9C,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_DmkNetworkClientError", "import_DmkNetworkClientHelpers", "url", "headers", "result", "formData", "controller", "signal", "timeoutSpy", "anySpy", "response", "error", "e", "dmkError", "cause"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var a=(t,e)=>{for(var i in e)o(t,i,{get:e[i],enumerable:!0})},k=(t,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of n(e))!g.call(t,r)&&r!==i&&o(t,r,{get:()=>e[r],enumerable:!(s=m(e,r))||s.enumerable});return t};var l=t=>k(o({},"__esModule",{value:!0}),t);var y={};a(y,{DMK_STORAGE_PREFIX_KEY:()=>v});module.exports=l(y);const v="dmk";0&&(module.exports={DMK_STORAGE_PREFIX_KEY});
|
|
2
|
+
//# sourceMappingURL=KeyValueStorage.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/api/storage/KeyValueStorage.ts"],
|
|
4
|
+
"sourcesContent": ["export const DMK_STORAGE_PREFIX_KEY = \"dmk\";\n\nexport interface KeyValueStorage {\n getItem(key: string): Promise<string | null>;\n setItem(key: string, value: string): Promise<void>;\n removeItem(key: string): Promise<void>;\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAyB",
|
|
6
|
+
"names": ["KeyValueStorage_exports", "__export", "DMK_STORAGE_PREFIX_KEY", "__toCommonJS"]
|
|
7
|
+
}
|
package/lib/cjs/src/api/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var A=(t,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of s(e))!i.call(t,p)&&p!==a&&o(t,p,{get:()=>e[p],enumerable:!(r=n(e,p))||r.enumerable});return t};var d=t=>A(o({},"__esModule",{value:!0}),t);var y={};module.exports=d(y);
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/api/types.ts"],
|
|
4
|
-
"sourcesContent": ["export type { OpenAppErrorCodes } from \"./command/os/OpenAppCommand\";\nexport type { CommandErrors } from \"./command/utils/CommandErrors\";\nexport type { DeviceId } from \"./device/DeviceModel\";\nexport type { ConnectionType } from \"./discovery/ConnectionType\";\nexport type { CommandErrorArgs } from \"./Error\";\nexport type { LogSubscriberOptions } from \"./logger-subscriber/model/LogSubscriberOptions\";\nexport type { DiscoveredDevice } from \"./transport/model/DiscoveredDevice\";\nexport type {\n Transport,\n TransportArgs,\n TransportFactory,\n} from \"./transport/model/Transport\";\nexport type { TransportIdentifier } from \"./transport/model/TransportIdentifier\";\nexport type { ApduBuilderArgs } from \"@api/apdu/utils/ApduBuilder\";\nexport type { Command } from \"@api/command/Command\";\nexport type {\n CommandErrorResult,\n CommandResult,\n CommandSuccessResult,\n} from \"@api/command/model/CommandResult\";\nexport type { SendCommandUseCaseArgs } from \"@api/command/use-case/SendCommandUseCase\";\nexport type { DeviceModelId } from \"@api/device/DeviceModel\";\nexport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"@api/device-action/DeviceAction\";\nexport {\n type GetDeviceMetadataDAError,\n type GetDeviceMetadataDAInput,\n type GetDeviceMetadataDAIntermediateValue,\n type GetDeviceMetadataDAOutput,\n type GetDeviceMetadataDAState,\n} from \"@api/device-action/os/GetDeviceMetadata/types\";\nexport {\n type GetDeviceStatusDAError,\n type GetDeviceStatusDAInput,\n type GetDeviceStatusDAIntermediateValue,\n type GetDeviceStatusDAOutput,\n type GetDeviceStatusDAState,\n} from \"@api/device-action/os/GetDeviceStatus/types\";\nexport {\n type GoToDashboardDAError,\n type GoToDashboardDAInput,\n type GoToDashboardDAIntermediateValue,\n type GoToDashboardDAOutput,\n type GoToDashboardDAState,\n} from \"@api/device-action/os/GoToDashboard/types\";\nexport {\n type ApplicationConstraint,\n type ApplicationDependency,\n type ApplicationVersionConstraint,\n type InstallOrUpdateAppsDAError,\n type InstallOrUpdateAppsDAInput,\n type InstallOrUpdateAppsDAIntermediateValue,\n type InstallOrUpdateAppsDAOutput,\n type InstallOrUpdateAppsDAState,\n type InstallPlan,\n} from \"@api/device-action/os/InstallOrUpdateApps/types\";\nexport {\n type ListAppsDAError,\n type ListAppsDAInput,\n type ListAppsDAIntermediateValue,\n type ListAppsDAOutput,\n type ListAppsDAState,\n} from \"@api/device-action/os/ListApps/types\";\nexport {\n type ListAppsWithMetadataDAError,\n type ListAppsWithMetadataDAInput,\n type ListAppsWithMetadataDAIntermediateValue,\n type ListAppsWithMetadataDAOutput,\n type ListAppsWithMetadataDAState,\n} from \"@api/device-action/os/ListAppsWithMetadata/types\";\nexport {\n type OpenAppDAError,\n type OpenAppDAInput,\n type OpenAppDAIntermediateValue,\n type OpenAppDAOutput,\n type OpenAppDARequiredInteraction,\n type OpenAppDAState,\n} from \"@api/device-action/os/OpenAppDeviceAction/types\";\nexport {\n type OpenAppWithDependenciesDAError,\n type OpenAppWithDependenciesDAInput,\n type OpenAppWithDependenciesDAIntermediateValue,\n type OpenAppWithDependenciesDAOutput,\n type OpenAppWithDependenciesDARequiredInteraction,\n type OpenAppWithDependenciesDAState,\n} from \"@api/device-action/os/OpenAppWithDependencies/types\";\nexport {\n type SendCommandInAppDAError,\n type SendCommandInAppDAInput,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n} from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes\";\nexport type { ExecuteDeviceActionUseCaseArgs } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nexport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nexport { type DeviceModelDataSource } from \"@api/device-model/data/DeviceModelDataSource\";\nexport type {\n Catalog,\n CustomImage,\n DeviceSessionState,\n FirmwareUpdate,\n FirmwareUpdateContext,\n FirmwareVersion,\n InstalledLanguagePackage,\n RunningApp,\n} from \"@api/device-session/DeviceSessionState\";\nexport { type ApduReceiverService } from \"@api/device-session/service/ApduReceiverService\";\nexport { type ApduReceiverServiceFactory } from \"@api/device-session/service/ApduReceiverService\";\nexport { type ApduSenderServiceFactory } from \"@api/device-session/service/ApduSenderService\";\nexport { type ApduSenderService } from \"@api/device-session/service/ApduSenderService\";\nexport type { DeviceSessionId } from \"@api/device-session/types\";\nexport type { DmkConfig } from \"@api/DmkConfig\";\nexport type { DmkError } from \"@api/Error\";\nexport type { LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nexport type {\n LoggerSubscriberService,\n LogParams,\n} from \"@api/logger-subscriber/service/LoggerSubscriberService\";\nexport {\n type GenuineCheckDAError,\n type GenuineCheckDAInput,\n type GenuineCheckDAIntermediateValue,\n type GenuineCheckDAOutput,\n type GenuineCheckDARequiredInteraction,\n type GenuineCheckDAState,\n} from \"@api/secure-channel/device-action/GenuineCheck/types\";\nexport {\n type InstallAppDAError,\n type InstallAppDAInput,\n type InstallAppDAIntermediateValue,\n type InstallAppDAOutput,\n type InstallAppDARequiredInteraction,\n type InstallAppDAState,\n} from \"@api/secure-channel/device-action/InstallApp/types\";\nexport {\n type ListInstalledAppsDAError,\n type ListInstalledAppsDAInput,\n type ListInstalledAppsDAIntermediateValue,\n type ListInstalledAppsDAOutput,\n type ListInstalledAppsDARequiredInteraction,\n type ListInstalledAppsDAState,\n} from \"@api/secure-channel/device-action/ListInstalledApps/types\";\nexport {\n type UninstallAppDAError,\n type UninstallAppDAInput,\n type UninstallAppDAIntermediateValue,\n type UninstallAppDAOutput,\n type UninstallAppDARequiredInteraction,\n type UninstallAppDAState,\n} from \"@api/secure-channel/device-action/UninstallApp/types\";\nexport { type DeviceApduSender } from \"@api/transport/model/DeviceApduSender\";\nexport {\n type DeviceConnection,\n type DisconnectHandler,\n type SendApduFnType,\n type SendApduResult,\n} from \"@api/transport/model/DeviceConnection\";\nexport { type TransportDiscoveredDevice } from \"@api/transport/model/TransportDiscoveredDevice\";\nexport type { HexaString } from \"@api/utils/HexaString\";\nexport type { ConnectUseCaseArgs } from \"@internal/discovery/use-case/ConnectUseCase\";\nexport type { DisconnectUseCaseArgs } from \"@internal/discovery/use-case/DisconnectUseCase\";\nexport type { GetConnectedDeviceUseCaseArgs } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nexport type { StartDiscoveringUseCaseArgs } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nexport type { SendApduUseCaseArgs } from \"@internal/send/use-case/SendApduUseCase\";\n"],
|
|
4
|
+
"sourcesContent": ["export type { OpenAppErrorCodes } from \"./command/os/OpenAppCommand\";\nexport type { CommandErrors } from \"./command/utils/CommandErrors\";\nexport type { DeviceId } from \"./device/DeviceModel\";\nexport type { ConnectionType } from \"./discovery/ConnectionType\";\nexport type { CommandErrorArgs } from \"./Error\";\nexport type { LogSubscriberOptions } from \"./logger-subscriber/model/LogSubscriberOptions\";\nexport type { DiscoveredDevice } from \"./transport/model/DiscoveredDevice\";\nexport type {\n Transport,\n TransportArgs,\n TransportFactory,\n} from \"./transport/model/Transport\";\nexport type { TransportIdentifier } from \"./transport/model/TransportIdentifier\";\nexport type { ApduBuilderArgs } from \"@api/apdu/utils/ApduBuilder\";\nexport type { Command } from \"@api/command/Command\";\nexport type {\n CommandErrorResult,\n CommandResult,\n CommandSuccessResult,\n} from \"@api/command/model/CommandResult\";\nexport type { SendCommandUseCaseArgs } from \"@api/command/use-case/SendCommandUseCase\";\nexport type { DeviceModelId } from \"@api/device/DeviceModel\";\nexport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"@api/device-action/DeviceAction\";\nexport {\n type CallTaskInAppDAError,\n type CallTaskInAppDAIntermediateValue,\n type CallTaskInAppDAOutput,\n} from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes\";\nexport {\n type GetDeviceMetadataDAError,\n type GetDeviceMetadataDAInput,\n type GetDeviceMetadataDAIntermediateValue,\n type GetDeviceMetadataDAOutput,\n type GetDeviceMetadataDAState,\n} from \"@api/device-action/os/GetDeviceMetadata/types\";\nexport {\n type GetDeviceStatusDAError,\n type GetDeviceStatusDAInput,\n type GetDeviceStatusDAIntermediateValue,\n type GetDeviceStatusDAOutput,\n type GetDeviceStatusDAState,\n} from \"@api/device-action/os/GetDeviceStatus/types\";\nexport {\n type GoToDashboardDAError,\n type GoToDashboardDAInput,\n type GoToDashboardDAIntermediateValue,\n type GoToDashboardDAOutput,\n type GoToDashboardDAState,\n} from \"@api/device-action/os/GoToDashboard/types\";\nexport {\n type ApplicationConstraint,\n type ApplicationDependency,\n type ApplicationVersionConstraint,\n type InstallOrUpdateAppsDAError,\n type InstallOrUpdateAppsDAInput,\n type InstallOrUpdateAppsDAIntermediateValue,\n type InstallOrUpdateAppsDAOutput,\n type InstallOrUpdateAppsDAState,\n type InstallPlan,\n} from \"@api/device-action/os/InstallOrUpdateApps/types\";\nexport {\n type ListAppsDAError,\n type ListAppsDAInput,\n type ListAppsDAIntermediateValue,\n type ListAppsDAOutput,\n type ListAppsDAState,\n} from \"@api/device-action/os/ListApps/types\";\nexport {\n type ListAppsWithMetadataDAError,\n type ListAppsWithMetadataDAInput,\n type ListAppsWithMetadataDAIntermediateValue,\n type ListAppsWithMetadataDAOutput,\n type ListAppsWithMetadataDAState,\n} from \"@api/device-action/os/ListAppsWithMetadata/types\";\nexport {\n type OpenAppDAError,\n type OpenAppDAInput,\n type OpenAppDAIntermediateValue,\n type OpenAppDAOutput,\n type OpenAppDARequiredInteraction,\n type OpenAppDAState,\n} from \"@api/device-action/os/OpenAppDeviceAction/types\";\nexport {\n type OpenAppWithDependenciesDAError,\n type OpenAppWithDependenciesDAInput,\n type OpenAppWithDependenciesDAIntermediateValue,\n type OpenAppWithDependenciesDAOutput,\n type OpenAppWithDependenciesDARequiredInteraction,\n type OpenAppWithDependenciesDAState,\n} from \"@api/device-action/os/OpenAppWithDependencies/types\";\nexport {\n type SendCommandInAppDAError,\n type SendCommandInAppDAInput,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n} from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes\";\nexport type { ExecuteDeviceActionUseCaseArgs } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nexport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nexport { type DeviceModelDataSource } from \"@api/device-model/data/DeviceModelDataSource\";\nexport type {\n Catalog,\n CustomImage,\n DeviceSessionState,\n FirmwareUpdate,\n FirmwareUpdateContext,\n FirmwareVersion,\n InstalledLanguagePackage,\n RunningApp,\n} from \"@api/device-session/DeviceSessionState\";\nexport { type ApduReceiverService } from \"@api/device-session/service/ApduReceiverService\";\nexport { type ApduReceiverServiceFactory } from \"@api/device-session/service/ApduReceiverService\";\nexport { type ApduSenderServiceFactory } from \"@api/device-session/service/ApduSenderService\";\nexport { type ApduSenderService } from \"@api/device-session/service/ApduSenderService\";\nexport type { DeviceSessionId } from \"@api/device-session/types\";\nexport type { DmkConfig } from \"@api/DmkConfig\";\nexport type { DmkError } from \"@api/Error\";\nexport type { LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nexport type {\n LoggerSubscriberService,\n LogParams,\n} from \"@api/logger-subscriber/service/LoggerSubscriberService\";\nexport type {\n DmkErrorResult,\n DmkResult,\n DmkSuccessResult,\n} from \"@api/model/DmkResult\";\nexport {\n type GenuineCheckDAError,\n type GenuineCheckDAInput,\n type GenuineCheckDAIntermediateValue,\n type GenuineCheckDAOutput,\n type GenuineCheckDARequiredInteraction,\n type GenuineCheckDAState,\n} from \"@api/secure-channel/device-action/GenuineCheck/types\";\nexport {\n type InstallAppDAError,\n type InstallAppDAInput,\n type InstallAppDAIntermediateValue,\n type InstallAppDAOutput,\n type InstallAppDARequiredInteraction,\n type InstallAppDAState,\n} from \"@api/secure-channel/device-action/InstallApp/types\";\nexport {\n type ListInstalledAppsDAError,\n type ListInstalledAppsDAInput,\n type ListInstalledAppsDAIntermediateValue,\n type ListInstalledAppsDAOutput,\n type ListInstalledAppsDARequiredInteraction,\n type ListInstalledAppsDAState,\n} from \"@api/secure-channel/device-action/ListInstalledApps/types\";\nexport {\n type UninstallAppDAError,\n type UninstallAppDAInput,\n type UninstallAppDAIntermediateValue,\n type UninstallAppDAOutput,\n type UninstallAppDARequiredInteraction,\n type UninstallAppDAState,\n} from \"@api/secure-channel/device-action/UninstallApp/types\";\nexport { type DeviceApduSender } from \"@api/transport/model/DeviceApduSender\";\nexport {\n type DeviceConnection,\n type DisconnectHandler,\n type SendApduFnType,\n type SendApduResult,\n} from \"@api/transport/model/DeviceConnection\";\nexport { type TransportDiscoveredDevice } from \"@api/transport/model/TransportDiscoveredDevice\";\nexport type { HexaString } from \"@api/utils/HexaString\";\nexport type { ConnectUseCaseArgs } from \"@internal/discovery/use-case/ConnectUseCase\";\nexport type { DisconnectUseCaseArgs } from \"@internal/discovery/use-case/DisconnectUseCase\";\nexport type { GetConnectedDeviceUseCaseArgs } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nexport type { StartDiscoveringUseCaseArgs } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nexport type { SendApduUseCaseArgs } from \"@internal/send/use-case/SendApduUseCase\";\n"],
|
|
5
5
|
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
6
|
"names": ["types_exports", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var a=(i,e)=>{for(var o in e)p(i,o,{get:e[o],enumerable:!0})},h=(i,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of n(e))!c.call(i,t)&&t!==o&&p(i,t,{get:()=>e[t],enumerable:!(s=l(e,t))||s.enumerable});return i};var v=i=>h(p({},"__esModule",{value:!0}),i);var d={};a(d,{ApplicationChecker:()=>m});module.exports=v(d);var r=require("semver");class m{isCompatible;version;modelId;constructor(e,o,s){this.modelId=e.deviceModelId;const t=s.resolve(e,o);this.isCompatible=t.isCompatible,this.version=t.version}withMinVersionInclusive(e){return(0,r.gte)(this.version,e)||(this.isCompatible=!1),this}withMinVersionExclusive(e){return(0,r.gt)(this.version,e)||(this.isCompatible=!1),this}excludeDeviceModel(e){return this.modelId===e&&(this.isCompatible=!1),this}check(){return this.isCompatible}}0&&(module.exports={ApplicationChecker});
|
|
2
|
+
//# sourceMappingURL=ApplicationChecker.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/api/utils/ApplicationChecker.ts"],
|
|
4
|
+
"sourcesContent": ["import { gt, gte } from \"semver\";\n\nimport { type DeviceModelId } from \"@api/device/DeviceModel\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\n\nimport {\n type AppConfig,\n type ApplicationResolver,\n} from \"./ApplicationResolver\";\n\nexport class ApplicationChecker {\n private isCompatible: boolean;\n private version: string;\n private modelId: DeviceModelId;\n\n constructor(\n deviceState: DeviceSessionState,\n appConfig: AppConfig,\n resolver: ApplicationResolver,\n ) {\n this.modelId = deviceState.deviceModelId;\n const resolved = resolver.resolve(deviceState, appConfig);\n this.isCompatible = resolved.isCompatible;\n this.version = resolved.version;\n }\n\n withMinVersionInclusive(version: string): ApplicationChecker {\n if (!gte(this.version, version)) this.isCompatible = false;\n return this;\n }\n\n withMinVersionExclusive(version: string): ApplicationChecker {\n if (!gt(this.version, version)) this.isCompatible = false;\n return this;\n }\n\n excludeDeviceModel(modelId: DeviceModelId): ApplicationChecker {\n if (this.modelId === modelId) this.isCompatible = false;\n return this;\n }\n\n check(): boolean {\n return this.isCompatible;\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAwB,kBAUjB,MAAMF,CAAmB,CACtB,aACA,QACA,QAER,YACEG,EACAC,EACAC,EACA,CACA,KAAK,QAAUF,EAAY,cAC3B,MAAMG,EAAWD,EAAS,QAAQF,EAAaC,CAAS,EACxD,KAAK,aAAeE,EAAS,aAC7B,KAAK,QAAUA,EAAS,OAC1B,CAEA,wBAAwBC,EAAqC,CAC3D,SAAK,OAAI,KAAK,QAASA,CAAO,IAAG,KAAK,aAAe,IAC9C,IACT,CAEA,wBAAwBA,EAAqC,CAC3D,SAAK,MAAG,KAAK,QAASA,CAAO,IAAG,KAAK,aAAe,IAC7C,IACT,CAEA,mBAAmBC,EAA4C,CAC7D,OAAI,KAAK,UAAYA,IAAS,KAAK,aAAe,IAC3C,IACT,CAEA,OAAiB,CACf,OAAO,KAAK,YACd,CACF",
|
|
6
|
+
"names": ["ApplicationChecker_exports", "__export", "ApplicationChecker", "__toCommonJS", "import_semver", "deviceState", "appConfig", "resolver", "resolved", "version", "modelId"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var r=require("../device/DeviceModel"),n=require("../device/DeviceStatus"),l=require("../device-session/DeviceSessionState"),i=require("./ApplicationChecker");describe("ApplicationChecker",()=>{function s(e=r.DeviceModelId.FLEX){return{sessionStateType:l.DeviceSessionStateType.ReadyWithoutSecureChannel,deviceStatus:n.DeviceStatus.CONNECTED,installedApps:[],currentApp:{name:"TestApp",version:"1.0.0"},deviceModelId:e,isSecureConnectionAllowed:!1}}function o(e){return{resolve:()=>e}}const c={version:"1.0.0"};it("should pass check when resolved as compatible",()=>{const e=o({isCompatible:!0,version:"1.12.0"}),t=new i.ApplicationChecker(s(),c,e).check();expect(t).toStrictEqual(!0)}),it("should reject check when resolved as incompatible",()=>{const e=o({isCompatible:!1,version:"0.0.1"}),t=new i.ApplicationChecker(s(),c,e).check();expect(t).toStrictEqual(!1)}),it("should pass with min version inclusive when version matches",()=>{const e=o({isCompatible:!0,version:"1.12.0"}),t=new i.ApplicationChecker(s(),c,e).withMinVersionInclusive("1.12.0").check();expect(t).toStrictEqual(!0)}),it("should reject with min version inclusive when version is too low",()=>{const e=o({isCompatible:!0,version:"1.11.0"}),t=new i.ApplicationChecker(s(),c,e).withMinVersionInclusive("1.12.0").check();expect(t).toStrictEqual(!1)}),it("should pass with min version exclusive when version is greater",()=>{const e=o({isCompatible:!0,version:"1.13.0"}),t=new i.ApplicationChecker(s(),c,e).withMinVersionExclusive("1.12.0").check();expect(t).toStrictEqual(!0)}),it("should reject with min version exclusive when version is equal",()=>{const e=o({isCompatible:!0,version:"1.12.0"}),t=new i.ApplicationChecker(s(),c,e).withMinVersionExclusive("1.12.0").check();expect(t).toStrictEqual(!1)}),it("should pass when device model is not excluded",()=>{const e=o({isCompatible:!0,version:"1.12.0"}),t=new i.ApplicationChecker(s(r.DeviceModelId.FLEX),c,e).excludeDeviceModel(r.DeviceModelId.NANO_S).check();expect(t).toStrictEqual(!0)}),it("should reject when device model is excluded",()=>{const e=o({isCompatible:!0,version:"1.12.0"}),t=new i.ApplicationChecker(s(r.DeviceModelId.FLEX),c,e).excludeDeviceModel(r.DeviceModelId.FLEX).check();expect(t).toStrictEqual(!1)}),it("should pass with chained conditions when all are met",()=>{const e=o({isCompatible:!0,version:"1.12.0"}),t=new i.ApplicationChecker(s(),c,e).withMinVersionInclusive("1.11.0").excludeDeviceModel(r.DeviceModelId.NANO_S).check();expect(t).toStrictEqual(!0)}),it("should reject with chained conditions when one fails",()=>{const e=o({isCompatible:!0,version:"1.10.0"}),t=new i.ApplicationChecker(s(),c,e).withMinVersionInclusive("1.11.0").excludeDeviceModel(r.DeviceModelId.NANO_S).check();expect(t).toStrictEqual(!1)}),it("should not override incompatible resolution even if constraints pass",()=>{const e=o({isCompatible:!1,version:"1.15.0"}),t=new i.ApplicationChecker(s(),c,e).withMinVersionInclusive("1.12.0").check();expect(t).toStrictEqual(!1)})});
|
|
2
|
+
//# sourceMappingURL=ApplicationChecker.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/api/utils/ApplicationChecker.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\n\nimport { ApplicationChecker } from \"./ApplicationChecker\";\nimport {\n type ApplicationResolver,\n type ResolvedApp,\n} from \"./ApplicationResolver\";\n\ndescribe(\"ApplicationChecker\", () => {\n function createReadyState(modelId: DeviceModelId = DeviceModelId.FLEX) {\n return {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n currentApp: { name: \"TestApp\", version: \"1.0.0\" },\n deviceModelId: modelId,\n isSecureConnectionAllowed: false,\n };\n }\n\n function createMockResolver(resolved: ResolvedApp): ApplicationResolver {\n return {\n resolve: () => resolved,\n };\n }\n\n const appConfig = { version: \"1.0.0\" };\n\n it(\"should pass check when resolved as compatible\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.12.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n ).check();\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject check when resolved as incompatible\", () => {\n const resolver = createMockResolver({\n isCompatible: false,\n version: \"0.0.1\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n ).check();\n expect(result).toStrictEqual(false);\n });\n\n it(\"should pass with min version inclusive when version matches\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.12.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusive(\"1.12.0\")\n .check();\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject with min version inclusive when version is too low\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.11.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusive(\"1.12.0\")\n .check();\n expect(result).toStrictEqual(false);\n });\n\n it(\"should pass with min version exclusive when version is greater\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.13.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionExclusive(\"1.12.0\")\n .check();\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject with min version exclusive when version is equal\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.12.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionExclusive(\"1.12.0\")\n .check();\n expect(result).toStrictEqual(false);\n });\n\n it(\"should pass when device model is not excluded\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.12.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(DeviceModelId.FLEX),\n appConfig,\n resolver,\n )\n .excludeDeviceModel(DeviceModelId.NANO_S)\n .check();\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject when device model is excluded\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.12.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(DeviceModelId.FLEX),\n appConfig,\n resolver,\n )\n .excludeDeviceModel(DeviceModelId.FLEX)\n .check();\n expect(result).toStrictEqual(false);\n });\n\n it(\"should pass with chained conditions when all are met\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.12.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusive(\"1.11.0\")\n .excludeDeviceModel(DeviceModelId.NANO_S)\n .check();\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject with chained conditions when one fails\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.10.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusive(\"1.11.0\")\n .excludeDeviceModel(DeviceModelId.NANO_S)\n .check();\n expect(result).toStrictEqual(false);\n });\n\n it(\"should not override incompatible resolution even if constraints pass\", () => {\n const resolver = createMockResolver({\n isCompatible: false,\n version: \"1.15.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusive(\"1.12.0\")\n .check();\n expect(result).toStrictEqual(false);\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAA8B,mCAC9BC,EAA6B,oCAC7BC,EAAuC,kDAEvCC,EAAmC,gCAMnC,SAAS,qBAAsB,IAAM,CACnC,SAASC,EAAiBC,EAAyB,gBAAc,KAAM,CACrE,MAAO,CACL,iBAAkB,yBAAuB,0BACzC,aAAc,eAAa,UAC3B,cAAe,CAAC,EAChB,WAAY,CAAE,KAAM,UAAW,QAAS,OAAQ,EAChD,cAAeA,EACf,0BAA2B,EAC7B,CACF,CAEA,SAASC,EAAmBC,EAA4C,CACtE,MAAO,CACL,QAAS,IAAMA,CACjB,CACF,CAEA,MAAMC,EAAY,CAAE,QAAS,OAAQ,EAErC,GAAG,gDAAiD,IAAM,CACxD,MAAMC,EAAWH,EAAmB,CAClC,aAAc,GACd,QAAS,QACX,CAAC,EACKI,EAAS,IAAI,qBACjBN,EAAiB,EACjBI,EACAC,CACF,EAAE,MAAM,EACR,OAAOC,CAAM,EAAE,cAAc,EAAI,CACnC,CAAC,EAED,GAAG,oDAAqD,IAAM,CAC5D,MAAMD,EAAWH,EAAmB,CAClC,aAAc,GACd,QAAS,OACX,CAAC,EACKI,EAAS,IAAI,qBACjBN,EAAiB,EACjBI,EACAC,CACF,EAAE,MAAM,EACR,OAAOC,CAAM,EAAE,cAAc,EAAK,CACpC,CAAC,EAED,GAAG,8DAA+D,IAAM,CACtE,MAAMD,EAAWH,EAAmB,CAClC,aAAc,GACd,QAAS,QACX,CAAC,EACKI,EAAS,IAAI,qBACjBN,EAAiB,EACjBI,EACAC,CACF,EACG,wBAAwB,QAAQ,EAChC,MAAM,EACT,OAAOC,CAAM,EAAE,cAAc,EAAI,CACnC,CAAC,EAED,GAAG,mEAAoE,IAAM,CAC3E,MAAMD,EAAWH,EAAmB,CAClC,aAAc,GACd,QAAS,QACX,CAAC,EACKI,EAAS,IAAI,qBACjBN,EAAiB,EACjBI,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Ac,EAAI,CACnC,CAAC,EAED,GAAG,uDAAwD,IAAM,CAC/D,MAAMD,EAAWH,EAAmB,CAClC,aAAc,GACd,QAAS,QACX,CAAC,EACKI,EAAS,IAAI,qBACjBN,EAAiB,EACjBI,EACAC,CACF,EACG,wBAAwB,QAAQ,EAChC,mBAAmB,gBAAc,MAAM,EACvC,MAAM,EACT,OAAOC,CAAM,EAAE,cAAc,EAAK,CACpC,CAAC,EAED,GAAG,uEAAwE,IAAM,CAC/E,MAAMD,EAAWH,EAAmB,CAClC,aAAc,GACd,QAAS,QACX,CAAC,EACKI,EAAS,IAAI,qBACjBN,EAAiB,EACjBI,EACAC,CACF,EACG,wBAAwB,QAAQ,EAChC,MAAM,EACT,OAAOC,CAAM,EAAE,cAAc,EAAK,CACpC,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_DeviceModel", "import_DeviceStatus", "import_DeviceSessionState", "import_ApplicationChecker", "createReadyState", "modelId", "createMockResolver", "resolved", "appConfig", "resolver", "result"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var n=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var l=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of s(e))!a.call(o,p)&&p!==t&&n(o,p,{get:()=>e[p],enumerable:!(i=r(e,p))||i.enumerable});return o};var v=o=>l(n({},"__esModule",{value:!0}),o);var d={};module.exports=v(d);
|
|
2
|
+
//# sourceMappingURL=ApplicationResolver.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/api/utils/ApplicationResolver.ts"],
|
|
4
|
+
"sourcesContent": ["import { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\n\nexport type AppConfig = Record<string, unknown> & {\n readonly version: string;\n};\n\nexport type ResolvedApp = {\n readonly isCompatible: boolean;\n readonly version: string;\n};\n\nexport interface ApplicationResolver {\n resolve(deviceState: DeviceSessionState, appConfig: AppConfig): ResolvedApp;\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["ApplicationResolver_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var b=(r,n)=>{for(var t in n)i(r,t,{get:n[t],enumerable:!0})},c=(r,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of s(n))!g.call(r,o)&&o!==t&&i(r,o,{get:()=>n[o],enumerable:!(e=u(n,o))||e.enumerable});return r};var l=r=>c(i({},"__esModule",{value:!0}),r);var y={};b(y,{base64StringToBuffer:()=>d,bufferToBase64String:()=>h,isBase64String:()=>a});module.exports=l(y);function a(r){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r)}function d(r){if(r.length===0)return new Uint8Array;if(!a(r))return null;try{const n=atob(r),t=new Uint8Array(n.length);for(let e=0;e<n.length;e++)t[e]=n.charCodeAt(e);return t}catch{return Uint8Array.from(Buffer.from(r,"base64"))}}function h(r){const n=globalThis;if(typeof n.btoa=="function"){let e="";for(let o=0;o<r.length;o++){const f=r[o];if(f===void 0)throw new Error("Unexpected undefined byte in array.");e+=String.fromCharCode(f)}return n.btoa(e)}const t=n.Buffer;if(typeof t<"u")return t.from(r).toString("base64");throw new Error("No Base64 encoder available in this environment.")}0&&(module.exports={base64StringToBuffer,bufferToBase64String,isBase64String});
|
|
2
2
|
//# sourceMappingURL=Base64String.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/api/utils/Base64String.ts"],
|
|
4
|
-
"sourcesContent": ["export function isBase64String(value: string): boolean {\n // Valid base64 characters are [A-Za-z0-9+/]\n // They are always grouped by 4 characters.\n // Optional padding at the end with one or two '='.\n // see section 4 of: https://www.rfc-editor.org/rfc/rfc4648.txt\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(\n value,\n );\n}\n\nexport function base64StringToBuffer(value: string): Uint8Array | null {\n if (value.length === 0) {\n return new Uint8Array();\n }\n if (!isBase64String(value)) {\n return null;\n }\n try {\n // Use the browser implementation of atob\n const base64Decoded = atob(value);\n const buffer = new Uint8Array(base64Decoded.length);\n for (let i = 0; i < base64Decoded.length; i++) {\n buffer[i] = base64Decoded.charCodeAt(i);\n }\n return buffer;\n } catch (_error: unknown) {\n // Use the implementation of Buffer for environments such as node\n return Uint8Array.from(Buffer.from(value, \"base64\"));\n }\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,mBAAAC,IAAA,eAAAC,
|
|
6
|
-
"names": ["Base64String_exports", "__export", "base64StringToBuffer", "isBase64String", "__toCommonJS", "value", "base64Decoded", "buffer", "i"]
|
|
4
|
+
"sourcesContent": ["export function isBase64String(value: string): boolean {\n // Valid base64 characters are [A-Za-z0-9+/]\n // They are always grouped by 4 characters.\n // Optional padding at the end with one or two '='.\n // see section 4 of: https://www.rfc-editor.org/rfc/rfc4648.txt\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(\n value,\n );\n}\n\nexport function base64StringToBuffer(value: string): Uint8Array | null {\n if (value.length === 0) {\n return new Uint8Array();\n }\n if (!isBase64String(value)) {\n return null;\n }\n try {\n // Use the browser implementation of atob\n const base64Decoded = atob(value);\n const buffer = new Uint8Array(base64Decoded.length);\n for (let i = 0; i < base64Decoded.length; i++) {\n buffer[i] = base64Decoded.charCodeAt(i);\n }\n return buffer;\n } catch (_error: unknown) {\n // Use the implementation of Buffer for environments such as node\n return Uint8Array.from(Buffer.from(value, \"base64\"));\n }\n}\n\nexport function bufferToBase64String(bytes: Uint8Array): string {\n const g = globalThis as typeof globalThis & {\n Buffer?: typeof Buffer;\n btoa?: (data: string) => string;\n };\n\n if (typeof g.btoa === \"function\") {\n // convert bytes to a binary string for btoa\n let binary = \"\";\n for (let i = 0; i < bytes.length; i++) {\n const byte = bytes[i];\n if (byte === undefined) {\n throw new Error(\"Unexpected undefined byte in array.\");\n }\n binary += String.fromCharCode(byte);\n }\n return g.btoa(binary);\n }\n\n const Buf = g.Buffer;\n if (typeof Buf !== \"undefined\") {\n return Buf.from(bytes).toString(\"base64\");\n }\n\n throw new Error(\"No Base64 encoder available in this environment.\");\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,yBAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAL,GAAO,SAASI,EAAeE,EAAwB,CAKrD,MAAO,mEAAmE,KACxEA,CACF,CACF,CAEO,SAASJ,EAAqBI,EAAkC,CACrE,GAAIA,EAAM,SAAW,EACnB,OAAO,IAAI,WAEb,GAAI,CAACF,EAAeE,CAAK,EACvB,OAAO,KAET,GAAI,CAEF,MAAMC,EAAgB,KAAKD,CAAK,EAC1BE,EAAS,IAAI,WAAWD,EAAc,MAAM,EAClD,QAASE,EAAI,EAAGA,EAAIF,EAAc,OAAQE,IACxCD,EAAOC,CAAC,EAAIF,EAAc,WAAWE,CAAC,EAExC,OAAOD,CACT,MAA0B,CAExB,OAAO,WAAW,KAAK,OAAO,KAAKF,EAAO,QAAQ,CAAC,CACrD,CACF,CAEO,SAASH,EAAqBO,EAA2B,CAC9D,MAAMC,EAAI,WAKV,GAAI,OAAOA,EAAE,MAAS,WAAY,CAEhC,IAAIC,EAAS,GACb,QAASH,EAAI,EAAGA,EAAIC,EAAM,OAAQD,IAAK,CACrC,MAAMI,EAAOH,EAAMD,CAAC,EACpB,GAAII,IAAS,OACX,MAAM,IAAI,MAAM,qCAAqC,EAEvDD,GAAU,OAAO,aAAaC,CAAI,CACpC,CACA,OAAOF,EAAE,KAAKC,CAAM,CACtB,CAEA,MAAME,EAAMH,EAAE,OACd,GAAI,OAAOG,EAAQ,IACjB,OAAOA,EAAI,KAAKJ,CAAK,EAAE,SAAS,QAAQ,EAG1C,MAAM,IAAI,MAAM,kDAAkD,CACpE",
|
|
6
|
+
"names": ["Base64String_exports", "__export", "base64StringToBuffer", "bufferToBase64String", "isBase64String", "__toCommonJS", "value", "base64Decoded", "buffer", "i", "bytes", "g", "binary", "byte", "Buf"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var t=require("./Base64String");describe("Base64String",()=>{describe("isBase64String function",()=>{it("should return true if the value is a valid base64 string",()=>{const e=(0,t.isBase64String)("Zmlyc3QgdG/zdGluZyBz+HI9");expect(e).toBeTruthy()}),it("should return true if the value is a valid base64 string, one padding",()=>{const e=(0,t.isBase64String)("Zmlyc3QgdGVzdGluZyBzdHI=");expect(e).toBeTruthy()}),it("should return true if the value is a valid base64 string, two paddings",()=>{const e=(0,t.isBase64String)("Zmlyc3QgdGVzdGluZyBzdH==");expect(e).toBeTruthy()}),it("should return true for an empty string",()=>{const e=(0,t.isBase64String)("");expect(e).toBeTruthy()}),it("should return false for an invalid base64 string",()=>{const e=(0,t.isBase64String)("invalid base64 string");expect(e).toBeFalsy()}),it("should return false with 3 paddings",()=>{const e=(0,t.isBase64String)("Zmlyc3QgdGVzdGluZyBzd===");expect(e).toBeFalsy()}),it("should return false on incomplete string (not multiple of 4)",()=>{const e=(0,t.isBase64String)("Zmlyc3QgdGVzdGluZyBzdHI");expect(e).toBeFalsy()})}),describe("base64StringToBuffer function",()=>{beforeEach(()=>{vi.resetAllMocks()}),it("should convert empty input to empty buffer",()=>{const e=(0,t.base64StringToBuffer)("");expect(e).toStrictEqual(new Uint8Array)}),it("invalid base64 string converted to null",()=>{const e=(0,t.base64StringToBuffer)("invalid string");expect(e).toStrictEqual(null)}),it("should convert a base64 string to a buffer using browser's atob",()=>{const e=(0,t.base64StringToBuffer)("Zmlyc3QgdGVzdCBzdHJpbmc=");expect(e).toStrictEqual(Uint8Array.from([102,105,114,115,116,32,116,101,115,116,32,115,116,114,105,110,103]))}),it("should convert a base64 string to a buffer using Buffer",()=>{vi.spyOn(global,"atob").mockImplementation(()=>{throw new Error("atob is not defined")});const e=(0,t.base64StringToBuffer)("Zmlyc3QgdGVzdCBzdHJpbmc=");expect(e).toStrictEqual(Uint8Array.from([102,105,114,115,116,32,116,101,115,116,32,115,116,114,105,110,103]))})})});describe("bufferToBase64String",()=>{const a=globalThis.btoa,e=globalThis.Buffer;beforeEach(()=>{vi.restoreAllMocks(),globalThis.btoa=a,globalThis.Buffer=e}),afterAll(()=>{globalThis.btoa=a,globalThis.Buffer=e}),it("should encode an empty buffer to an empty base64 string when btoa is available",()=>{globalThis.btoa=vi.fn(o=>(expect(o).toBe(""),""));const s=new Uint8Array,n=(0,t.bufferToBase64String)(s);expect(n).toBe(""),expect(globalThis.btoa).toHaveBeenCalledTimes(1)}),it("should encode a buffer to base64 using btoa when available",()=>{const s="first testing str",n=Uint8Array.from(s.split("").map(r=>r.charCodeAt(0)));globalThis.btoa=vi.fn(r=>(expect(r).toBe(s),"Zmlyc3QgdGVzdGluZyBzdHI="));const o=(0,t.bufferToBase64String)(n);expect(o).toBe("Zmlyc3QgdGVzdGluZyBzdHI="),expect(globalThis.btoa).toHaveBeenCalledTimes(1)}),it("should encode a buffer to base64 using Buffer when btoa is not available",()=>{globalThis.btoa=void 0;const s="testing str",n=Buffer.from(s,"binary").toString("base64"),o=Uint8Array.from(s.split("").map(i=>i.charCodeAt(0))),r=vi.spyOn(Buffer,"from"),l=(0,t.bufferToBase64String)(o);expect(l).toBe(n),expect(r).toHaveBeenCalledTimes(1)}),it("should throw an error when no Base64 encoder is available",()=>{globalThis.btoa=void 0,globalThis.Buffer=void 0;const s=Uint8Array.from([1,2,3]);expect(()=>(0,t.bufferToBase64String)(s)).toThrowError("No Base64 encoder available in this environment.")}),it("should throw if an undefined byte is encountered (defensive check)",()=>{const s={length:3,0:102,1:void 0,2:111};globalThis.btoa=vi.fn(),expect(()=>(0,t.bufferToBase64String)(s)).toThrowError("Unexpected undefined byte in array.")})});
|
|
2
2
|
//# sourceMappingURL=Base64String.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/api/utils/Base64String.test.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["import_Base64String", "result"]
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport {\n base64StringToBuffer,\n bufferToBase64String,\n isBase64String,\n} from \"./Base64String\";\n\ndescribe(\"Base64String\", () => {\n describe(\"isBase64String function\", () => {\n it(\"should return true if the value is a valid base64 string\", () => {\n // GIVEN\n const value = \"Zmlyc3QgdG/zdGluZyBz+HI9\";\n\n // WHEN\n const result = isBase64String(value);\n\n // THEN\n expect(result).toBeTruthy();\n });\n\n it(\"should return true if the value is a valid base64 string, one padding\", () => {\n // GIVEN\n const value = \"Zmlyc3QgdGVzdGluZyBzdHI=\";\n\n // WHEN\n const result = isBase64String(value);\n\n // THEN\n expect(result).toBeTruthy();\n });\n\n it(\"should return true if the value is a valid base64 string, two paddings\", () => {\n // GIVEN\n const value = \"Zmlyc3QgdGVzdGluZyBzdH==\";\n\n // WHEN\n const result = isBase64String(value);\n\n // THEN\n expect(result).toBeTruthy();\n });\n\n it(\"should return true for an empty string\", () => {\n // GIVEN\n const value = \"\";\n\n // WHEN\n const result = isBase64String(value);\n\n // THEN\n expect(result).toBeTruthy();\n });\n\n it(\"should return false for an invalid base64 string\", () => {\n // GIVEN\n const value = \"invalid base64 string\";\n\n // WHEN\n const result = isBase64String(value);\n\n // THEN\n expect(result).toBeFalsy();\n });\n\n it(\"should return false with 3 paddings\", () => {\n // GIVEN\n const value = \"Zmlyc3QgdGVzdGluZyBzd===\";\n\n // WHEN\n const result = isBase64String(value);\n\n // THEN\n expect(result).toBeFalsy();\n });\n\n it(\"should return false on incomplete string (not multiple of 4)\", () => {\n // GIVEN\n const value = \"Zmlyc3QgdGVzdGluZyBzdHI\";\n\n // WHEN\n const result = isBase64String(value);\n\n // THEN\n expect(result).toBeFalsy();\n });\n });\n\n describe(\"base64StringToBuffer function\", () => {\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should convert empty input to empty buffer\", () => {\n // GIVEN\n const value = \"\";\n\n // WHEN\n const result = base64StringToBuffer(value);\n\n // THEN\n expect(result).toStrictEqual(new Uint8Array());\n });\n\n it(\"invalid base64 string converted to null\", () => {\n // GIVEN\n const value = \"invalid string\";\n\n // WHEN\n const result = base64StringToBuffer(value);\n\n // THEN\n expect(result).toStrictEqual(null);\n });\n\n it(\"should convert a base64 string to a buffer using browser's atob\", () => {\n // GIVEN\n const value = \"Zmlyc3QgdGVzdCBzdHJpbmc=\";\n\n // WHEN\n const result = base64StringToBuffer(value);\n\n // THEN\n expect(result).toStrictEqual(\n Uint8Array.from([\n 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20,\n 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,\n ]),\n );\n });\n\n it(\"should convert a base64 string to a buffer using Buffer\", () => {\n // GIVEN\n vi.spyOn(global, \"atob\").mockImplementation(() => {\n throw new Error(\"atob is not defined\");\n });\n const value = \"Zmlyc3QgdGVzdCBzdHJpbmc=\";\n\n // WHEN\n const result = base64StringToBuffer(value);\n\n // THEN\n expect(result).toStrictEqual(\n Uint8Array.from([\n 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20,\n 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,\n ]),\n );\n });\n });\n});\n\ndescribe(\"bufferToBase64String\", () => {\n const originalBtoa = (globalThis as any).btoa;\n const originalBuffer = (globalThis as any).Buffer;\n\n beforeEach(() => {\n vi.restoreAllMocks();\n (globalThis as any).btoa = originalBtoa;\n (globalThis as any).Buffer = originalBuffer;\n });\n\n afterAll(() => {\n (globalThis as any).btoa = originalBtoa;\n (globalThis as any).Buffer = originalBuffer;\n });\n\n it(\"should encode an empty buffer to an empty base64 string when btoa is available\", () => {\n // GIVEN\n (globalThis as any).btoa = vi.fn((input: string) => {\n expect(input).toBe(\"\");\n return \"\";\n });\n\n const bytes = new Uint8Array();\n\n // WHEN\n const result = bufferToBase64String(bytes);\n\n // THEN\n expect(result).toBe(\"\");\n expect(globalThis.btoa).toHaveBeenCalledTimes(1);\n });\n\n it(\"should encode a buffer to base64 using btoa when available\", () => {\n // GIVEN\n const text = \"first testing str\";\n const bytes = Uint8Array.from(text.split(\"\").map((c) => c.charCodeAt(0)));\n\n (globalThis as any).btoa = vi.fn((input: string) => {\n expect(input).toBe(text);\n return \"Zmlyc3QgdGVzdGluZyBzdHI=\";\n });\n\n // WHEN\n const result = bufferToBase64String(bytes);\n\n // THEN\n expect(result).toBe(\"Zmlyc3QgdGVzdGluZyBzdHI=\");\n expect(globalThis.btoa).toHaveBeenCalledTimes(1);\n });\n\n it(\"should encode a buffer to base64 using Buffer when btoa is not available\", () => {\n // GIVEN\n (globalThis as any).btoa = undefined;\n\n const text = \"testing str\";\n const expectedBase64 = Buffer.from(text, \"binary\").toString(\"base64\");\n const bytes = Uint8Array.from(text.split(\"\").map((c) => c.charCodeAt(0)));\n\n const bufferFromSpy = vi.spyOn(Buffer, \"from\");\n\n // WHEN\n const result = bufferToBase64String(bytes);\n\n // THEN\n expect(result).toBe(expectedBase64);\n expect(bufferFromSpy).toHaveBeenCalledTimes(1);\n });\n\n it(\"should throw an error when no Base64 encoder is available\", () => {\n // GIVEN\n (globalThis as any).btoa = undefined;\n (globalThis as any).Buffer = undefined;\n\n const bytes = Uint8Array.from([0x01, 0x02, 0x03]);\n\n // WHEN / THEN\n expect(() => bufferToBase64String(bytes)).toThrowError(\n \"No Base64 encoder available in this environment.\",\n );\n });\n\n it(\"should throw if an undefined byte is encountered (defensive check)\", () => {\n // GIVEN\n const bytes = {\n length: 3,\n 0: 0x66,\n 1: undefined,\n 2: 0x6f,\n } as unknown as Uint8Array;\n\n (globalThis as any).btoa = vi.fn();\n\n // WHEN / THEN\n expect(() => bufferToBase64String(bytes)).toThrowError(\n \"Unexpected undefined byte in array.\",\n );\n });\n});\n"],
|
|
5
|
+
"mappings": "aAIA,IAAAA,EAIO,0BAEP,SAAS,eAAgB,IAAM,CAC7B,SAAS,0BAA2B,IAAM,CACxC,GAAG,2DAA4D,IAAM,CAKnE,MAAMC,KAAS,kBAHD,0BAGqB,EAGnC,OAAOA,CAAM,EAAE,WAAW,CAC5B,CAAC,EAED,GAAG,wEAAyE,IAAM,CAKhF,MAAMA,KAAS,kBAHD,0BAGqB,EAGnC,OAAOA,CAAM,EAAE,WAAW,CAC5B,CAAC,EAED,GAAG,yEAA0E,IAAM,CAKjF,MAAMA,KAAS,kBAHD,0BAGqB,EAGnC,OAAOA,CAAM,EAAE,WAAW,CAC5B,CAAC,EAED,GAAG,yCAA0C,IAAM,CAKjD,MAAMA,KAAS,kBAHD,EAGqB,EAGnC,OAAOA,CAAM,EAAE,WAAW,CAC5B,CAAC,EAED,GAAG,mDAAoD,IAAM,CAK3D,MAAMA,KAAS,kBAHD,uBAGqB,EAGnC,OAAOA,CAAM,EAAE,UAAU,CAC3B,CAAC,EAED,GAAG,sCAAuC,IAAM,CAK9C,MAAMA,KAAS,kBAHD,0BAGqB,EAGnC,OAAOA,CAAM,EAAE,UAAU,CAC3B,CAAC,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IAAM,CAE7E,MAAMA,EAAQ,CACZ,OAAQ,EACR,EAAG,IACH,EAAG,OACH,EAAG,GACL,EAEC,WAAmB,KAAO,GAAG,GAAG,EAGjC,OAAO,OAAM,wBAAqBA,CAAK,CAAC,EAAE,aACxC,qCACF,CACF,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_Base64String", "result", "originalBtoa", "originalBuffer", "input", "bytes", "text", "c", "expectedBase64", "bufferFromSpy"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var s=require("purify-ts"),f=require("rxjs"),u=require("../../../api/transport/model/TransportConnectedDevice.stub"),r=require("../../device-session/data/DeviceSessionRefresherConst"),a=require("../../device-session/model/DeviceSession.stub"),p=require("../../device-session/model/Errors"),h=require("../../logger-publisher/service/DefaultLoggerPublisherService"),b=require("../../manager-api/data/
|
|
1
|
+
"use strict";var s=require("purify-ts"),f=require("rxjs"),u=require("../../../api/transport/model/TransportConnectedDevice.stub"),r=require("../../device-session/data/DeviceSessionRefresherConst"),a=require("../../device-session/model/DeviceSession.stub"),p=require("../../device-session/model/Errors"),h=require("../../logger-publisher/service/DefaultLoggerPublisherService"),b=require("../../manager-api/data/HttpManagerApiDataSource"),x=require("../../manager-api/service/DefaultManagerApiService"),E=require("../../secure-channel/data/DefaultSecureChannelDataSource"),y=require("../../secure-channel/service/DefaultSecureChannelService"),I=require("./DefaultDeviceSessionService");vi.mock("@internal/logger-publisher/service/DefaultLoggerPublisherService");vi.mock("@internal/manager-api/data/HttpManagerApiDataSource");let e,o,i,d,S,m,c,g,n;describe("DefaultDeviceSessionService",()=>{o=new h.DefaultLoggerPublisherService([],"deviceSession"),m=new b.HttpManagerApiDataSource({}),c=new x.DefaultManagerApiService(m),g=new E.DefaultSecureChannelDataSource({}),n=new y.DefaultSecureChannelService(g),beforeEach(()=>{vi.restoreAllMocks(),e=new I.DefaultDeviceSessionService(()=>o),i=(0,a.deviceSessionStubBuilder)({},()=>o,c,n,r.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS)}),afterEach(()=>{i.close()}),it("should have an empty DeviceSession list",()=>{expect(e.getDeviceSessions()).toEqual([])}),describe("DeviceSessionService addDeviceSession",()=>{it("should add a DeviceSession if it does not already exist",()=>{e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])}),it("should not add a DeviceSession if it already exists",()=>{e.addDeviceSession(i),e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])})}),describe("DeviceSessionService removeDeviceSession",()=>{it("should remove the DeviceSession of given ID",()=>{e.addDeviceSession(i),e.removeDeviceSession(i.id),expect(e.getDeviceSessions()).toEqual([])}),it("should not remove the DeviceSession of given ID if it does not exist",()=>{e.addDeviceSession(i),e.removeDeviceSession("non-existent-id"),expect(e.getDeviceSessions()).toEqual([i])})}),describe("DeviceSessionService getDeviceSessionById",()=>{it("should get the DeviceSession of given ID if it exists",()=>{e.addDeviceSession(i),expect(e.getDeviceSessionById(i.id)).toEqual(s.Either.of(i))}),it("should not get the DeviceSession if it does not exist",()=>{e.addDeviceSession(i),expect(e.getDeviceSessionById("non-existent-id")).toEqual((0,s.Left)(new p.DeviceSessionNotFound))})}),describe("DeviceSessionService getDeviceSessionsByDeviceId",()=>{it("should not get device sessions by deviceId if none exist",()=>{e.addDeviceSession(i),expect(e.getDeviceSessionsByDeviceId("non-existent-device-id")).toEqual((0,s.Left)(new p.DeviceSessionNotFound))}),it("should get a single device session by deviceId",()=>{e.addDeviceSession(i),expect(e.getDeviceSessionsByDeviceId(i.connectedDevice.id)).toEqual(s.Either.of([i]))}),it("should get device sessions by deviceId",()=>{e.addDeviceSession(i),d=(0,a.deviceSessionStubBuilder)({connectedDevice:(0,u.connectedDeviceStubBuilder)({id:"device-1"}),id:"session-1"},()=>o,c,n,r.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS),S=(0,a.deviceSessionStubBuilder)({connectedDevice:(0,u.connectedDeviceStubBuilder)({id:"device-1"}),id:"session-2"},()=>o,c,n,r.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS),e.addDeviceSession(d),e.addDeviceSession(S),expect(e.getDeviceSessionsByDeviceId("device-1")).toEqual(s.Either.of([d,S])),d.close(),S.close()})}),it("should get all sessions",()=>{e.addDeviceSession(i),expect(e.getDeviceSessions()).toEqual([i])}),it("should retrieve sessionObs",()=>{expect(e.sessionsObs).toBeInstanceOf(f.Observable)}),it("should emit new session",()=>new Promise((t,v)=>{const D=e.sessionsObs.subscribe({next(l){try{expect(l).toStrictEqual(i),D.unsubscribe(),t()}catch(q){v(q)}}});e.addDeviceSession(i)})),it("should emit previous added session",()=>{const t=(0,a.deviceSessionStubBuilder)({id:"last-session"},()=>o,c,n,r.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS),v=[];e.addDeviceSession(i),e.addDeviceSession(t);const D=e.sessionsObs.subscribe({next(l){v.push(l)}});t.close(),expect(v).toEqual([i,t]),D.unsubscribe()})});
|
|
2
2
|
//# sourceMappingURL=DefaultDeviceSessionService.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/internal/device-session/service/DefaultDeviceSessionService.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { Either, Left } from \"purify-ts\";\nimport { Observable } from \"rxjs\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { type DeviceSession } from \"@internal/device-session/model/DeviceSession\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DeviceSessionNotFound } from \"@internal/device-session/model/Errors\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport {
|
|
5
|
-
"mappings": "aAAA,IAAAA,EAA6B,qBAC7BC,EAA2B,gBAG3BC,EAA2C,8DAC3CC,EAAyD,qEAEzDC,EAAyC,6DACzCC,EAAsC,iDACtCC,EAA8C,4EAC9CC,
|
|
6
|
-
"names": ["import_purify_ts", "import_rxjs", "import_TransportConnectedDevice", "import_DeviceSessionRefresherConst", "import_DeviceSession", "import_Errors", "import_DefaultLoggerPublisherService", "
|
|
4
|
+
"sourcesContent": ["import { Either, Left } from \"purify-ts\";\nimport { Observable } from \"rxjs\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { type DeviceSession } from \"@internal/device-session/model/DeviceSession\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DeviceSessionNotFound } from \"@internal/device-session/model/Errors\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport { HttpManagerApiDataSource } from \"@internal/manager-api/data/HttpManagerApiDataSource\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport type { ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { type SecureChannelDataSource } from \"@internal/secure-channel/data/SecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { DefaultDeviceSessionService } from \"./DefaultDeviceSessionService\";\n\nvi.mock(\"@internal/logger-publisher/service/DefaultLoggerPublisherService\");\nvi.mock(\"@internal/manager-api/data/HttpManagerApiDataSource\");\n\nlet sessionService: DefaultDeviceSessionService;\nlet loggerService: DefaultLoggerPublisherService;\nlet deviceSession: DeviceSession;\nlet deviceSession1: DeviceSession;\nlet deviceSession2: DeviceSession;\nlet managerApiDataSource: ManagerApiDataSource;\nlet managerApi: ManagerApiService;\nlet secureChannelDataSource: SecureChannelDataSource;\nlet secureChannel: SecureChannelService;\n\ndescribe(\"DefaultDeviceSessionService\", () => {\n // Initialize shared resources\n loggerService = new DefaultLoggerPublisherService([], \"deviceSession\");\n managerApiDataSource = new HttpManagerApiDataSource({} as DmkConfig);\n managerApi = new DefaultManagerApiService(managerApiDataSource);\n secureChannelDataSource = new DefaultSecureChannelDataSource({} as DmkConfig);\n secureChannel = new DefaultSecureChannelService(secureChannelDataSource);\n\n beforeEach(() => {\n vi.restoreAllMocks();\n // Create a new instance before each test\n sessionService = new DefaultDeviceSessionService(() => loggerService);\n // Create a device session stub with default properties\n deviceSession = deviceSessionStubBuilder(\n {},\n () => loggerService,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n });\n\n afterEach(() => {\n deviceSession.close();\n });\n\n it(\"should have an empty DeviceSession list\", () => {\n expect(sessionService.getDeviceSessions()).toEqual([]);\n });\n\n describe(\"DeviceSessionService addDeviceSession\", () => {\n it(\"should add a DeviceSession if it does not already exist\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessions()).toEqual([deviceSession]);\n });\n it(\"should not add a DeviceSession if it already exists\", () => {\n sessionService.addDeviceSession(deviceSession);\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessions()).toEqual([deviceSession]);\n });\n });\n\n describe(\"DeviceSessionService removeDeviceSession\", () => {\n it(\"should remove the DeviceSession of given ID\", () => {\n sessionService.addDeviceSession(deviceSession);\n sessionService.removeDeviceSession(deviceSession.id);\n expect(sessionService.getDeviceSessions()).toEqual([]);\n });\n it(\"should not remove the DeviceSession of given ID if it does not exist\", () => {\n sessionService.addDeviceSession(deviceSession);\n sessionService.removeDeviceSession(\"non-existent-id\");\n expect(sessionService.getDeviceSessions()).toEqual([deviceSession]);\n });\n });\n\n describe(\"DeviceSessionService getDeviceSessionById\", () => {\n it(\"should get the DeviceSession of given ID if it exists\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessionById(deviceSession.id)).toEqual(\n Either.of(deviceSession),\n );\n });\n it(\"should not get the DeviceSession if it does not exist\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessionById(\"non-existent-id\")).toEqual(\n Left(new DeviceSessionNotFound()),\n );\n });\n });\n\n describe(\"DeviceSessionService getDeviceSessionsByDeviceId\", () => {\n it(\"should not get device sessions by deviceId if none exist\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(\n sessionService.getDeviceSessionsByDeviceId(\"non-existent-device-id\"),\n ).toEqual(Left(new DeviceSessionNotFound()));\n });\n it(\"should get a single device session by deviceId\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(\n sessionService.getDeviceSessionsByDeviceId(\n deviceSession.connectedDevice.id,\n ),\n ).toEqual(Either.of([deviceSession]));\n });\n it(\"should get device sessions by deviceId\", () => {\n sessionService.addDeviceSession(deviceSession);\n deviceSession1 = deviceSessionStubBuilder(\n {\n connectedDevice: connectedDeviceStubBuilder({ id: \"device-1\" }),\n id: \"session-1\",\n },\n () => loggerService,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n\n deviceSession2 = deviceSessionStubBuilder(\n {\n connectedDevice: connectedDeviceStubBuilder({ id: \"device-1\" }),\n id: \"session-2\",\n },\n () => loggerService,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n sessionService.addDeviceSession(deviceSession1);\n sessionService.addDeviceSession(deviceSession2);\n expect(sessionService.getDeviceSessionsByDeviceId(\"device-1\")).toEqual(\n Either.of([deviceSession1, deviceSession2]),\n );\n deviceSession1.close();\n deviceSession2.close();\n });\n });\n\n it(\"should get all sessions\", () => {\n sessionService.addDeviceSession(deviceSession);\n expect(sessionService.getDeviceSessions()).toEqual([deviceSession]);\n });\n\n it(\"should retrieve sessionObs\", () => {\n expect(sessionService.sessionsObs).toBeInstanceOf(\n Observable<DeviceSession>,\n );\n });\n\n it(\"should emit new session\", () =>\n new Promise<void>((resolve, reject) => {\n const subscription = sessionService.sessionsObs.subscribe({\n next(emittedDeviceSession) {\n try {\n expect(emittedDeviceSession).toStrictEqual(deviceSession);\n subscription.unsubscribe();\n resolve();\n } catch (error) {\n reject(error);\n }\n },\n });\n sessionService.addDeviceSession(deviceSession);\n }));\n\n it(\"should emit previous added session\", () => {\n const lastDeviceSession = deviceSessionStubBuilder(\n { id: \"last-session\" },\n () => loggerService,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n const emittedSessions: DeviceSession[] = [];\n sessionService.addDeviceSession(deviceSession);\n sessionService.addDeviceSession(lastDeviceSession);\n\n const subscription = sessionService.sessionsObs.subscribe({\n next(emittedDeviceSession) {\n emittedSessions.push(emittedDeviceSession);\n },\n });\n lastDeviceSession.close();\n expect(emittedSessions).toEqual([deviceSession, lastDeviceSession]);\n subscription.unsubscribe();\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAA6B,qBAC7BC,EAA2B,gBAG3BC,EAA2C,8DAC3CC,EAAyD,qEAEzDC,EAAyC,6DACzCC,EAAsC,iDACtCC,EAA8C,4EAC9CC,EAAyC,+DAEzCC,EAAyC,kEAEzCC,EAA+C,wEAE/CC,EAA4C,wEAG5CC,EAA4C,yCAE5C,GAAG,KAAK,kEAAkE,EAC1E,GAAG,KAAK,qDAAqD,EAE7D,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEJ,SAAS,8BAA+B,IAAM,CAE5CP,EAAgB,IAAI,gCAA8B,CAAC,EAAG,eAAe,EACrEI,EAAuB,IAAI,2BAAyB,CAA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B,IAAM,CACrC,OAAOF,EAAe,WAAW,EAAE,eACjC,YACF,CACF,CAAC,EAED,GAAG,0BAA2B,IAC5B,IAAI,QAAc,CAACS,EAASC,IAAW,CACrC,MAAMC,EAAeX,EAAe,YAAY,UAAU,CACxD,KAAKY,EAAsB,CACzB,GAAI,CACF,OAAOA,CAAoB,EAAE,cAAcV,CAAa,EACxDS,EAAa,YAAY,EACzBF,EAAQ,CACV,OAASI,EAAO,CACdH,EAAOG,CAAK,CACd,CACF,CACF,CAAC,EACDb,EAAe,iBAAiBE,CAAa,CAC/C,CAAC,CAAC,EAEJ,GAAG,qCAAsC,IAAM,CAC7C,MAAMY,KAAoB,4BACxB,CAAE,GAAI,cAAe,EACrB,IAAMb,EACNK,EACAE,EACA,0CACF,EACMO,EAAmC,CAAC,EAC1Cf,EAAe,iBAAiBE,CAAa,EAC7CF,EAAe,iBAAiBc,CAAiB,EAEjD,MAAMH,EAAeX,EAAe,YAAY,UAAU,CACxD,KAAKY,EAAsB,CACzBG,EAAgB,KAAKH,CAAoB,CAC3C,CACF,CAAC,EACDE,EAAkB,MAAM,EACxB,OAAOC,CAAe,EAAE,QAAQ,CAACb,EAAeY,CAAiB,CAAC,EAClEH,EAAa,YAAY,CAC3B,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_purify_ts", "import_rxjs", "import_TransportConnectedDevice", "import_DeviceSessionRefresherConst", "import_DeviceSession", "import_Errors", "import_DefaultLoggerPublisherService", "import_HttpManagerApiDataSource", "import_DefaultManagerApiService", "import_DefaultSecureChannelDataSource", "import_DefaultSecureChannelService", "import_DefaultDeviceSessionService", "sessionService", "loggerService", "deviceSession", "deviceSession1", "deviceSession2", "managerApiDataSource", "managerApi", "secureChannelDataSource", "secureChannel", "resolve", "reject", "subscription", "emittedDeviceSession", "error", "lastDeviceSession", "emittedSessions"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var S=require("../../device-session/data/DeviceSessionRefresherConst"),m=require("../../device-session/model/DeviceSession.stub"),p=require("../../device-session/service/DefaultDeviceSessionService"),l=require("../../device-session/use-case/CloseSessionsUseCase"),u=require("../../logger-publisher/service/DefaultLoggerPublisherService"),f=require("../../manager-api/data/
|
|
1
|
+
"use strict";var S=require("../../device-session/data/DeviceSessionRefresherConst"),m=require("../../device-session/model/DeviceSession.stub"),p=require("../../device-session/service/DefaultDeviceSessionService"),l=require("../../device-session/use-case/CloseSessionsUseCase"),u=require("../../logger-publisher/service/DefaultLoggerPublisherService"),f=require("../../manager-api/data/HttpManagerApiDataSource"),v=require("../../manager-api/service/DefaultManagerApiService"),D=require("../../secure-channel/data/DefaultSecureChannelDataSource"),g=require("../../secure-channel/service/DefaultSecureChannelService"),C=require("../../transport/service/__mocks__/DefaultTransportService");let o,i,t,a,n,r,c;describe("CloseSessionsUseCase",()=>{beforeEach(()=>{o=new u.DefaultLoggerPublisherService([],"close-sessions-use-case-test"),i=new f.HttpManagerApiDataSource({}),t=new v.DefaultManagerApiService(i),a=new D.DefaultSecureChannelDataSource({}),n=new g.DefaultSecureChannelService(a),r=new p.DefaultDeviceSessionService(()=>o),c=new C.DefaultTransportService}),it("should be able to close every session",()=>{[...Array(10).keys()].map(e=>{const s=(0,m.deviceSessionStubBuilder)({id:e.toString()},()=>o,t,n,S.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS);return vi.spyOn(s,"close"),s}).forEach(e=>r.addDeviceSession(e)),new l.CloseSessionsUseCase(r,c).execute();for(const e of r.getDeviceSessions())expect(e.close).toHaveBeenCalled()})});
|
|
2
2
|
//# sourceMappingURL=CloseSessionsUseCase.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/internal/device-session/use-case/CloseSessionsUseCase.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DefaultDeviceSessionService } from \"@internal/device-session/service/DefaultDeviceSessionService\";\nimport { type DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { CloseSessionsUseCase } from \"@internal/device-session/use-case/CloseSessionsUseCase\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport {
|
|
5
|
-
"mappings": "aAEA,IAAAA,EAAyD,qEACzDC,EAAyC,6DACzCC,EAA4C,wEAE5CC,EAAqC,kEACrCC,EAA8C,4EAC9CC,
|
|
6
|
-
"names": ["import_DeviceSessionRefresherConst", "import_DeviceSession", "import_DefaultDeviceSessionService", "import_CloseSessionsUseCase", "import_DefaultLoggerPublisherService", "
|
|
4
|
+
"sourcesContent": ["import { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { deviceSessionStubBuilder } from \"@internal/device-session/model/DeviceSession.stub\";\nimport { DefaultDeviceSessionService } from \"@internal/device-session/service/DefaultDeviceSessionService\";\nimport { type DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { CloseSessionsUseCase } from \"@internal/device-session/use-case/CloseSessionsUseCase\";\nimport { DefaultLoggerPublisherService } from \"@internal/logger-publisher/service/DefaultLoggerPublisherService\";\nimport { HttpManagerApiDataSource } from \"@internal/manager-api/data/HttpManagerApiDataSource\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { type SecureChannelDataSource } from \"@internal/secure-channel/data/SecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\nimport { DefaultTransportService } from \"@internal/transport/service/__mocks__/DefaultTransportService\";\n\nlet logger: LoggerPublisherService;\nlet managerApiDataSource: ManagerApiDataSource;\nlet managerApi: ManagerApiService;\nlet secureChannelDataSource: SecureChannelDataSource;\nlet secureChannel: SecureChannelService;\nlet sessionService: DeviceSessionService;\nlet transportService: DefaultTransportService;\n\n// @TODO Fix this test with vi.spyOn session close [SNAPSHOT PURPOSE]\ndescribe(\"CloseSessionsUseCase\", () => {\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService(\n [],\n \"close-sessions-use-case-test\",\n );\n managerApiDataSource = new HttpManagerApiDataSource({} as DmkConfig);\n managerApi = new DefaultManagerApiService(managerApiDataSource);\n secureChannelDataSource = new DefaultSecureChannelDataSource(\n {} as DmkConfig,\n );\n secureChannel = new DefaultSecureChannelService(secureChannelDataSource);\n sessionService = new DefaultDeviceSessionService(() => logger);\n transportService = new DefaultTransportService();\n });\n\n it(\"should be able to close every session\", () => {\n //given\n const sessions = [...Array(10).keys()].map((id) => {\n const session = deviceSessionStubBuilder(\n { id: id.toString() },\n () => logger,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n vi.spyOn(session, \"close\");\n return session;\n });\n sessions.forEach((session) => sessionService.addDeviceSession(session));\n const useCase = new CloseSessionsUseCase(sessionService, transportService);\n //when\n useCase.execute();\n //then\n for (const session of sessionService.getDeviceSessions()) {\n expect(session.close).toHaveBeenCalled();\n }\n });\n});\n"],
|
|
5
|
+
"mappings": "aAEA,IAAAA,EAAyD,qEACzDC,EAAyC,6DACzCC,EAA4C,wEAE5CC,EAAqC,kEACrCC,EAA8C,4EAC9CC,EAAyC,+DAEzCC,EAAyC,kEAEzCC,EAA+C,wEAE/CC,EAA4C,wEAE5CC,EAAwC,yEAExC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAGJ,SAAS,uBAAwB,IAAM,CACrC,WAAW,IAAM,CACfN,EAAS,IAAI,gCACX,CAAC,EACD,8BACF,EACAC,EAAuB,IAAI,2BAAyB,CAAC,CAAc,EACnEC,EAAa,IAAI,2BAAyBD,CAAoB,EAC9DE,EAA0B,IAAI,iCAC5B,CAAC,CACH,EACAC,EAAgB,IAAI,8BAA4BD,CAAuB,EACvEE,EAAiB,IAAI,8BAA4B,IAAML,CAAM,EAC7DM,EAAmB,IAAI,yBACzB,CAAC,EAED,GAAG,wCAAyC,IAAM,CAE/B,CAAC,GAAG,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,IAAKC,GAAO,CACjD,MAAMC,KAAU,4BACd,CAAE,GAAID,EAAG,SAAS,CAAE,EACpB,IAAMP,EACNE,EACAE,EACA,0CACF,EACA,UAAG,MAAMI,EAAS,OAAO,EAClBA,CACT,CAAC,EACQ,QAASA,GAAYH,EAAe,iBAAiBG,CAAO,CAAC,EACtD,IAAI,uBAAqBH,EAAgBC,CAAgB,EAEjE,QAAQ,EAEhB,UAAWE,KAAWH,EAAe,kBAAkB,EACrD,OAAOG,EAAQ,KAAK,EAAE,iBAAiB,CAE3C,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_DeviceSessionRefresherConst", "import_DeviceSession", "import_DefaultDeviceSessionService", "import_CloseSessionsUseCase", "import_DefaultLoggerPublisherService", "import_HttpManagerApiDataSource", "import_DefaultManagerApiService", "import_DefaultSecureChannelDataSource", "import_DefaultSecureChannelService", "import_DefaultTransportService", "logger", "managerApiDataSource", "managerApi", "secureChannelDataSource", "secureChannel", "sessionService", "transportService", "id", "session"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var p=require("../../device-session/data/DeviceSessionRefresherConst"),u=require("../../device-session/model/DeviceSession.stub"),f=require("../../device-session/model/Errors"),l=require("../../device-session/service/DefaultDeviceSessionService"),v=require("../../logger-publisher/service/DefaultLoggerPublisherService"),D=require("../../manager-api/data/HttpManagerApiDataSource"),d=require("../../manager-api/service/DefaultManagerApiService"),g=require("../../secure-channel/data/DefaultSecureChannelDataSource"),h=require("../../secure-channel/service/DefaultSecureChannelService"),a=require("./GetDeviceSessionStateUseCase");vi.mock("@internal/manager-api/data/HttpManagerApiDataSource");let r,o,n,c,S,m;const i="fakeSessionId";describe("GetDeviceSessionStateUseCase",()=>{beforeEach(()=>{r=new v.DefaultLoggerPublisherService([],"get-connected-device-use-case-test"),n=new D.HttpManagerApiDataSource({}),c=new d.DefaultManagerApiService(n),S=new g.DefaultSecureChannelDataSource({}),m=new h.DefaultSecureChannelService(S),o=new l.DefaultDeviceSessionService(()=>r)}),it("should retrieve deviceSession device state",()=>{const e=(0,u.deviceSessionStubBuilder)({id:i},()=>r,c,m,p.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS);o.addDeviceSession(e);const t=new a.GetDeviceSessionStateUseCase(o,()=>r).execute({sessionId:i}),C=e.state;e.close(),expect(t).toStrictEqual(C)}),it("should throw error when deviceSession is not found",()=>new Promise(e=>{const s=new a.GetDeviceSessionStateUseCase(o,()=>r);try{s.execute({sessionId:i}).subscribe()}catch(t){expect(t).toBeInstanceOf(f.DeviceSessionNotFound),e()}}))});
|
|
2
2
|
//# sourceMappingURL=GetDeviceSessionStateUseCase.test.js.map
|
package/lib/cjs/src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/internal/device-session/use-case/GetDeviceSessionStateUseCase.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\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 {
|
|
5
|
-
"mappings": "aAEA,IAAAA,EAAyD,qEACzDC,EAAyC,6DACzCC,EAAsC,iDACtCC,EAA4C,wEAE5CC,EAA8C,4EAC9CC,
|
|
6
|
-
"names": ["import_DeviceSessionRefresherConst", "import_DeviceSession", "import_Errors", "import_DefaultDeviceSessionService", "import_DefaultLoggerPublisherService", "
|
|
4
|
+
"sourcesContent": ["import { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\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 { HttpManagerApiDataSource } from \"@internal/manager-api/data/HttpManagerApiDataSource\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { DefaultManagerApiService } from \"@internal/manager-api/service/DefaultManagerApiService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { DefaultSecureChannelDataSource } from \"@internal/secure-channel/data/DefaultSecureChannelDataSource\";\nimport { type SecureChannelDataSource } from \"@internal/secure-channel/data/SecureChannelDataSource\";\nimport { DefaultSecureChannelService } from \"@internal/secure-channel/service/DefaultSecureChannelService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { GetDeviceSessionStateUseCase } from \"./GetDeviceSessionStateUseCase\";\n\nvi.mock(\"@internal/manager-api/data/HttpManagerApiDataSource\");\n\nlet logger: LoggerPublisherService;\nlet sessionService: DeviceSessionService;\nlet managerApiDataSource: ManagerApiDataSource;\nlet managerApi: ManagerApiService;\nlet secureChannelDataSource: SecureChannelDataSource;\nlet secureChannel: SecureChannelService;\n\nconst fakeSessionId = \"fakeSessionId\";\n\ndescribe(\"GetDeviceSessionStateUseCase\", () => {\n beforeEach(() => {\n logger = new DefaultLoggerPublisherService(\n [],\n \"get-connected-device-use-case-test\",\n );\n managerApiDataSource = new HttpManagerApiDataSource({} as DmkConfig);\n managerApi = new DefaultManagerApiService(managerApiDataSource);\n secureChannelDataSource = new DefaultSecureChannelDataSource(\n {} as DmkConfig,\n );\n secureChannel = new DefaultSecureChannelService(secureChannelDataSource);\n sessionService = new DefaultDeviceSessionService(() => logger);\n });\n\n // TODO: This test does not close a subscription\n // \u00AF\\_(\u30C4)_/\u00AF I cannot find which one unfortunatly\n it(\"should retrieve deviceSession device state\", () => {\n // given\n const deviceSession = deviceSessionStubBuilder(\n { id: fakeSessionId },\n () => logger,\n managerApi,\n secureChannel,\n DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n );\n sessionService.addDeviceSession(deviceSession);\n const useCase = new GetDeviceSessionStateUseCase(\n sessionService,\n () => logger,\n );\n\n const res = useCase.execute({ sessionId: fakeSessionId });\n const expected = deviceSession.state;\n\n deviceSession.close();\n\n // then\n expect(res).toStrictEqual(expected);\n });\n\n it(\"should throw error when deviceSession is not found\", () =>\n new Promise<void>((resolve) => {\n // given\n const useCase = new GetDeviceSessionStateUseCase(\n sessionService,\n () => logger,\n );\n\n // when\n try {\n useCase\n .execute({\n sessionId: fakeSessionId,\n })\n .subscribe();\n } catch (error) {\n // then\n expect(error).toBeInstanceOf(DeviceSessionNotFound);\n resolve();\n }\n }));\n});\n"],
|
|
5
|
+
"mappings": "aAEA,IAAAA,EAAyD,qEACzDC,EAAyC,6DACzCC,EAAsC,iDACtCC,EAA4C,wEAE5CC,EAA8C,4EAC9CC,EAAyC,+DAEzCC,EAAyC,kEAEzCC,EAA+C,wEAE/CC,EAA4C,wEAG5CC,EAA6C,0CAE7C,GAAG,KAAK,qDAAqD,EAE7D,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEJ,MAAMC,EAAgB,gBAEtB,SAAS,+BAAgC,IAAM,CAC7C,WAAW,IAAM,CACfN,EAAS,IAAI,gCACX,CAAC,EACD,oCACF,EACAE,EAAuB,IAAI,2BAAyB,CAAC,CAAc,EACnEC,EAAa,IAAI,2BAAyBD,CAAoB,EAC9DE,EAA0B,IAAI,iCAC5B,CAAC,CACH,EACAC,EAAgB,IAAI,8BAA4BD,CAAuB,EACvEH,EAAiB,IAAI,8BAA4B,IAAMD,CAAM,CAC/D,CAAC,EAID,GAAG,6CAA8C,IAAM,CAErD,MAAMO,KAAgB,4BACpB,CAAE,GAAID,CAAc,EACpB,IAAMN,EACNG,EACAE,EACA,0CACF,EACAJ,EAAe,iBAAiBM,CAAa,EAM7C,MAAMC,EALU,IAAI,+BAClBP,EACA,IAAMD,CACR,EAEoB,QAAQ,CAAE,UAAWM,CAAc,CAAC,EAClDG,EAAWF,EAAc,MAE/BA,EAAc,MAAM,EAGpB,OAAOC,CAAG,EAAE,cAAcC,CAAQ,CACpC,CAAC,EAED,GAAG,qDAAsD,IACvD,IAAI,QAAeC,GAAY,CAE7B,MAAMC,EAAU,IAAI,+BAClBV,EACA,IAAMD,CACR,EAGA,GAAI,CACFW,EACG,QAAQ,CACP,UAAWL,CACb,CAAC,EACA,UAAU,CACf,OAASM,EAAO,CAEd,OAAOA,CAAK,EAAE,eAAe,uBAAqB,EAClDF,EAAQ,CACV,CACF,CAAC,CAAC,CACN,CAAC",
|
|
6
|
+
"names": ["import_DeviceSessionRefresherConst", "import_DeviceSession", "import_Errors", "import_DefaultDeviceSessionService", "import_DefaultLoggerPublisherService", "import_HttpManagerApiDataSource", "import_DefaultManagerApiService", "import_DefaultSecureChannelDataSource", "import_DefaultSecureChannelService", "import_GetDeviceSessionStateUseCase", "logger", "sessionService", "managerApiDataSource", "managerApi", "secureChannelDataSource", "secureChannel", "fakeSessionId", "deviceSession", "res", "expected", "resolve", "useCase", "error"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var t=require("purify-ts"),D=require("../../../api/transport/model/__mocks__/TransportMock"),S=require("../../../api/transport/model/Errors"),y=require("../../../api/transport/model/TransportConnectedDevice.stub"),u=require("../../device-session/data/DeviceSessionRefresherConst"),v=require("../../device-session/model/DeviceSession.stub"),C=require("../../device-session/model/Errors"),h=require("../../device-session/service/DefaultDeviceSessionService"),w=require("../../logger-publisher/service/DefaultLoggerPublisherService"),g=require("../../manager-api/data/HttpManagerApiDataSource"),T=require("../../manager-api/service/DefaultManagerApiService"),k=require("../../secure-channel/data/DefaultSecureChannelDataSource"),A=require("../../secure-channel/service/DefaultSecureChannelService"),E=require("../../transport/service/DefaultTransportService"),a=require("./DisconnectUseCase");vi.mock("@internal/transport/service/DefaultTransportService");let e,p,s=[];const n=vi.fn().mockReturnValue(new w.DefaultLoggerPublisherService([],"DisconnectUseCaseTest"));let c,m,f,d,l;const i="sessionId";describe("DisconnectUseCase",()=>{beforeAll(()=>{p=new D.TransportMock,s=[p],e=new h.DefaultDeviceSessionService(n),c=new E.DefaultTransportService,vi.spyOn(c,"getTransport").mockReturnValue(t.Maybe.of(p))}),it("should disconnect from a device",async()=>{const r=(0,y.connectedDeviceStubBuilder)();f=new g.HttpManagerApiDataSource({}),m=new T.DefaultManagerApiService(f),d=new k.DefaultSecureChannelDataSource({}),l=new A.DefaultSecureChannelService(d);const o=(0,v.deviceSessionStubBuilder)({id:i,connectedDevice:r},n,m,l,u.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS);vi.spyOn(e,"getDeviceSessionById").mockImplementation(()=>(0,t.Right)(o)),vi.spyOn(o,"close"),vi.spyOn(e,"removeDeviceSession"),vi.spyOn(s[0],"disconnect").mockImplementation(()=>Promise.resolve((0,t.Right)(void 0))),await new a.DisconnectUseCase(c,e,n).execute({sessionId:i}),expect(o.close).toHaveBeenCalled(),expect(e.removeDeviceSession).toHaveBeenCalledWith(i),expect(s[0].disconnect).toHaveBeenCalledWith({connectedDevice:r})}),it("should throw an error when deviceSession not found",async()=>{const r=new a.DisconnectUseCase(c,e,n);try{await r.execute({sessionId:i})}catch(o){expect(o).toStrictEqual(new C.DeviceSessionNotFound)}}),it("should throw an error if usb hid disconnection fails",async()=>{vi.spyOn(e,"getDeviceSessionById").mockImplementation(()=>(0,t.Right)((0,v.deviceSessionStubBuilder)({id:i},n,m,l,u.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS))),vi.spyOn(s[0],"disconnect").mockResolvedValue((0,t.Left)(new S.DisconnectError));const r=new a.DisconnectUseCase(c,e,n);try{await r.execute({sessionId:i})}catch(o){expect(o).toStrictEqual(new S.DisconnectError)}})});
|
|
2
2
|
//# sourceMappingURL=DisconnectUseCase.test.js.map
|