@ledgerhq/device-management-kit 1.7.1 → 1.9.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/README.md +0 -3
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/src/api/DeviceManagementKitBuilder.test.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKitBuilder.test.js.map +2 -2
- package/lib/cjs/src/api/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/model/UserInteractionRequired.js +1 -1
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
- 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 +2 -2
- package/lib/cjs/src/api/device-action/os/InstallLanguagePackage/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/InstallLanguagePackage/types.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/index.js +1 -1
- package/lib/cjs/src/api/index.js.map +3 -3
- package/lib/cjs/src/api/types.js +1 -1
- package/lib/cjs/src/api/types.js.map +3 -3
- package/lib/cjs/src/api/utils/ApplicationChecker.js +1 -1
- package/lib/cjs/src/api/utils/ApplicationChecker.js.map +3 -3
- package/lib/cjs/src/api/utils/ApplicationChecker.test.js +1 -1
- package/lib/cjs/src/api/utils/ApplicationChecker.test.js.map +2 -2
- package/lib/cjs/src/api/utils/apduLogs.js +1 -1
- package/lib/cjs/src/api/utils/apduLogs.js.map +3 -3
- package/lib/cjs/src/api/utils/apduLogs.test.js +1 -1
- package/lib/cjs/src/api/utils/apduLogs.test.js.map +3 -3
- package/lib/cjs/src/di.test.js +2 -0
- package/lib/cjs/src/di.test.js.map +7 -0
- package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.js.map +2 -2
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/HttpManagerApiDataSource.test.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/model/Const.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Const.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/model/Firmware.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Firmware.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
- package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
- package/lib/cjs/src/internal/secure-channel/model/Errors.js +1 -1
- package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +2 -2
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
- package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js +1 -1
- package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js.map +1 -1
- package/lib/esm/package.json +1 -1
- package/lib/esm/src/api/DeviceManagementKitBuilder.test.js +1 -1
- package/lib/esm/src/api/DeviceManagementKitBuilder.test.js.map +2 -2
- package/lib/esm/src/api/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/model/UserInteractionRequired.js +1 -1
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
- 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 -1
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/types.js.map +2 -2
- package/lib/esm/src/api/device-action/os/InstallLanguagePackage/types.js +1 -1
- package/lib/esm/src/api/device-action/os/InstallLanguagePackage/types.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/index.js +1 -1
- package/lib/esm/src/api/index.js.map +3 -3
- package/lib/esm/src/api/types.js +1 -0
- package/lib/esm/src/api/types.js.map +4 -4
- package/lib/esm/src/api/utils/ApplicationChecker.js +1 -1
- package/lib/esm/src/api/utils/ApplicationChecker.js.map +3 -3
- package/lib/esm/src/api/utils/ApplicationChecker.test.js +1 -1
- package/lib/esm/src/api/utils/ApplicationChecker.test.js.map +2 -2
- package/lib/esm/src/api/utils/apduLogs.js +1 -1
- package/lib/esm/src/api/utils/apduLogs.js.map +3 -3
- package/lib/esm/src/api/utils/apduLogs.test.js +1 -1
- package/lib/esm/src/api/utils/apduLogs.test.js.map +3 -3
- package/lib/esm/src/di.test.js +2 -0
- package/lib/esm/src/di.test.js.map +7 -0
- package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.js.map +2 -2
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionRefresher.test.js.map +2 -2
- package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.js +1 -1
- package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.js.map +3 -3
- package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.test.js +1 -1
- package/lib/esm/src/internal/manager-api/data/HttpManagerApiDataSource.test.js.map +3 -3
- package/lib/esm/src/internal/manager-api/model/Const.js +1 -1
- package/lib/esm/src/internal/manager-api/model/Const.js.map +2 -2
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +2 -2
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
- package/lib/esm/src/internal/secure-channel/model/Errors.js +1 -1
- package/lib/esm/src/internal/secure-channel/model/Errors.js.map +3 -3
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
- package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts +3 -0
- package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
- package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +3 -1
- package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts +0 -9
- 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 +4 -4
- package/lib/types/src/api/device-action/os/GetDeviceStatus/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/InstallLanguagePackage/types.d.ts +1 -0
- package/lib/types/src/api/device-action/os/InstallLanguagePackage/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts +2 -0
- package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts.map +1 -1
- package/lib/types/src/api/index.d.ts +3 -4
- package/lib/types/src/api/index.d.ts.map +1 -1
- package/lib/types/src/api/types.d.ts +1 -1
- package/lib/types/src/api/types.d.ts.map +1 -1
- package/lib/types/src/api/utils/ApplicationChecker.d.ts +17 -0
- package/lib/types/src/api/utils/ApplicationChecker.d.ts.map +1 -1
- package/lib/types/src/api/utils/apduLogs.d.ts +15 -0
- package/lib/types/src/api/utils/apduLogs.d.ts.map +1 -1
- package/lib/types/src/di.test.d.ts +2 -0
- package/lib/types/src/di.test.d.ts.map +1 -0
- package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSessionRefresher.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/HttpManagerApiDataSource.d.ts +2 -2
- package/lib/types/src/internal/manager-api/data/HttpManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +4 -4
- package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Const.d.ts +1 -1
- package/lib/types/src/internal/manager-api/model/Const.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Firmware.d.ts +3 -0
- package/lib/types/src/internal/manager-api/model/Firmware.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +2 -1
- package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +9 -3
- package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/model/Errors.d.ts +8 -1
- package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +1 -1
- package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts +2 -2
- package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/cjs/src/api/command/os/BackupStorageCommand.js +0 -2
- package/lib/cjs/src/api/command/os/BackupStorageCommand.js.map +0 -7
- package/lib/cjs/src/api/command/os/BackupStorageCommand.test.js +0 -2
- package/lib/cjs/src/api/command/os/BackupStorageCommand.test.js.map +0 -7
- package/lib/cjs/src/api/command/os/GetAppStorageInfoCommand.js +0 -2
- package/lib/cjs/src/api/command/os/GetAppStorageInfoCommand.js.map +0 -7
- package/lib/cjs/src/api/command/os/GetAppStorageInfoCommand.test.js +0 -2
- package/lib/cjs/src/api/command/os/GetAppStorageInfoCommand.test.js.map +0 -7
- package/lib/cjs/src/api/device-action/task/BackupAppStorageTask.js +0 -2
- package/lib/cjs/src/api/device-action/task/BackupAppStorageTask.js.map +0 -7
- package/lib/cjs/src/api/device-action/task/BackupAppStorageTask.test.js +0 -2
- package/lib/cjs/src/api/device-action/task/BackupAppStorageTask.test.js.map +0 -7
- package/lib/cjs/src/api/storage/KeyValueStorage.js +0 -2
- package/lib/cjs/src/api/storage/KeyValueStorage.js.map +0 -7
- package/lib/esm/src/api/command/os/BackupStorageCommand.js +0 -2
- package/lib/esm/src/api/command/os/BackupStorageCommand.js.map +0 -7
- package/lib/esm/src/api/command/os/BackupStorageCommand.test.js +0 -2
- package/lib/esm/src/api/command/os/BackupStorageCommand.test.js.map +0 -7
- package/lib/esm/src/api/command/os/GetAppStorageInfoCommand.js +0 -2
- package/lib/esm/src/api/command/os/GetAppStorageInfoCommand.js.map +0 -7
- package/lib/esm/src/api/command/os/GetAppStorageInfoCommand.test.js +0 -2
- package/lib/esm/src/api/command/os/GetAppStorageInfoCommand.test.js.map +0 -7
- package/lib/esm/src/api/device-action/task/BackupAppStorageTask.js +0 -2
- package/lib/esm/src/api/device-action/task/BackupAppStorageTask.js.map +0 -7
- package/lib/esm/src/api/device-action/task/BackupAppStorageTask.test.js +0 -2
- package/lib/esm/src/api/device-action/task/BackupAppStorageTask.test.js.map +0 -7
- package/lib/esm/src/api/storage/KeyValueStorage.js +0 -2
- package/lib/esm/src/api/storage/KeyValueStorage.js.map +0 -7
- package/lib/types/src/api/command/os/BackupStorageCommand.d.ts +0 -23
- package/lib/types/src/api/command/os/BackupStorageCommand.d.ts.map +0 -1
- package/lib/types/src/api/command/os/BackupStorageCommand.test.d.ts +0 -2
- package/lib/types/src/api/command/os/BackupStorageCommand.test.d.ts.map +0 -1
- package/lib/types/src/api/command/os/GetAppStorageInfoCommand.d.ts +0 -31
- package/lib/types/src/api/command/os/GetAppStorageInfoCommand.d.ts.map +0 -1
- package/lib/types/src/api/command/os/GetAppStorageInfoCommand.test.d.ts +0 -2
- package/lib/types/src/api/command/os/GetAppStorageInfoCommand.test.d.ts.map +0 -1
- package/lib/types/src/api/device-action/task/BackupAppStorageTask.d.ts +0 -23
- package/lib/types/src/api/device-action/task/BackupAppStorageTask.d.ts.map +0 -1
- package/lib/types/src/api/device-action/task/BackupAppStorageTask.test.d.ts +0 -2
- package/lib/types/src/api/device-action/task/BackupAppStorageTask.test.d.ts.map +0 -1
- package/lib/types/src/api/storage/KeyValueStorage.d.ts +0 -7
- package/lib/types/src/api/storage/KeyValueStorage.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/api/device-action/task/GetFirmwareMetadataTask.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { EitherAsync } from \"purify-ts\";\n\nimport { InvalidStatusWordError } from \"@api/command/Errors\";\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { InvalidGetFirmwareMetadataResponseError } from \"@api/device-action/task/Errors\";\nimport { DmkResultFactory } from \"@api/model/DmkResult\";\nimport {\n type FinalFirmware,\n type McuFirmware,\n type OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\n\nimport { GetFirmwareMetadataTask } from \"./GetFirmwareMetadataTask\";\n\ndescribe(\"GetFirmwareMetadataTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n const OS_VERSION = {\n mcuSephVersion: \"mcu_version\",\n mcuBootloaderVersion: \"bl_version\",\n seVersion: \"se_version\",\n } as GetOsVersionResponse;\n\n const CUSTOM_IMAGE_SIZE = 97;\n\n const DEVICE_VERSION = {\n id: 7,\n };\n\n const FIRMWARE_VERSION = {\n id: 361,\n version: \"1.6.0\",\n perso: \"perso_11\",\n } as FinalFirmware;\n\n const OSU_VERSION = {\n id: 362,\n perso: \"perso_11\",\n } as OsuFirmware;\n\n const NEXT_FIRMWARE_VERSION = {\n id: 363,\n version: \"1.7.0\",\n perso: \"perso_11\",\n mcuVersions: [1],\n } as FinalFirmware;\n\n const MCUS = [\n {\n id: 3,\n name: \"other_version\",\n },\n {\n id: 1,\n name: \"mcu_version\",\n },\n ] as McuFirmware[];\n\n const MANAGER_MOCK = {\n getDeviceVersion: vi.fn(),\n getFirmwareVersion: vi.fn(),\n getLatestFirmwareVersion: vi.fn(),\n getNextFirmwareVersion: vi.fn(),\n getMcuList: vi.fn(),\n };\n\n beforeEach(() => {\n vi.clearAllMocks();\n\n apiMock.getManagerApiService.mockReturnValue(\n MANAGER_MOCK as unknown as ManagerApiService,\n );\n MANAGER_MOCK.getDeviceVersion.mockReturnValue(\n EitherAsync(async () => DEVICE_VERSION),\n );\n MANAGER_MOCK.getFirmwareVersion.mockReturnValue(\n EitherAsync(async () => FIRMWARE_VERSION),\n );\n MANAGER_MOCK.getLatestFirmwareVersion.mockReturnValue(\n EitherAsync(async () => OSU_VERSION),\n );\n MANAGER_MOCK.getNextFirmwareVersion.mockReturnValue(\n EitherAsync(async () => NEXT_FIRMWARE_VERSION),\n );\n MANAGER_MOCK.getMcuList.mockReturnValue(EitherAsync(async () => MCUS));\n });\n\n it(\"success with no firmware update available\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(CommandResultFactory({ data: CUSTOM_IMAGE_SIZE }));\n MANAGER_MOCK.getLatestFirmwareVersion.mockReturnValueOnce(\n EitherAsync(async ({ throwE }) => {\n throwE(new Error(\"error\"));\n }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: undefined,\n },\n customImage: { size: CUSTOM_IMAGE_SIZE },\n },\n }),\n );\n });\n\n it(\"success with a firmware update available\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: {\n osuFirmware: OSU_VERSION,\n finalFirmware: NEXT_FIRMWARE_VERSION,\n mcuUpdateRequired: false,\n },\n },\n customImage: {},\n },\n }),\n );\n expect(MANAGER_MOCK.getDeviceVersion).toHaveBeenCalledWith(OS_VERSION);\n expect(MANAGER_MOCK.getFirmwareVersion).toHaveBeenCalledWith(\n OS_VERSION,\n DEVICE_VERSION,\n );\n expect(MANAGER_MOCK.getLatestFirmwareVersion).toHaveBeenCalledWith(\n FIRMWARE_VERSION,\n DEVICE_VERSION,\n );\n expect(MANAGER_MOCK.getNextFirmwareVersion).toHaveBeenCalledWith(\n OSU_VERSION,\n );\n });\n\n it(\"success with a firmware update available and MCU update\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n const nextFirmware = {\n ...NEXT_FIRMWARE_VERSION,\n mcuVersions: [3],\n };\n MANAGER_MOCK.getNextFirmwareVersion.mockReturnValue(\n EitherAsync(async () => nextFirmware),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: {\n osuFirmware: OSU_VERSION,\n finalFirmware: nextFirmware,\n mcuUpdateRequired: true,\n },\n },\n customImage: {},\n },\n }),\n );\n });\n\n it(\"should fail when OS version cannot be retrieved\", async () => {\n // GIVEN\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n });\n\n it(\"should fail if device version cannot be fetched with InvalidGetFirmwareMetadataResponseError\", async () => {\n // GIVEN\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({ data: OS_VERSION }),\n );\n MANAGER_MOCK.getDeviceVersion.mockReturnValueOnce(\n EitherAsync(async ({ throwE }) => {\n throwE(new Error(\"error\"));\n }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n error: new InvalidGetFirmwareMetadataResponseError(),\n }),\n );\n });\n\n it(\"should fail if firmware version cannot be fetched with InvalidGetFirmwareMetadataResponseError\", async () => {\n // GIVEN\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({ data: OS_VERSION }),\n );\n MANAGER_MOCK.getFirmwareVersion.mockReturnValueOnce(\n EitherAsync(async ({ throwE }) => {\n throwE(new Error(\"error\"));\n }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n error: new InvalidGetFirmwareMetadataResponseError(),\n }),\n );\n });\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,eAAAA,
|
|
6
|
-
"names": ["EitherAsync", "InvalidStatusWordError", "CommandResultFactory", "makeDeviceActionInternalApiMock", "InvalidGetFirmwareMetadataResponseError", "DmkResultFactory", "GetFirmwareMetadataTask", "apiMock", "OS_VERSION", "CUSTOM_IMAGE_SIZE", "DEVICE_VERSION", "FIRMWARE_VERSION", "OSU_VERSION", "NEXT_FIRMWARE_VERSION", "MCUS", "MANAGER_MOCK", "
|
|
4
|
+
"sourcesContent": ["import { EitherAsync, Just, Nothing } from \"purify-ts\";\n\nimport { InvalidStatusWordError } from \"@api/command/Errors\";\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { InvalidGetFirmwareMetadataResponseError } from \"@api/device-action/task/Errors\";\nimport { DmkResultFactory } from \"@api/model/DmkResult\";\nimport {\n type FinalFirmware,\n type McuFirmware,\n type OsuFirmware,\n} from \"@internal/manager-api/model/Firmware\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\n\nimport { GetFirmwareMetadataTask } from \"./GetFirmwareMetadataTask\";\n\ndescribe(\"GetFirmwareMetadataTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n const OS_VERSION = {\n mcuSephVersion: \"mcu_version\",\n mcuBootloaderVersion: \"bl_version\",\n seVersion: \"se_version\",\n } as GetOsVersionResponse;\n\n const CUSTOM_IMAGE_SIZE = 97;\n\n const DEVICE_VERSION = {\n id: 7,\n };\n\n const FIRMWARE_VERSION = {\n id: 361,\n version: \"1.6.0\",\n perso: \"perso_11\",\n } as FinalFirmware;\n\n const OSU_VERSION = {\n id: 362,\n perso: \"perso_11\",\n notes: \"notes\",\n } as OsuFirmware;\n\n const NEXT_FIRMWARE_VERSION = {\n id: 363,\n version: \"1.7.0\",\n perso: \"perso_11\",\n mcuVersions: [1],\n } as FinalFirmware;\n\n const MCUS = [\n {\n id: 3,\n name: \"other_version\",\n fromBootloaderVersion: \"1.0\",\n },\n {\n id: 1,\n name: \"mcu_version\",\n fromBootloaderVersion: \"1.0\",\n },\n ] as McuFirmware[];\n\n const MANAGER_MOCK = {\n getDeviceVersion: vi.fn(),\n getFirmwareVersion: vi.fn(),\n getLatestFirmwareVersion: vi.fn(),\n getNextFirmwareVersion: vi.fn(),\n getMcuList: vi.fn(),\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n\n apiMock.getManagerApiService.mockReturnValue(\n MANAGER_MOCK as unknown as ManagerApiService,\n );\n MANAGER_MOCK.getDeviceVersion.mockReturnValue(\n EitherAsync(async () => DEVICE_VERSION),\n );\n MANAGER_MOCK.getFirmwareVersion.mockReturnValue(\n EitherAsync(async () => FIRMWARE_VERSION),\n );\n MANAGER_MOCK.getLatestFirmwareVersion.mockReturnValue(\n EitherAsync(async () => Just(OSU_VERSION)),\n );\n MANAGER_MOCK.getNextFirmwareVersion.mockReturnValue(\n EitherAsync(async () => NEXT_FIRMWARE_VERSION),\n );\n MANAGER_MOCK.getMcuList.mockReturnValue(EitherAsync(async () => MCUS));\n });\n\n it(\"success with no firmware update available\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(CommandResultFactory({ data: CUSTOM_IMAGE_SIZE }));\n MANAGER_MOCK.getLatestFirmwareVersion.mockReturnValueOnce(\n EitherAsync(async () => Nothing),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: undefined,\n },\n customImage: { size: CUSTOM_IMAGE_SIZE },\n },\n }),\n );\n });\n\n it(\"success with no firmware update when latest firmware cannot be fetched\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(CommandResultFactory({ data: CUSTOM_IMAGE_SIZE }));\n MANAGER_MOCK.getLatestFirmwareVersion.mockReturnValueOnce(\n EitherAsync(async ({ throwE }) => {\n throwE(new Error(\"error\"));\n }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: undefined,\n },\n customImage: { size: CUSTOM_IMAGE_SIZE },\n },\n }),\n );\n });\n\n it(\"success with a firmware update available\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: {\n osuFirmware: OSU_VERSION,\n finalFirmware: NEXT_FIRMWARE_VERSION,\n mcuUpdateRequired: false,\n },\n },\n customImage: {},\n },\n }),\n );\n expect(MANAGER_MOCK.getDeviceVersion).toHaveBeenCalledWith(OS_VERSION);\n expect(MANAGER_MOCK.getFirmwareVersion).toHaveBeenCalledWith(\n OS_VERSION,\n DEVICE_VERSION,\n );\n expect(MANAGER_MOCK.getLatestFirmwareVersion).toHaveBeenCalledWith(\n FIRMWARE_VERSION,\n DEVICE_VERSION,\n );\n expect(MANAGER_MOCK.getNextFirmwareVersion).toHaveBeenCalledWith(\n OSU_VERSION,\n );\n });\n\n it(\"success with a firmware update available and MCU update\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n const nextFirmware = {\n ...NEXT_FIRMWARE_VERSION,\n mcuVersions: [3],\n };\n MANAGER_MOCK.getNextFirmwareVersion.mockReturnValue(\n EitherAsync(async () => nextFirmware),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: {\n osuFirmware: OSU_VERSION,\n finalFirmware: nextFirmware,\n mcuUpdateRequired: true,\n },\n },\n customImage: {},\n },\n }),\n );\n });\n\n it(\"success with a firmware update available when current MCU is unknown\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n MANAGER_MOCK.getMcuList.mockReturnValueOnce(\n EitherAsync(async () => [\n {\n id: 3,\n name: \"other_version\",\n fromBootloaderVersion: \"1.0\",\n },\n ]),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: {\n osuFirmware: OSU_VERSION,\n finalFirmware: NEXT_FIRMWARE_VERSION,\n mcuUpdateRequired: true,\n },\n },\n customImage: {},\n },\n }),\n );\n });\n\n it(\"success with no firmware update when next firmware cannot be fetched\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n MANAGER_MOCK.getNextFirmwareVersion.mockReturnValueOnce(\n EitherAsync(async ({ throwE }) => {\n throwE(new Error(\"error\"));\n }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: undefined,\n },\n customImage: {},\n },\n }),\n );\n });\n\n it(\"success with no firmware update when MCU list cannot be fetched\", async () => {\n // GIVEN\n apiMock.sendCommand\n .mockResolvedValueOnce(CommandResultFactory({ data: OS_VERSION }))\n .mockResolvedValueOnce(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n MANAGER_MOCK.getMcuList.mockReturnValueOnce(\n EitherAsync(async ({ throwE }) => {\n throwE(new Error(\"error\"));\n }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n data: {\n deviceVersion: DEVICE_VERSION,\n firmware: FIRMWARE_VERSION,\n firmwareVersion: {\n mcu: \"mcu_version\",\n bootloader: \"bl_version\",\n os: \"se_version\",\n metadata: OS_VERSION,\n },\n firmwareUpdateContext: {\n currentFirmware: FIRMWARE_VERSION,\n availableUpdate: undefined,\n },\n customImage: {},\n },\n }),\n );\n });\n\n it(\"should fail when OS version cannot be retrieved\", async () => {\n // GIVEN\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({ error: new InvalidStatusWordError(\"error\") }),\n );\n });\n\n it(\"should fail if device version cannot be fetched with InvalidGetFirmwareMetadataResponseError\", async () => {\n // GIVEN\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({ data: OS_VERSION }),\n );\n MANAGER_MOCK.getDeviceVersion.mockReturnValueOnce(\n EitherAsync(async ({ throwE }) => {\n throwE(new Error(\"error\"));\n }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n error: new InvalidGetFirmwareMetadataResponseError(),\n }),\n );\n });\n\n it(\"should fail if firmware version cannot be fetched with InvalidGetFirmwareMetadataResponseError\", async () => {\n // GIVEN\n apiMock.sendCommand.mockResolvedValueOnce(\n CommandResultFactory({ data: OS_VERSION }),\n );\n MANAGER_MOCK.getFirmwareVersion.mockReturnValueOnce(\n EitherAsync(async ({ throwE }) => {\n throwE(new Error(\"error\"));\n }),\n );\n\n // WHEN\n const result = await new GetFirmwareMetadataTask(apiMock).run();\n\n // THEN\n expect(result).toStrictEqual(\n DmkResultFactory({\n error: new InvalidGetFirmwareMetadataResponseError(),\n }),\n );\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,EAAa,QAAAC,EAAM,WAAAC,MAAe,YAE3C,OAAS,0BAAAC,MAA8B,sBACvC,OAAS,wBAAAC,MAA4B,mCAErC,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,2CAAAC,MAA+C,iCACxD,OAAS,oBAAAC,MAAwB,uBAQjC,OAAS,2BAAAC,MAA+B,4BAExC,SAAS,0BAA2B,IAAM,CACxC,MAAMC,EAAUJ,EAAgC,EAC1CK,EAAa,CACjB,eAAgB,cAChB,qBAAsB,aACtB,UAAW,YACb,EAEMC,EAAoB,GAEpBC,EAAiB,CACrB,GAAI,CACN,EAEMC,EAAmB,CACvB,GAAI,IACJ,QAAS,QACT,MAAO,UACT,EAEMC,EAAc,CAClB,GAAI,IACJ,MAAO,WACP,MAAO,OACT,EAEMC,EAAwB,CAC5B,GAAI,IACJ,QAAS,QACT,MAAO,WACP,YAAa,CAAC,CAAC,CACjB,EAEMC,EAAO,CACX,CACE,GAAI,EACJ,KAAM,gBACN,sBAAuB,KACzB,EACA,CACE,GAAI,EACJ,KAAM,cACN,sBAAuB,KACzB,CACF,EAEMC,EAAe,CACnB,iBAAkB,GAAG,GAAG,EACxB,mBAAoB,GAAG,GAAG,EAC1B,yBAA0B,GAAG,GAAG,EAChC,uBAAwB,GAAG,GAAG,EAC9B,WAAY,GAAG,GAAG,CACpB,EAEA,WAAW,IAAM,C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AE,KAAMM,CAAW,CAAC,CAC3C,EACAO,EAAa,iBAAiB,oBAC5BjB,EAAY,MAAO,CAAE,OAAAmB,CAAO,IAAM,CAChCA,EAAO,IAAI,MAAM,OAAO,CAAC,CAC3B,CAAC,CACH,EAGA,MAAMD,EAAS,MAAM,IAAIV,EAAwBC,CAAO,EAAE,IAAI,EAG9D,OAAOS,CAAM,EAAE,cACbX,EAAiB,CACf,MAAO,IAAID,CACb,CAAC,CACH,CACF,CAAC,EAED,GAAG,iGAAkG,SAAY,CAE/GG,EAAQ,YAAY,sBAClBL,EAAqB,CAAE,KAAMM,CAAW,CAAC,CAC3C,EACAO,EAAa,mBAAmB,oBAC9BjB,EAAY,MAAO,CAAE,OAAAmB,CAAO,IAAM,CAChCA,EAAO,IAAI,MAAM,OAAO,CAAC,CAC3B,CAAC,CACH,EAGA,MAAMD,EAAS,MAAM,IAAIV,EAAwBC,CAAO,EAAE,IAAI,EAG9D,OAAOS,CAAM,EAAE,cACbX,EAAiB,CACf,MAAO,IAAID,CACb,CAAC,CACH,CACF,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["EitherAsync", "Just", "Nothing", "InvalidStatusWordError", "CommandResultFactory", "makeDeviceActionInternalApiMock", "InvalidGetFirmwareMetadataResponseError", "DmkResultFactory", "GetFirmwareMetadataTask", "apiMock", "OS_VERSION", "CUSTOM_IMAGE_SIZE", "DEVICE_VERSION", "FIRMWARE_VERSION", "OSU_VERSION", "NEXT_FIRMWARE_VERSION", "MCUS", "MANAGER_MOCK", "result", "throwE", "nextFirmware"]
|
|
7
7
|
}
|
package/lib/esm/src/api/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Apdu as r}from"./apdu/model/Apdu";import{APDU_MAX_PAYLOAD as p,ApduBuilder as a}from"./apdu/utils/ApduBuilder";import{ApduParser as
|
|
1
|
+
import{Apdu as r}from"./apdu/model/Apdu";import{APDU_MAX_PAYLOAD as p,ApduBuilder as a}from"./apdu/utils/ApduBuilder";import{ApduParser as i}from"./apdu/utils/ApduParser";export*from"./apdu/utils/AppBuilderError";import{ByteArrayBuilder as c}from"./apdu/utils/ByteArrayBuilder";import{ByteArrayParser as f}from"./apdu/utils/ByteArrayParser";import{InvalidResponseFormatError as D,InvalidStatusWordError as x}from"./command/Errors";import{CommandResultFactory as l,CommandResultStatus as g,isSuccessCommandResult as y}from"./command/model/CommandResult";import{CloseAppCommand as v}from"./command/os/CloseAppCommand";import{DeleteLanguagePackCommand as L,DeleteLanguagePackCommandError as k}from"./command/os/DeleteLanguagePackCommand";import{GetAppAndVersionCommand as R}from"./command/os/GetAppAndVersionCommand";import{GetBackgroundImageSizeCommand as I,GetBackgroundImageSizeCommandError as T}from"./command/os/GetBackgroundImageSizeCommand";import{BatteryStatusType as h,GetBatteryStatusCommand as P}from"./command/os/GetBatteryStatusCommand";import{GetOsVersionCommand as O}from"./command/os/GetOsVersionCommand";import{ListAppsCommand as M}from"./command/os/ListAppsCommand";import{ListLanguagePackCommand as U,ListLanguagePackCommandError as W}from"./command/os/ListLanguagePackCommand";import{LoadCertificateCommand as _}from"./command/os/LoadCertificateCommand";import{OpenAppCommand as z}from"./command/os/OpenAppCommand";import{isCommandErrorCode as H}from"./command/utils/CommandErrors";import{CommandUtils as Q}from"./command/utils/CommandUtils";import{GLOBAL_ERRORS as Y,GlobalCommandError as j,GlobalCommandErrorHandler as J}from"./command/utils/GlobalCommandError";import{DeviceModel as $,DeviceModelId as ee,LEDGER_VENDOR_ID as oe}from"./device/DeviceModel";import{DeviceStatus as te}from"./device/DeviceStatus";import{DeviceActionStatus as ae}from"./device-action/model/DeviceActionState";import{UserInteractionRequired as ie}from"./device-action/model/UserInteractionRequired";import{CallTaskInAppDeviceAction as se}from"./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction";import{DEFAULT_UNLOCK_TIMEOUT_MS as de}from"./device-action/os/Const";import{AppAlreadyInstalledDAError as Ae,DeleteLanguagePackDAError as De,DeviceLockedError as xe,DeviceNotOnboardedError as ue,OutOfMemoryDAError as le,RefusedByUserDAError as ge,UnknownDAError as ye,UnsupportedFirmwareDAError as Ce}from"./device-action/os/Errors";import{GetDeviceMetadataDeviceAction as Se}from"./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction";import{GetDeviceStatusDeviceAction as ke}from"./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction";import{GoToDashboardDeviceAction as Re}from"./device-action/os/GoToDashboard/GoToDashboardDeviceAction";import{InstallLanguagePackageDeviceAction as Ie}from"./device-action/os/InstallLanguagePackage/InstallLanguagePackageDeviceAction";import{InstallOrUpdateAppsDeviceAction as Be}from"./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction";import{ListAppsDeviceAction as Pe}from"./device-action/os/ListApps/ListAppsDeviceAction";import{ListAppsWithMetadataDeviceAction as Oe}from"./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction";import{OpenAppDeviceAction as Me}from"./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction";import{OpenAppWithDependenciesDeviceAction as Ue}from"./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction";import{SendCommandInAppDeviceAction as Ne}from"./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction";import{WaitForAppAndVersionDeviceAction as we}from"./device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction";import{GetApplicationsMetadataTaskError as qe,InvalidGetFirmwareMetadataResponseError as He}from"./device-action/task/Errors";import{XStateDeviceAction as Qe}from"./device-action/xstate-utils/XStateDeviceAction";import{StaticDeviceModelDataSource as Ye}from"./device-model/data/StaticDeviceModelDataSource";import{BleDeviceInfos as Je}from"./device-model/model/BleDeviceInfos";import{TransportDeviceModel as $e}from"./device-model/model/DeviceModel";import{ApduResponse as oo}from"./device-session/ApduResponse";export*from"./device-session/data/FramerConst";import{DeviceSessionStateType as po}from"./device-session/DeviceSessionState";import{DmkResultFactory as no,DmkResultStatus as io,isSuccessDmkResult as mo}from"./model/DmkResult";import{GenuineCheckDeviceAction as co}from"./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction";import{InstallAppDeviceAction as Ao}from"./secure-channel/device-action/InstallApp/InstallAppDeviceAction";import{ListInstalledAppsDeviceAction as xo}from"./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction";import{UninstallAppDeviceAction as lo}from"./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction";import{ConnectToSecureChannelTask as yo}from"./secure-channel/task/ConnectToSecureChannelTask";import{SecureChannelEventType as vo}from"./secure-channel/task/types";import{SecureChannelError as Lo}from"../internal/secure-channel/model/Errors";import{defaultApduReceiverServiceStubBuilder as Eo}from"./device-session/service/DefaultApduReceiverService.stub";import{defaultApduSenderServiceStubBuilder as Go}from"./device-session/service/DefaultApduSenderService.stub";import{FramerUtils as To}from"./device-session/utils/FramerUtils";import{DeviceManagementKit as ho}from"./DeviceManagementKit";import{DeviceManagementKitBuilder as bo}from"./DeviceManagementKitBuilder";export*from"./Error";import{noopLogger as Mo,noopLoggerFactory as Vo}from"./logger-publisher/utils/noopLoggerFactory";import{LogLevel as Wo}from"./logger-subscriber/model/LogLevel";import{ConsoleLogger as _o}from"./logger-subscriber/service/ConsoleLogger";import{DefaultLogTagFormatter as zo}from"./logger-subscriber/service/DefaultLogTagFormatter";import{WebLogsExporterLogger as Ho}from"./logger-subscriber/service/WebLogsExporterLogger";import{DmkNetworkClient as Qo}from"./network/DmkNetworkClient";import{DmkNetworkClientError as Yo}from"./network/DmkNetworkClientError";import{ConnectedDevice as Jo}from"./transport/model/ConnectedDevice";import{DeviceConnectionStateMachine as $o}from"./transport/model/DeviceConnectionStateMachine";export*from"./transport/model/Errors";import{TransportConnectedDevice as rr}from"./transport/model/TransportConnectedDevice";import{connectedDeviceStubBuilder as pr}from"./transport/model/TransportConnectedDevice.stub";export*from"./types";import{formatApduReceivedLog as ir,formatApduSentLog as mr}from"./utils/apduLogs";import{ApplicationChecker as cr}from"./utils/ApplicationChecker";import{isDashboardName as fr}from"./utils/AppName";import{base64StringToBuffer as Dr,bufferToBase64String as xr,isBase64String as ur}from"./utils/Base64String";import{bufferToHexaString as gr,hexaStringToBuffer as yr,isHexaString as Cr}from"./utils/HexaString";export{p as APDU_MAX_PAYLOAD,r as Apdu,a as ApduBuilder,i as ApduParser,oo as ApduResponse,Ae as AppAlreadyInstalledDAError,cr as ApplicationChecker,h as BatteryStatusType,Je as BleDeviceInfos,c as ByteArrayBuilder,f as ByteArrayParser,se as CallTaskInAppDeviceAction,v as CloseAppCommand,l as CommandResultFactory,g as CommandResultStatus,Q as CommandUtils,yo as ConnectToSecureChannelTask,Jo as ConnectedDevice,_o as ConsoleLogger,de as DEFAULT_UNLOCK_TIMEOUT_MS,zo as DefaultLogTagFormatter,L as DeleteLanguagePackCommand,k as DeleteLanguagePackCommandError,De as DeleteLanguagePackDAError,ae as DeviceActionStatus,$o as DeviceConnectionStateMachine,xe as DeviceLockedError,ho as DeviceManagementKit,bo as DeviceManagementKitBuilder,$ as DeviceModel,ee as DeviceModelId,ue as DeviceNotOnboardedError,po as DeviceSessionStateType,te as DeviceStatus,Qo as DmkNetworkClient,Yo as DmkNetworkClientError,no as DmkResultFactory,io as DmkResultStatus,To as FramerUtils,Y as GLOBAL_ERRORS,co as GenuineCheckDeviceAction,R as GetAppAndVersionCommand,qe as GetApplicationsMetadataTaskError,I as GetBackgroundImageSizeCommand,T as GetBackgroundImageSizeCommandError,P as GetBatteryStatusCommand,Se as GetDeviceMetadataDeviceAction,ke as GetDeviceStatusDeviceAction,O as GetOsVersionCommand,j as GlobalCommandError,J as GlobalCommandErrorHandler,Re as GoToDashboardDeviceAction,Ao as InstallAppDeviceAction,Ie as InstallLanguagePackageDeviceAction,Be as InstallOrUpdateAppsDeviceAction,He as InvalidGetFirmwareMetadataResponseError,D as InvalidResponseFormatError,x as InvalidStatusWordError,oe as LEDGER_VENDOR_ID,M as ListAppsCommand,Pe as ListAppsDeviceAction,Oe as ListAppsWithMetadataDeviceAction,xo as ListInstalledAppsDeviceAction,U as ListLanguagePackCommand,W as ListLanguagePackCommandError,_ as LoadCertificateCommand,Wo as LogLevel,z as OpenAppCommand,Me as OpenAppDeviceAction,Ue as OpenAppWithDependenciesDeviceAction,le as OutOfMemoryDAError,ge as RefusedByUserDAError,Lo as SecureChannelError,vo as SecureChannelEventType,Ne as SendCommandInAppDeviceAction,Ye as StaticDeviceModelDataSource,rr as TransportConnectedDevice,$e as TransportDeviceModel,lo as UninstallAppDeviceAction,ye as UnknownDAError,Ce as UnsupportedFirmwareDAError,ie as UserInteractionRequired,we as WaitForAppAndVersionDeviceAction,Ho as WebLogsExporterLogger,Qe as XStateDeviceAction,Dr as base64StringToBuffer,xr as bufferToBase64String,gr as bufferToHexaString,pr as connectedDeviceStubBuilder,Eo as defaultApduReceiverServiceStubBuilder,Go as defaultApduSenderServiceStubBuilder,ir as formatApduReceivedLog,mr as formatApduSentLog,yr as hexaStringToBuffer,ur as isBase64String,H as isCommandErrorCode,fr as isDashboardName,Cr as isHexaString,y as isSuccessCommandResult,mo as isSuccessDmkResult,Mo as noopLogger,Vo as noopLoggerFactory};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/api/index.ts"],
|
|
4
|
-
"sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport { type Command } from \"@api/command/Command\";\nexport {\n InvalidResponseFormatError,\n InvalidStatusWordError,\n} from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport {\n BackupStorageCommand,\n type BackupStorageCommandErrorCodes,\n type BackupStorageCommandResponse,\n type BackupStorageCommandResult,\n} from \"@api/command/os/BackupStorageCommand\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n DeleteLanguagePackCommand,\n type DeleteLanguagePackCommandArgs,\n DeleteLanguagePackCommandError,\n type DeleteLanguagePackCommandResult,\n type DeleteLanguagePackErrorCodes,\n} from \"@api/command/os/DeleteLanguagePackCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n GetAppStorageInfoCommand,\n type GetAppStorageInfoCommandArgs,\n type GetAppStorageInfoCommandErrorCodes,\n type GetAppStorageInfoCommandResponse,\n type GetAppStorageInfoCommandResult,\n} from \"@api/command/os/GetAppStorageInfoCommand\";\nexport {\n GetBackgroundImageSizeCommand,\n GetBackgroundImageSizeCommandError,\n type GetBackgroundImageSizeCommandResult,\n type GetBackgroundImageSizeErrorCodes,\n type GetBackgroundImageSizeResponse,\n} from \"@api/command/os/GetBackgroundImageSizeCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n ListLanguagePackCommand,\n type ListLanguagePackCommandArgs,\n ListLanguagePackCommandError,\n type ListLanguagePackCommandResult,\n type ListLanguagePackErrorCodes,\n type ListLanguagePackResponse,\n} from \"@api/command/os/ListLanguagePackCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GLOBAL_ERRORS,\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nexport {\n AppAlreadyInstalledDAError,\n DeleteLanguagePackDAError,\n DeviceLockedError,\n DeviceNotOnboardedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport type {\n GoToDashboardDAError,\n GoToDashboardDAInput,\n GoToDashboardDAIntermediateValue,\n GoToDashboardDAOutput,\n GoToDashboardDARequiredInteraction,\n GoToDashboardDAState,\n} from \"@api/device-action/os/GoToDashboard/types\";\nexport { InstallLanguagePackageDeviceAction } from \"@api/device-action/os/InstallLanguagePackage/InstallLanguagePackageDeviceAction\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport type {\n WaitForAppAndVersionDAError,\n WaitForAppAndVersionDAInput,\n WaitForAppAndVersionDAIntermediateValue,\n WaitForAppAndVersionDAOutput,\n WaitForAppAndVersionDARequiredInteraction,\n WaitForAppAndVersionDAState,\n} from \"@api/device-action/os/WaitForAppAndVersion/types\";\nexport { WaitForAppAndVersionDeviceAction } from \"@api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction\";\nexport { BackupAppStorageTask } from \"@api/device-action/task/BackupAppStorageTask\";\nexport {\n GetApplicationsMetadataTaskError,\n InvalidGetFirmwareMetadataResponseError,\n} from \"@api/device-action/task/Errors\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nexport {\n DmkResultFactory,\n DmkResultStatus,\n isSuccessDmkResult,\n} from \"@api/model/DmkResult\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { InstallAppDeviceAction } from \"@api/secure-channel/device-action/InstallApp/InstallAppDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nexport type { InstalledApp } from \"@api/secure-channel/device-action/ListInstalledApps/types\";\nexport { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\nexport {\n DMK_STORAGE_PREFIX_KEY,\n type KeyValueStorage,\n} from \"@api/storage/KeyValueStorage\";\nexport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport {\n noopLogger,\n noopLoggerFactory,\n} from \"@api/logger-publisher/utils/noopLoggerFactory\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { DefaultLogTagFormatter } from \"@api/logger-subscriber/service/DefaultLogTagFormatter\";\nexport { type LogTagFormatter } from \"@api/logger-subscriber/service/LogTagFormatter\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport {\n DmkNetworkClient,\n type DmkNetworkClientOptions,\n type DmkNetworkResponse,\n type DmkQueryParams,\n type DmkQueryParamValue,\n type DmkRequestConfig,\n type DmkResponseType,\n} from \"@api/network/DmkNetworkClient\";\nexport { DmkNetworkClientError } from \"@api/network/DmkNetworkClientError\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\n DeviceConnectionStateMachine,\n type DeviceConnectionStateMachineParams,\n} from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { formatApduReceivedLog, formatApduSentLog } from \"@api/utils/apduLogs\";\nexport { ApplicationChecker } from \"@api/utils/ApplicationChecker\";\nexport {\n type AppConfig,\n type ApplicationResolver,\n type ResolvedApp,\n} from \"@api/utils/ApplicationResolver\";\nexport {\n base64StringToBuffer,\n bufferToBase64String,\n isBase64String,\n} from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
|
|
5
|
-
"mappings": "AAEA,OAAS,QAAAA,MAAY,uBACrB,OAAS,oBAAAC,EAAkB,eAAAC,MAAmB,8BAC9C,OAAS,cAAAC,MAAkB,6BAC3B,WAAc,kCACd,OAAS,oBAAAC,MAAwB,mCACjC,OAAS,mBAAAC,MAAuB,kCAEhC,OACE,8BAAAC,EACA,0BAAAC,MACK,sBACP,OACE,wBAAAC,EACA,uBAAAC,EACA,0BAAAC,MACK,mCACP,
|
|
6
|
-
"names": ["Apdu", "APDU_MAX_PAYLOAD", "ApduBuilder", "ApduParser", "ByteArrayBuilder", "ByteArrayParser", "InvalidResponseFormatError", "InvalidStatusWordError", "CommandResultFactory", "CommandResultStatus", "isSuccessCommandResult", "
|
|
4
|
+
"sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport { type Command } from \"@api/command/Command\";\nexport {\n InvalidResponseFormatError,\n InvalidStatusWordError,\n} from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n DeleteLanguagePackCommand,\n type DeleteLanguagePackCommandArgs,\n DeleteLanguagePackCommandError,\n type DeleteLanguagePackCommandResult,\n type DeleteLanguagePackErrorCodes,\n} from \"@api/command/os/DeleteLanguagePackCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n GetBackgroundImageSizeCommand,\n GetBackgroundImageSizeCommandError,\n type GetBackgroundImageSizeCommandResult,\n type GetBackgroundImageSizeErrorCodes,\n type GetBackgroundImageSizeResponse,\n} from \"@api/command/os/GetBackgroundImageSizeCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n ListLanguagePackCommand,\n type ListLanguagePackCommandArgs,\n ListLanguagePackCommandError,\n type ListLanguagePackCommandResult,\n type ListLanguagePackErrorCodes,\n type ListLanguagePackResponse,\n} from \"@api/command/os/ListLanguagePackCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GLOBAL_ERRORS,\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nexport {\n AppAlreadyInstalledDAError,\n DeleteLanguagePackDAError,\n DeviceLockedError,\n DeviceNotOnboardedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport type {\n GoToDashboardDAError,\n GoToDashboardDAInput,\n GoToDashboardDAIntermediateValue,\n GoToDashboardDAOutput,\n GoToDashboardDARequiredInteraction,\n GoToDashboardDAState,\n} from \"@api/device-action/os/GoToDashboard/types\";\nexport { InstallLanguagePackageDeviceAction } from \"@api/device-action/os/InstallLanguagePackage/InstallLanguagePackageDeviceAction\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport type {\n WaitForAppAndVersionDAError,\n WaitForAppAndVersionDAInput,\n WaitForAppAndVersionDAIntermediateValue,\n WaitForAppAndVersionDAOutput,\n WaitForAppAndVersionDARequiredInteraction,\n WaitForAppAndVersionDAState,\n} from \"@api/device-action/os/WaitForAppAndVersion/types\";\nexport { WaitForAppAndVersionDeviceAction } from \"@api/device-action/os/WaitForAppAndVersion/WaitForAppAndVersionDeviceAction\";\nexport {\n GetApplicationsMetadataTaskError,\n InvalidGetFirmwareMetadataResponseError,\n} from \"@api/device-action/task/Errors\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nexport {\n DmkResultFactory,\n DmkResultStatus,\n isSuccessDmkResult,\n} from \"@api/model/DmkResult\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { InstallAppDeviceAction } from \"@api/secure-channel/device-action/InstallApp/InstallAppDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nexport type { InstalledApp } from \"@api/secure-channel/device-action/ListInstalledApps/types\";\nexport { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\nexport { ConnectToSecureChannelTask } from \"@api/secure-channel/task/ConnectToSecureChannelTask\";\nexport { SecureChannelEventType } from \"@api/secure-channel/task/types\";\nexport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport {\n noopLogger,\n noopLoggerFactory,\n} from \"@api/logger-publisher/utils/noopLoggerFactory\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { DefaultLogTagFormatter } from \"@api/logger-subscriber/service/DefaultLogTagFormatter\";\nexport { type LogTagFormatter } from \"@api/logger-subscriber/service/LogTagFormatter\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport {\n DmkNetworkClient,\n type DmkNetworkClientOptions,\n type DmkNetworkResponse,\n type DmkQueryParams,\n type DmkQueryParamValue,\n type DmkRequestConfig,\n type DmkResponseType,\n} from \"@api/network/DmkNetworkClient\";\nexport { DmkNetworkClientError } from \"@api/network/DmkNetworkClientError\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\n DeviceConnectionStateMachine,\n type DeviceConnectionStateMachineParams,\n} from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { formatApduReceivedLog, formatApduSentLog } from \"@api/utils/apduLogs\";\nexport { ApplicationChecker } from \"@api/utils/ApplicationChecker\";\nexport {\n type AppConfig,\n type ApplicationResolver,\n type ResolvedApp,\n} from \"@api/utils/ApplicationResolver\";\nexport { isDashboardName } from \"@api/utils/AppName\";\nexport {\n base64StringToBuffer,\n bufferToBase64String,\n isBase64String,\n} from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
|
|
5
|
+
"mappings": "AAEA,OAAS,QAAAA,MAAY,uBACrB,OAAS,oBAAAC,EAAkB,eAAAC,MAAmB,8BAC9C,OAAS,cAAAC,MAAkB,6BAC3B,WAAc,kCACd,OAAS,oBAAAC,MAAwB,mCACjC,OAAS,mBAAAC,MAAuB,kCAEhC,OACE,8BAAAC,EACA,0BAAAC,MACK,sBACP,OACE,wBAAAC,EACA,uBAAAC,EACA,0BAAAC,MACK,mCACP,OAAS,mBAAAC,MAAuB,kCAChC,OACE,6BAAAC,EAEA,kCAAAC,MAGK,4CACP,OACE,2BAAAC,MAEK,0CACP,OACE,iCAAAC,EACA,sCAAAC,MAIK,gDACP,OACE,qBAAAC,EAEA,2BAAAC,MAEK,0CACP,OACE,uBAAAC,MAEK,sCACP,OAEE,mBAAAC,MAGK,kCACP,OACE,2BAAAC,EAEA,gCAAAC,MAIK,0CACP,OAEE,0BAAAC,MAEK,yCACP,OAEE,kBAAAC,MACK,iCACP,OAAS,sBAAAC,MAA0B,mCACnC,OAAS,gBAAAC,MAAoB,kCAC7B,OACE,iBAAAC,EACA,sBAAAC,EACA,6BAAAC,MACK,wCAC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8BAAAC,OAAkC,kCAC3C,WAAc,aACd,OACE,cAAAC,GACA,qBAAAC,OACK,gDACP,OAAS,YAAAC,OAAgB,wCACzB,OAAS,iBAAAC,OAAqB,+CAC9B,OAAS,0BAAAC,OAA8B,wDAEvC,OAAS,yBAAAC,OAA6B,uDACtC,OACE,oBAAAC,OAOK,gCACP,OAAS,yBAAAC,OAA6B,qCACtC,OAAS,mBAAAC,OAAuB,uCAChC,OACE,gCAAAC,OAEK,oDACP,WAAc,8BACd,OAAS,4BAAAC,OAAgC,gDACzC,OAAS,8BAAAC,OAAkC,qDAC3C,WAAc,aACd,OAAS,yBAAAC,GAAuB,qBAAAC,OAAyB,sBACzD,OAAS,sBAAAC,OAA0B,gCAMnC,OAAS,mBAAAC,OAAuB,qBAChC,OACE,wBAAAC,GACA,wBAAAC,GACA,kBAAAC,OACK,0BACP,OACE,sBAAAC,GACA,sBAAAC,GACA,gBAAAC,OACK",
|
|
6
|
+
"names": ["Apdu", "APDU_MAX_PAYLOAD", "ApduBuilder", "ApduParser", "ByteArrayBuilder", "ByteArrayParser", "InvalidResponseFormatError", "InvalidStatusWordError", "CommandResultFactory", "CommandResultStatus", "isSuccessCommandResult", "CloseAppCommand", "DeleteLanguagePackCommand", "DeleteLanguagePackCommandError", "GetAppAndVersionCommand", "GetBackgroundImageSizeCommand", "GetBackgroundImageSizeCommandError", "BatteryStatusType", "GetBatteryStatusCommand", "GetOsVersionCommand", "ListAppsCommand", "ListLanguagePackCommand", "ListLanguagePackCommandError", "LoadCertificateCommand", "OpenAppCommand", "isCommandErrorCode", "CommandUtils", "GLOBAL_ERRORS", "GlobalCommandError", "GlobalCommandErrorHandler", "DeviceModel", "DeviceModelId", "LEDGER_VENDOR_ID", "DeviceStatus", "DeviceActionStatus", "UserInteractionRequired", "CallTaskInAppDeviceAction", "DEFAULT_UNLOCK_TIMEOUT_MS", "AppAlreadyInstalledDAError", "DeleteLanguagePackDAError", "DeviceLockedError", "DeviceNotOnboardedError", "OutOfMemoryDAError", "RefusedByUserDAError", "UnknownDAError", "UnsupportedFirmwareDAError", "GetDeviceMetadataDeviceAction", "GetDeviceStatusDeviceAction", "GoToDashboardDeviceAction", "InstallLanguagePackageDeviceAction", "InstallOrUpdateAppsDeviceAction", "ListAppsDeviceAction", "ListAppsWithMetadataDeviceAction", "OpenAppDeviceAction", "OpenAppWithDependenciesDeviceAction", "SendCommandInAppDeviceAction", "WaitForAppAndVersionDeviceAction", "GetApplicationsMetadataTaskError", "InvalidGetFirmwareMetadataResponseError", "XStateDeviceAction", "StaticDeviceModelDataSource", "BleDeviceInfos", "TransportDeviceModel", "ApduResponse", "DeviceSessionStateType", "DmkResultFactory", "DmkResultStatus", "isSuccessDmkResult", "GenuineCheckDeviceAction", "InstallAppDeviceAction", "ListInstalledAppsDeviceAction", "UninstallAppDeviceAction", "ConnectToSecureChannelTask", "SecureChannelEventType", "SecureChannelError", "defaultApduReceiverServiceStubBuilder", "defaultApduSenderServiceStubBuilder", "FramerUtils", "DeviceManagementKit", "DeviceManagementKitBuilder", "noopLogger", "noopLoggerFactory", "LogLevel", "ConsoleLogger", "DefaultLogTagFormatter", "WebLogsExporterLogger", "DmkNetworkClient", "DmkNetworkClientError", "ConnectedDevice", "DeviceConnectionStateMachine", "TransportConnectedDevice", "connectedDeviceStubBuilder", "formatApduReceivedLog", "formatApduSentLog", "ApplicationChecker", "isDashboardName", "base64StringToBuffer", "bufferToBase64String", "isBase64String", "bufferToHexaString", "hexaStringToBuffer", "isHexaString"]
|
|
7
7
|
}
|
package/lib/esm/src/api/types.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
4
|
-
"sourcesContent": [],
|
|
5
|
-
"mappings": "",
|
|
6
|
-
"names": []
|
|
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 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 InstallLanguagePackageDAError,\n type InstallLanguagePackageDAInput,\n type InstallLanguagePackageDAIntermediateValue,\n type InstallLanguagePackageDAOutput,\n type InstallLanguagePackageDAState,\n type Language,\n LANGUAGE_ID_TO_LANGUAGE,\n} from \"@api/device-action/os/InstallLanguagePackage/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
|
+
"mappings": "AAqDA,OAOE,2BAAAA,MACK",
|
|
6
|
+
"names": ["LANGUAGE_ID_TO_LANGUAGE"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{gt as
|
|
1
|
+
import{coerce as o,gt as p,gte as r,valid as n}from"semver";class a{isCompatible;version;modelId;appName;constructor(e,i,t){this.modelId=e.deviceModelId,this.appName="currentApp"in e?e.currentApp.name:void 0;const s=t.resolve(e,i);this.isCompatible=s.isCompatible,this.version=s.version}withMinVersionInclusive(e){return r(this.version,e)||(this.isCompatible=!1),this}withMinVersionExclusive(e){return p(this.version,e)||(this.isCompatible=!1),this}withMinVersionInclusiveAcceptingPrerelease(e){const i=n(o(this.version)),t=n(o(e));return(i===null||t===null||!r(i,t))&&(this.isCompatible=!1),this}excludeDeviceModel(e){return this.modelId===e&&(this.isCompatible=!1),this}excludeDeviceModels(...e){for(const i of e)this.excludeDeviceModel(i);return this}excludeApp(e){return this.appName===e&&(this.isCompatible=!1),this}excludeApps(...e){for(const i of e)this.excludeApp(i);return this}check(){return this.isCompatible}}export{a as ApplicationChecker};
|
|
2
2
|
//# sourceMappingURL=ApplicationChecker.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 private readonly appName: string | undefined;\n\n constructor(\n deviceState: DeviceSessionState,\n appConfig: AppConfig,\n resolver: ApplicationResolver,\n ) {\n this.modelId = deviceState.deviceModelId;\n this.appName =\n \"currentApp\" in deviceState ? deviceState.currentApp.name : undefined;\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 excludeDeviceModels(...modelIds: DeviceModelId[]): ApplicationChecker {\n for (const id of modelIds) this.excludeDeviceModel(id);\n return this;\n }\n\n excludeApp(name: string): ApplicationChecker {\n if (this.appName === name) this.isCompatible = false;\n return this;\n }\n\n excludeApps(...names: string[]): ApplicationChecker {\n for (const name of names) this.excludeApp(name);\n return this;\n }\n\n check(): boolean {\n return this.isCompatible;\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,
|
|
6
|
-
"names": ["gt", "gte", "ApplicationChecker", "deviceState", "appConfig", "resolver", "resolved", "version", "modelId", "modelIds", "id", "name", "names"]
|
|
4
|
+
"sourcesContent": ["import { coerce, gt, gte, valid } 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 private readonly appName: string | undefined;\n\n constructor(\n deviceState: DeviceSessionState,\n appConfig: AppConfig,\n resolver: ApplicationResolver,\n ) {\n this.modelId = deviceState.deviceModelId;\n this.appName =\n \"currentApp\" in deviceState ? deviceState.currentApp.name : undefined;\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 /**\n * Like {@link withMinVersionInclusive}, but compares only the release core:\n * prerelease and build tags are stripped from both sides first, so an app\n * reporting `1.23.0-rc2` or `1.23.0-dev` satisfies a `1.23.0` minimum.\n *\n * This accepts a prerelease *of* the minimum, not any prerelease: the core\n * still has to clear the bar, so `1.22.9-rc5` fails a `1.23.0` minimum just\n * as `1.22.9` does. A version neither side can parse fails the check, so an\n * unknown version never passes.\n *\n * Use this when a feature lands in a given release and devices running its\n * release candidates must not be locked out \u2014 device versions reach the SDK\n * verbatim, tags included (`GET APP AND VERSION` yields strings such as\n * `1.4.0-rc2`). Prefer the strict {@link withMinVersionInclusive} when a\n * prerelease genuinely cannot be trusted to carry the feature.\n */\n withMinVersionInclusiveAcceptingPrerelease(\n version: string,\n ): ApplicationChecker {\n const actual = valid(coerce(this.version));\n const minimum = valid(coerce(version));\n if (actual === null || minimum === null || !gte(actual, minimum)) {\n this.isCompatible = false;\n }\n return this;\n }\n\n excludeDeviceModel(modelId: DeviceModelId): ApplicationChecker {\n if (this.modelId === modelId) this.isCompatible = false;\n return this;\n }\n\n excludeDeviceModels(...modelIds: DeviceModelId[]): ApplicationChecker {\n for (const id of modelIds) this.excludeDeviceModel(id);\n return this;\n }\n\n excludeApp(name: string): ApplicationChecker {\n if (this.appName === name) this.isCompatible = false;\n return this;\n }\n\n excludeApps(...names: string[]): ApplicationChecker {\n for (const name of names) this.excludeApp(name);\n return this;\n }\n\n check(): boolean {\n return this.isCompatible;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,UAAAA,EAAQ,MAAAC,EAAI,OAAAC,EAAK,SAAAC,MAAa,SAUhC,MAAMC,CAAmB,CACtB,aACA,QACA,QACS,QAEjB,YACEC,EACAC,EACAC,EACA,CACA,KAAK,QAAUF,EAAY,cAC3B,KAAK,QACH,eAAgBA,EAAcA,EAAY,WAAW,KAAO,OAC9D,MAAMG,EAAWD,EAAS,QAAQF,EAAaC,CAAS,EACxD,KAAK,aAAeE,EAAS,aAC7B,KAAK,QAAUA,EAAS,OAC1B,CAEA,wBAAwBC,EAAqC,CAC3D,OAAKP,EAAI,KAAK,QAASO,CAAO,IAAG,KAAK,aAAe,IAC9C,IACT,CAEA,wBAAwBA,EAAqC,CAC3D,OAAKR,EAAG,KAAK,QAASQ,CAAO,IAAG,KAAK,aAAe,IAC7C,IACT,CAkBA,2CACEA,EACoB,CACpB,MAAMC,EAASP,EAAMH,EAAO,KAAK,OAAO,CAAC,EACnCW,EAAUR,EAAMH,EAAOS,CAAO,CAAC,EACrC,OAAIC,IAAW,MAAQC,IAAY,MAAQ,CAACT,EAAIQ,EAAQC,CAAO,KAC7D,KAAK,aAAe,IAEf,IACT,CAEA,mBAAmBC,EAA4C,CAC7D,OAAI,KAAK,UAAYA,IAAS,KAAK,aAAe,IAC3C,IACT,CAEA,uBAAuBC,EAA+C,CACpE,UAAWC,KAAMD,EAAU,KAAK,mBAAmBC,CAAE,EACrD,OAAO,IACT,CAEA,WAAWC,EAAkC,CAC3C,OAAI,KAAK,UAAYA,IAAM,KAAK,aAAe,IACxC,IACT,CAEA,eAAeC,EAAqC,CAClD,UAAWD,KAAQC,EAAO,KAAK,WAAWD,CAAI,EAC9C,OAAO,IACT,CAEA,OAAiB,CACf,OAAO,KAAK,YACd,CACF",
|
|
6
|
+
"names": ["coerce", "gt", "gte", "valid", "ApplicationChecker", "deviceState", "appConfig", "resolver", "resolved", "version", "actual", "minimum", "modelId", "modelIds", "id", "name", "names"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DeviceModelId as
|
|
1
|
+
import{DeviceModelId as c}from"../device/DeviceModel";import{DeviceStatus as n}from"../device/DeviceStatus";import{DeviceSessionStateType as l}from"../device-session/DeviceSessionState";import{ApplicationChecker as r}from"./ApplicationChecker";describe("ApplicationChecker",()=>{function i(e=c.FLEX){return{sessionStateType:l.ReadyWithoutSecureChannel,deviceStatus:n.CONNECTED,installedApps:[],currentApp:{name:"TestApp",version:"1.0.0"},deviceModelId:e,isSecureConnectionAllowed:!1}}function s(e){return{resolve:()=>e}}const o={version:"1.0.0"};it("should pass check when resolved as compatible",()=>{const e=s({isCompatible:!0,version:"1.12.0"}),t=new r(i(),o,e).check();expect(t).toStrictEqual(!0)}),it("should reject check when resolved as incompatible",()=>{const e=s({isCompatible:!1,version:"0.0.1"}),t=new r(i(),o,e).check();expect(t).toStrictEqual(!1)}),it("should pass with min version inclusive when version matches",()=>{const e=s({isCompatible:!0,version:"1.12.0"}),t=new r(i(),o,e).withMinVersionInclusive("1.12.0").check();expect(t).toStrictEqual(!0)}),it("should reject with min version inclusive when version is too low",()=>{const e=s({isCompatible:!0,version:"1.11.0"}),t=new r(i(),o,e).withMinVersionInclusive("1.12.0").check();expect(t).toStrictEqual(!1)}),it("should pass with min version exclusive when version is greater",()=>{const e=s({isCompatible:!0,version:"1.13.0"}),t=new r(i(),o,e).withMinVersionExclusive("1.12.0").check();expect(t).toStrictEqual(!0)}),it("should reject with min version exclusive when version is equal",()=>{const e=s({isCompatible:!0,version:"1.12.0"}),t=new r(i(),o,e).withMinVersionExclusive("1.12.0").check();expect(t).toStrictEqual(!1)}),it("should pass when device model is not excluded",()=>{const e=s({isCompatible:!0,version:"1.12.0"}),t=new r(i(c.FLEX),o,e).excludeDeviceModel(c.NANO_S).check();expect(t).toStrictEqual(!0)}),it("should reject when device model is excluded",()=>{const e=s({isCompatible:!0,version:"1.12.0"}),t=new r(i(c.FLEX),o,e).excludeDeviceModel(c.FLEX).check();expect(t).toStrictEqual(!1)}),it("should pass with chained conditions when all are met",()=>{const e=s({isCompatible:!0,version:"1.12.0"}),t=new r(i(),o,e).withMinVersionInclusive("1.11.0").excludeDeviceModel(c.NANO_S).check();expect(t).toStrictEqual(!0)}),it("should reject with chained conditions when one fails",()=>{const e=s({isCompatible:!0,version:"1.10.0"}),t=new r(i(),o,e).withMinVersionInclusive("1.11.0").excludeDeviceModel(c.NANO_S).check();expect(t).toStrictEqual(!1)}),describe("withMinVersionInclusiveAcceptingPrerelease",()=>{it("should accept a release candidate of the minimum",()=>{const e=s({isCompatible:!0,version:"1.23.0-rc2"}),t=new r(i(),o,e).withMinVersionInclusiveAcceptingPrerelease("1.23.0").check();expect(t).toStrictEqual(!0)}),it("should accept a dev build of the minimum",()=>{const e=s({isCompatible:!0,version:"1.23.0-dev"}),t=new r(i(),o,e).withMinVersionInclusiveAcceptingPrerelease("1.23.0").check();expect(t).toStrictEqual(!0)}),it("should accept a plain version equal to the minimum",()=>{const e=s({isCompatible:!0,version:"1.23.0"}),t=new r(i(),o,e).withMinVersionInclusiveAcceptingPrerelease("1.23.0").check();expect(t).toStrictEqual(!0)}),it("should accept a plain version above the minimum",()=>{const e=s({isCompatible:!0,version:"1.24.0"}),t=new r(i(),o,e).withMinVersionInclusiveAcceptingPrerelease("1.23.0").check();expect(t).toStrictEqual(!0)}),it("should reject a plain version below the minimum",()=>{const e=s({isCompatible:!0,version:"1.22.9"}),t=new r(i(),o,e).withMinVersionInclusiveAcceptingPrerelease("1.23.0").check();expect(t).toStrictEqual(!1)}),it("should reject a prerelease whose release core is below the minimum",()=>{const e=s({isCompatible:!0,version:"1.22.9-rc5"}),t=new r(i(),o,e).withMinVersionInclusiveAcceptingPrerelease("1.23.0").check();expect(t).toStrictEqual(!1)}),it("should reject a version that cannot be parsed",()=>{const e=s({isCompatible:!0,version:"not-a-version"}),t=new r(i(),o,e).withMinVersionInclusiveAcceptingPrerelease("1.23.0").check();expect(t).toStrictEqual(!1)}),it("should reject a minimum that cannot be parsed",()=>{const e=s({isCompatible:!0,version:"1.23.0"}),t=new r(i(),o,e).withMinVersionInclusiveAcceptingPrerelease("not-a-version").check();expect(t).toStrictEqual(!1)}),it("should not override incompatible resolution",()=>{const e=s({isCompatible:!1,version:"1.23.0-rc2"}),t=new r(i(),o,e).withMinVersionInclusiveAcceptingPrerelease("1.23.0").check();expect(t).toStrictEqual(!1)})}),it("should not override incompatible resolution even if constraints pass",()=>{const e=s({isCompatible:!1,version:"1.15.0"}),t=new r(i(),o,e).withMinVersionInclusive("1.12.0").check();expect(t).toStrictEqual(!1)})});
|
|
2
2
|
//# sourceMappingURL=ApplicationChecker.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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,OAAS,iBAAAA,MAAqB,0BAC9B,OAAS,gBAAAC,MAAoB,2BAC7B,OAAS,0BAAAC,MAA8B,yCAEvC,OAAS,sBAAAC,MAA0B,uB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EACAC,CACF,EACG,wBAAwB,QAAQ,EAChC,mBAAmBT,EAAc,MAAM,EACvC,MAAM,EACT,OAAOU,CAAM,EAAE,cAAc,EAAK,CACpC,CAAC,EAED,GAAG,uEAAwE,IAAM,CAC/E,MAAMD,EAAWH,EAAmB,CAClC,aAAc,GACd,QAAS,QACX,CAAC,EACKI,EAAS,IAAIP,EACjBC,EAAiB,EACjBI,EACAC,CACF,EACG,wBAAwB,QAAQ,EAChC,MAAM,EACT,OAAOC,CAAM,EAAE,cAAc,EAAK,CACpC,CAAC,CACH,CAAC",
|
|
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 describe(\"withMinVersionInclusiveAcceptingPrerelease\", () => {\n it(\"should accept a release candidate of the minimum\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.23.0-rc2\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusiveAcceptingPrerelease(\"1.23.0\")\n .check();\n expect(result).toStrictEqual(true);\n });\n\n it(\"should accept a dev build of the minimum\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.23.0-dev\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusiveAcceptingPrerelease(\"1.23.0\")\n .check();\n expect(result).toStrictEqual(true);\n });\n\n it(\"should accept a plain version equal to the minimum\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.23.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusiveAcceptingPrerelease(\"1.23.0\")\n .check();\n expect(result).toStrictEqual(true);\n });\n\n it(\"should accept a plain version above the minimum\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.24.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusiveAcceptingPrerelease(\"1.23.0\")\n .check();\n expect(result).toStrictEqual(true);\n });\n\n it(\"should reject a plain version below the minimum\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.22.9\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusiveAcceptingPrerelease(\"1.23.0\")\n .check();\n expect(result).toStrictEqual(false);\n });\n\n it(\"should reject a prerelease whose release core is below the minimum\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.22.9-rc5\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusiveAcceptingPrerelease(\"1.23.0\")\n .check();\n expect(result).toStrictEqual(false);\n });\n\n it(\"should reject a version that cannot be parsed\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"not-a-version\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusiveAcceptingPrerelease(\"1.23.0\")\n .check();\n expect(result).toStrictEqual(false);\n });\n\n it(\"should reject a minimum that cannot be parsed\", () => {\n const resolver = createMockResolver({\n isCompatible: true,\n version: \"1.23.0\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusiveAcceptingPrerelease(\"not-a-version\")\n .check();\n expect(result).toStrictEqual(false);\n });\n\n it(\"should not override incompatible resolution\", () => {\n const resolver = createMockResolver({\n isCompatible: false,\n version: \"1.23.0-rc2\",\n });\n const result = new ApplicationChecker(\n createReadyState(),\n appConfig,\n resolver,\n )\n .withMinVersionInclusiveAcceptingPrerelease(\"1.23.0\")\n .check();\n expect(result).toStrictEqual(false);\n });\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,OAAS,iBAAAA,MAAqB,0BAC9B,OAAS,gBAAAC,MAAo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ceStatus", "DeviceSessionStateType", "ApplicationChecker", "createReadyState", "modelId", "createMockResolver", "resolved", "appConfig", "resolver", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{bufferToHexaString as
|
|
1
|
+
import{bufferToHexaString as t}from"./HexaString";function i(e){return`[will send APDU] ~...> ${t(e,!1)}`}function u(e){return`[exchange] => ${t(e,!1)}`}function a(e){return`[exchange] <= ${t(e.data,!1)}${t(e.statusCode,!1)}`}const g="apdu-exchange";function f(e,n,r){const s=t(n,!1),o=`${t(r.data,!1)}${t(r.statusCode,!1)}`;return{message:a(r),data:{type:g,sessionId:e,apdu:s,response:o}}}export{g as APDU_EXCHANGE_LOG,f as formatApduExchangeLog,a as formatApduReceivedLog,i as formatApduSendingLog,u as formatApduSentLog};
|
|
2
2
|
//# sourceMappingURL=apduLogs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/api/utils/apduLogs.ts"],
|
|
4
|
-
"sourcesContent": ["import { type ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport { bufferToHexaString } from \"./HexaString\";\n\n/**\n * Formats the log message for an APDU that is about to be sent.\n * Only call this at the device session layer, before calling sendApdu on the connected device.\n */\nexport function formatApduSendingLog(apdu: Uint8Array): string {\n return `[will send APDU] ~...> ${bufferToHexaString(apdu, false)}`;\n}\n\n/**\n * Formats the log message for an APDU that was sent.\n * Only call this at the transport layer, after the APDU sending logic has been executed\n * without any error.\n */\nexport function formatApduSentLog(apdu: Uint8Array): string {\n return `[exchange] => ${bufferToHexaString(apdu, false)}`;\n}\n\n/**\n * Formats the log message for an APDU response received from the device.\n */\nexport function formatApduReceivedLog(apduResponse: ApduResponse): string {\n return `[exchange] <= ${bufferToHexaString(apduResponse.data, false)}${bufferToHexaString(apduResponse.statusCode, false)}`;\n}\n"],
|
|
5
|
-
"mappings": "AAEA,OAAS,sBAAAA,MAA0B,eAM5B,SAASC,EAAqBC,EAA0B,CAC7D,MAAO,0BAA0BF,EAAmBE,EAAM,EAAK,CAAC,EAClE,CAOO,SAASC,EAAkBD,EAA0B,CAC1D,MAAO,iBAAiBF,EAAmBE,EAAM,EAAK,CAAC,EACzD,CAKO,SAASE,EAAsBC,EAAoC,CACxE,MAAO,iBAAiBL,EAAmBK,EAAa,KAAM,EAAK,CAAC,GAAGL,EAAmBK,EAAa,WAAY,EAAK,CAAC,EAC3H",
|
|
6
|
-
"names": ["bufferToHexaString", "formatApduSendingLog", "apdu", "formatApduSentLog", "formatApduReceivedLog", "apduResponse"]
|
|
4
|
+
"sourcesContent": ["import { type ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport { bufferToHexaString } from \"./HexaString\";\n\n/**\n * Formats the log message for an APDU that is about to be sent.\n * Only call this at the device session layer, before calling sendApdu on the connected device.\n */\nexport function formatApduSendingLog(apdu: Uint8Array): string {\n return `[will send APDU] ~...> ${bufferToHexaString(apdu, false)}`;\n}\n\n/**\n * Formats the log message for an APDU that was sent.\n * Only call this at the transport layer, after the APDU sending logic has been executed\n * without any error.\n */\nexport function formatApduSentLog(apdu: Uint8Array): string {\n return `[exchange] => ${bufferToHexaString(apdu, false)}`;\n}\n\n/**\n * Formats the log message for an APDU response received from the device.\n */\nexport function formatApduReceivedLog(apduResponse: ApduResponse): string {\n return `[exchange] <= ${bufferToHexaString(apduResponse.data, false)}${bufferToHexaString(apduResponse.statusCode, false)}`;\n}\n\nexport const APDU_EXCHANGE_LOG = \"apdu-exchange\";\n\nexport type ApduExchangeLog = {\n type: typeof APDU_EXCHANGE_LOG;\n sessionId: string;\n apdu: string;\n response: string;\n};\n\n/**\n * Formats the log message and builds the structured `data` payload for a completed APDU exchange\n * (request + response).\n */\nexport function formatApduExchangeLog(\n sessionId: string,\n apdu: Uint8Array,\n apduResponse: ApduResponse,\n): { message: string; data: ApduExchangeLog } {\n const request = bufferToHexaString(apdu, false);\n const response = `${bufferToHexaString(apduResponse.data, false)}${bufferToHexaString(apduResponse.statusCode, false)}`;\n return {\n message: formatApduReceivedLog(apduResponse),\n data: { type: APDU_EXCHANGE_LOG, sessionId, apdu: request, response },\n };\n}\n"],
|
|
5
|
+
"mappings": "AAEA,OAAS,sBAAAA,MAA0B,eAM5B,SAASC,EAAqBC,EAA0B,CAC7D,MAAO,0BAA0BF,EAAmBE,EAAM,EAAK,CAAC,EAClE,CAOO,SAASC,EAAkBD,EAA0B,CAC1D,MAAO,iBAAiBF,EAAmBE,EAAM,EAAK,CAAC,EACzD,CAKO,SAASE,EAAsBC,EAAoC,CACxE,MAAO,iBAAiBL,EAAmBK,EAAa,KAAM,EAAK,CAAC,GAAGL,EAAmBK,EAAa,WAAY,EAAK,CAAC,EAC3H,CAEO,MAAMC,EAAoB,gBAa1B,SAASC,EACdC,EACAN,EACAG,EAC4C,CAC5C,MAAMI,EAAUT,EAAmBE,EAAM,EAAK,EACxCQ,EAAW,GAAGV,EAAmBK,EAAa,KAAM,EAAK,CAAC,GAAGL,EAAmBK,EAAa,WAAY,EAAK,CAAC,GACrH,MAAO,CACL,QAASD,EAAsBC,CAAY,EAC3C,KAAM,CAAE,KAAMC,EAAmB,UAAAE,EAAW,KAAMC,EAAS,SAAAC,CAAS,CACtE,CACF",
|
|
6
|
+
"names": ["bufferToHexaString", "formatApduSendingLog", "apdu", "formatApduSentLog", "formatApduReceivedLog", "apduResponse", "APDU_EXCHANGE_LOG", "formatApduExchangeLog", "sessionId", "request", "response"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{describe as
|
|
1
|
+
import{describe as a,expect as t,it as o}from"vitest";import{APDU_EXCHANGE_LOG as p,formatApduExchangeLog as x,formatApduReceivedLog as d,formatApduSendingLog as u,formatApduSentLog as m}from"./apduLogs";a("apduLogs",()=>{a("formatApduSendingLog",()=>{o("should format APDU with correct format before sending",()=>{const e=Uint8Array.from([224,1,0,0,4]);t(u(e)).toBe("[will send APDU] ~...> e001000004")}),o("should handle empty APDU",()=>{const e=Uint8Array.from([]);t(u(e)).toBe("[will send APDU] ~...> ")})}),a("formatApduSentLog",()=>{o("should format APDU with correct format after sending",()=>{const e=Uint8Array.from([224,1,0,0,4]);t(m(e)).toBe("[exchange] => e001000004")}),o("should handle empty APDU",()=>{const e=Uint8Array.from([]);t(m(e)).toBe("[exchange] => ")})}),a("formatApduReceivedLog",()=>{o("should format APDU response with data and status code",()=>{const e={data:Uint8Array.from([1,2,3]),statusCode:Uint8Array.from([144,0])};t(d(e)).toBe("[exchange] <= 0102039000")}),o("should format APDU response with only status code when data is empty",()=>{const e={data:Uint8Array.from([]),statusCode:Uint8Array.from([144,0])};t(d(e)).toBe("[exchange] <= 9000")}),o("should format error status code correctly",()=>{const e={data:Uint8Array.from([]),statusCode:Uint8Array.from([105,133])};t(d(e)).toBe("[exchange] <= 6985")})}),a("formatApduExchangeLog",()=>{o("should keep the legacy received-log message and expose structured data",()=>{const e=Uint8Array.from([224,1,0,0,4]),r={data:Uint8Array.from([1,2,3]),statusCode:Uint8Array.from([144,0])},{message:s,data:n}=x("session-1",e,r);t(s).toBe(d(r)),t(s).toBe("[exchange] <= 0102039000"),t(n).toEqual({type:p,sessionId:"session-1",apdu:"e001000004",response:"0102039000"})}),o("should concatenate empty data with the status word in the structured payload",()=>{const e=Uint8Array.from([176,1,0,0]),r={data:Uint8Array.from([]),statusCode:Uint8Array.from([85,21])},{message:s,data:n}=x("session-2",e,r);t(s).toBe("[exchange] <= 5515"),t(n.apdu).toBe("b0010000"),t(n.response).toBe("5515")})})});
|
|
2
2
|
//# sourceMappingURL=apduLogs.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/api/utils/apduLogs.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { describe, expect, it } from \"vitest\";\n\nimport {\n formatApduReceivedLog,\n formatApduSendingLog,\n formatApduSentLog,\n} from \"./apduLogs\";\n\ndescribe(\"apduLogs\", () => {\n describe(\"formatApduSendingLog\", () => {\n it(\"should format APDU with correct format before sending\", () => {\n const apdu = Uint8Array.from([0xe0, 0x01, 0x00, 0x00, 0x04]);\n expect(formatApduSendingLog(apdu)).toBe(\n \"[will send APDU] ~...> e001000004\",\n );\n });\n\n it(\"should handle empty APDU\", () => {\n const apdu = Uint8Array.from([]);\n expect(formatApduSendingLog(apdu)).toBe(\"[will send APDU] ~...> \");\n });\n });\n\n describe(\"formatApduSentLog\", () => {\n it(\"should format APDU with correct format after sending\", () => {\n const apdu = Uint8Array.from([0xe0, 0x01, 0x00, 0x00, 0x04]);\n expect(formatApduSentLog(apdu)).toBe(\"[exchange] => e001000004\");\n });\n\n it(\"should handle empty APDU\", () => {\n const apdu = Uint8Array.from([]);\n expect(formatApduSentLog(apdu)).toBe(\"[exchange] => \");\n });\n });\n\n describe(\"formatApduReceivedLog\", () => {\n it(\"should format APDU response with data and status code\", () => {\n const apduResponse = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n statusCode: Uint8Array.from([0x90, 0x00]),\n };\n expect(formatApduReceivedLog(apduResponse)).toBe(\n \"[exchange] <= 0102039000\",\n );\n });\n\n it(\"should format APDU response with only status code when data is empty\", () => {\n const apduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]),\n };\n expect(formatApduReceivedLog(apduResponse)).toBe(\"[exchange] <= 9000\");\n });\n\n it(\"should format error status code correctly\", () => {\n const apduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x69, 0x85]),\n };\n expect(formatApduReceivedLog(apduResponse)).toBe(\"[exchange] <= 6985\");\n });\n });\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,YAAAA,EAAU,UAAAC,EAAQ,MAAAC,MAAU,SAErC,OACE,yBAAAC,EACA,wBAAAC,EACA,qBAAAC,MACK,
|
|
6
|
-
"names": ["describe", "expect", "it", "formatApduReceivedLog", "formatApduSendingLog", "formatApduSentLog", "apdu", "apduResponse"]
|
|
4
|
+
"sourcesContent": ["import { describe, expect, it } from \"vitest\";\n\nimport {\n APDU_EXCHANGE_LOG,\n formatApduExchangeLog,\n formatApduReceivedLog,\n formatApduSendingLog,\n formatApduSentLog,\n} from \"./apduLogs\";\n\ndescribe(\"apduLogs\", () => {\n describe(\"formatApduSendingLog\", () => {\n it(\"should format APDU with correct format before sending\", () => {\n const apdu = Uint8Array.from([0xe0, 0x01, 0x00, 0x00, 0x04]);\n expect(formatApduSendingLog(apdu)).toBe(\n \"[will send APDU] ~...> e001000004\",\n );\n });\n\n it(\"should handle empty APDU\", () => {\n const apdu = Uint8Array.from([]);\n expect(formatApduSendingLog(apdu)).toBe(\"[will send APDU] ~...> \");\n });\n });\n\n describe(\"formatApduSentLog\", () => {\n it(\"should format APDU with correct format after sending\", () => {\n const apdu = Uint8Array.from([0xe0, 0x01, 0x00, 0x00, 0x04]);\n expect(formatApduSentLog(apdu)).toBe(\"[exchange] => e001000004\");\n });\n\n it(\"should handle empty APDU\", () => {\n const apdu = Uint8Array.from([]);\n expect(formatApduSentLog(apdu)).toBe(\"[exchange] => \");\n });\n });\n\n describe(\"formatApduReceivedLog\", () => {\n it(\"should format APDU response with data and status code\", () => {\n const apduResponse = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n statusCode: Uint8Array.from([0x90, 0x00]),\n };\n expect(formatApduReceivedLog(apduResponse)).toBe(\n \"[exchange] <= 0102039000\",\n );\n });\n\n it(\"should format APDU response with only status code when data is empty\", () => {\n const apduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]),\n };\n expect(formatApduReceivedLog(apduResponse)).toBe(\"[exchange] <= 9000\");\n });\n\n it(\"should format error status code correctly\", () => {\n const apduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x69, 0x85]),\n };\n expect(formatApduReceivedLog(apduResponse)).toBe(\"[exchange] <= 6985\");\n });\n });\n\n describe(\"formatApduExchangeLog\", () => {\n it(\"should keep the legacy received-log message and expose structured data\", () => {\n const apdu = Uint8Array.from([0xe0, 0x01, 0x00, 0x00, 0x04]);\n const apduResponse = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n statusCode: Uint8Array.from([0x90, 0x00]),\n };\n\n const { message, data } = formatApduExchangeLog(\n \"session-1\",\n apdu,\n apduResponse,\n );\n\n expect(message).toBe(formatApduReceivedLog(apduResponse));\n expect(message).toBe(\"[exchange] <= 0102039000\");\n expect(data).toEqual({\n type: APDU_EXCHANGE_LOG,\n sessionId: \"session-1\",\n apdu: \"e001000004\",\n response: \"0102039000\",\n });\n });\n\n it(\"should concatenate empty data with the status word in the structured payload\", () => {\n const apdu = Uint8Array.from([0xb0, 0x01, 0x00, 0x00]);\n const apduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x55, 0x15]),\n };\n\n const { message, data } = formatApduExchangeLog(\n \"session-2\",\n apdu,\n apduResponse,\n );\n\n expect(message).toBe(\"[exchange] <= 5515\");\n expect(data.apdu).toBe(\"b0010000\");\n expect(data.response).toBe(\"5515\");\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,YAAAA,EAAU,UAAAC,EAAQ,MAAAC,MAAU,SAErC,OACE,qBAAAC,EACA,yBAAAC,EACA,yBAAAC,EACA,wBAAAC,EACA,qBAAAC,MACK,aAEPP,EAAS,WAAY,IAAM,CACzBA,EAAS,uBAAwB,IAAM,CACrCE,EAAG,wDAAyD,IAAM,CAChE,MAAMM,EAAO,WAAW,KAAK,CAAC,IAAM,EAAM,EAAM,EAAM,CAAI,CAAC,EAC3DP,EAAOK,EAAqBE,CAAI,CAAC,EAAE,KACjC,mCACF,CACF,CAAC,EAEDN,EAAG,2BAA4B,IAAM,CACnC,MAAMM,EAAO,WAAW,KAAK,CAAC,CAAC,EAC/BP,EAAOK,EAAqBE,CAAI,CAAC,EAAE,KAAK,yBAAyB,CACnE,CAAC,CACH,CAAC,EAEDR,EAAS,oBAAqB,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I,CAAC,CAC1C,EAEM,CAAE,QAAAC,EAAS,KAAAC,CAAK,EAAIP,EACxB,YACAI,EACAC,CACF,EAEAR,EAAOS,CAAO,EAAE,KAAKL,EAAsBI,CAAY,CAAC,EACxDR,EAAOS,CAAO,EAAE,KAAK,0BAA0B,EAC/CT,EAAOU,CAAI,EAAE,QAAQ,CACnB,KAAMR,EACN,UAAW,YACX,KAAM,aACN,SAAU,YACZ,CAAC,CACH,CAAC,EAEDD,EAAG,+EAAgF,IAAM,CACvF,MAAMM,EAAO,WAAW,KAAK,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAC/CC,EAAe,CACnB,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,GAAM,EAAI,CAAC,CAC1C,EAEM,CAAE,QAAAC,EAAS,KAAAC,CAAK,EAAIP,EACxB,YACAI,EACAC,CACF,EAEAR,EAAOS,CAAO,EAAE,KAAK,oBAAoB,EACzCT,EAAOU,EAAK,IAAI,EAAE,KAAK,UAAU,EACjCV,EAAOU,EAAK,QAAQ,EAAE,KAAK,MAAM,CACnC,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["describe", "expect", "it", "APDU_EXCHANGE_LOG", "formatApduExchangeLog", "formatApduReceivedLog", "formatApduSendingLog", "formatApduSentLog", "apdu", "apduResponse", "message", "data"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{transportDiTypes as t}from"./internal/transport/di/transportDiTypes";import{makeContainer as e}from"./di";describe("makeContainer",()=>{it("should default mockUrl to the hosted mock server",()=>{const o=e({}).get(t.DmkConfig);expect(o.mockUrl).toBe("https://device-mock-server.aws.ldg-ps-default.ldg-tech.com")})});
|
|
2
|
+
//# sourceMappingURL=di.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/di.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { type DmkConfig } from \"@api/DmkConfig\";\nimport { transportDiTypes } from \"@internal/transport/di/transportDiTypes\";\n\nimport { makeContainer } from \"./di\";\n\ndescribe(\"makeContainer\", () => {\n it(\"should default mockUrl to the hosted mock server\", () => {\n const container = makeContainer({});\n const transportConfig = container.get<DmkConfig>(\n transportDiTypes.DmkConfig,\n );\n\n expect(transportConfig.mockUrl).toBe(\n \"https://device-mock-server.aws.ldg-ps-default.ldg-tech.com\",\n );\n });\n});\n"],
|
|
5
|
+
"mappings": "AACA,OAAS,oBAAAA,MAAwB,0CAEjC,OAAS,iBAAAC,MAAqB,OAE9B,SAAS,gBAAiB,IAAM,CAC9B,GAAG,mDAAoD,IAAM,CAE3D,MAAMC,EADYD,EAAc,CAAC,CAAC,EACA,IAChCD,EAAiB,SACnB,EAEA,OAAOE,EAAgB,OAAO,EAAE,KAC9B,4DACF,CACF,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["transportDiTypes", "makeContainer", "transportConfig"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{BehaviorSubject as h,from as d,lastValueFrom as p,timeout as v}from"rxjs";import{v4 as m}from"uuid";import{CommandUtils as S}from"../../../api/command/utils/CommandUtils";import{DeviceStatus as l}from"../../../api/device/DeviceStatus";import{DeviceSessionStateType as D}from"../../../api/device-session/DeviceSessionState";import{SendApduTimeoutError as _,SendCommandTimeoutError as g}from"../../../api/transport/model/Errors";import{
|
|
1
|
+
import{BehaviorSubject as h,from as d,lastValueFrom as p,timeout as v}from"rxjs";import{v4 as m}from"uuid";import{CommandUtils as S}from"../../../api/command/utils/CommandUtils";import{DeviceStatus as l}from"../../../api/device/DeviceStatus";import{DeviceSessionStateType as D}from"../../../api/device-session/DeviceSessionState";import{SendApduTimeoutError as _,SendCommandTimeoutError as g}from"../../../api/transport/model/Errors";import{formatApduExchangeLog as f,formatApduSendingLog as E}from"../../../api/utils/apduLogs";import{DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS as b}from"../../device-session/data/DeviceSessionRefresherConst";import{IntentQueueService as A}from"../../device-session/service/IntentQueueService";import{RefresherService as C}from"../../device-session/service/RefresherService";import{DevicePinger as y}from"./DevicePinger";import{DeviceSessionEventDispatcher as R,SessionEvents as c}from"./DeviceSessionEventDispatcher";import{DeviceSessionRefresher as I}from"./DeviceSessionRefresher";import{DeviceSessionStateHandler as O}from"./DeviceSessionStateHandler";class K{_id;_connectedDevice;_deviceState;_managerApiService;_secureChannelService;_logger;_loggerModuleFactory;_refresherOptions;_pinger;_deviceSessionRefresher;_refresherService;_intentQueueService;_sessionEventDispatcher=new R;_bypassIntentQueue=!1;constructor({connectedDevice:e,id:t=m()},i,s,n,r,a=o=>new A(i,o)){this._id=t,this._connectedDevice=e,this._loggerModuleFactory=i,this._logger=i("device-session"),this._managerApiService=s,this._intentQueueService=a(this._sessionEventDispatcher),this._secureChannelService=n,this._refresherOptions={...b,...r},this._deviceState=new h({sessionStateType:D.Connected,deviceStatus:l.CONNECTED,deviceModelId:this._connectedDevice.deviceModel.id}),this._pinger=new y(i,e,this._sessionEventDispatcher,(o,u)=>this.sendCommand(o,u)),this._deviceSessionRefresher=new I(i,this._refresherOptions,this._sessionEventDispatcher,this._connectedDevice),new O(i,this._sessionEventDispatcher,this._connectedDevice,this._deviceState,o=>this.setDeviceSessionState(o)),this._refresherService=new C(i,{start:()=>this._deviceSessionRefresher.restartRefresher(),stop:()=>this._deviceSessionRefresher.stopRefresher()})}async initialiseSession(){try{this._refresherOptions.isRefresherDisabled?await this._pinger.ping():this._deviceSessionRefresher.startRefresher()}catch(e){throw this._logger.error("Error while initialising session",{data:{error:e}}),e}}get id(){return this._id}get connectedDevice(){return this._connectedDevice}get state(){return this._deviceState.asObservable()}getDeviceSessionState(){return this._deviceState.getValue()}setDeviceSessionState(e){this._deviceState.next(e)}sendApdu(e,t={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){return this._bypassIntentQueue?this._unsafeInternalSendApdu(e,t):this._internalSendApdu(e,t)}_internalSendApdu(e,t){const i=t.abortTimeout,s=Date.now(),{observable:n,cancel:r}=this._intentQueueService.enqueue({type:"send-apdu",execute:()=>d((async()=>{const o=Date.now()-s;return await this._unsafeInternalSendApdu(e,{isPolling:t.isPolling,triggersDisconnection:t.triggersDisconnection,abortTimeout:i?i-o:void 0})})())}),a=i?n.pipe(v({each:i,with:()=>{throw r(),new _}})):n;return p(a)}async _unsafeInternalSendApdu(e,t={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){return this._logger.debug(E(e)),(await this._connectedDevice.sendApdu(e,t.triggersDisconnection,t.abortTimeout)).ifRight(s=>{const{message:n,data:r}=f(this._id,e,s);this._logger.debug(n,{data:r}),S.isLockedDeviceResponse(s)?this._sessionEventDispatcher.dispatch({eventName:c.DEVICE_STATE_UPDATE_LOCKED}):this._sessionEventDispatcher.dispatch({eventName:c.DEVICE_STATE_UPDATE_CONNECTED})}).ifLeft(()=>{this._sessionEventDispatcher.dispatch({eventName:c.DEVICE_STATE_UPDATE_UNKNOWN})})}sendCommand(e,t){return this._logger.debug(`[sendCommand] ${e.name}`),this._bypassIntentQueue?this._unsafeInternalSendCommand(e,t):this._internalSendCommand(e,t)}_internalSendCommand(e,t){const i=Date.now(),{observable:s,cancel:n}=this._intentQueueService.enqueue({type:"send-command",execute:()=>d((async()=>{const a=Date.now()-i;return await this._unsafeInternalSendCommand(e,t?t-a:void 0)})())}),r=t?s.pipe(v({each:t,with:()=>{throw n(),new g}})):s;return p(r)}async _unsafeInternalSendCommand(e,t){const i=e.getApdu();return(await this._unsafeInternalSendApdu(i.getRawApdu(),{isPolling:!1,triggersDisconnection:e.triggersDisconnection??!1,abortTimeout:t})).caseOf({Left:n=>{throw this._logger.error("[sendCommand] error",{data:{err:n}}),n},Right:n=>{const r=e.parseResponse(n,this._connectedDevice.deviceModel.id);return this._logger.debug("[sendCommand] result",{data:{result:r}}),r}})}executeDeviceAction(e){return this._bypassIntentQueue?this._unsafeInternalExecuteDeviceAction(e):this._internalExecuteDeviceAction(e)}_internalExecuteDeviceAction(e){let t;const{observable:i,cancel:s}=this._intentQueueService.enqueue({type:"device-action",execute:()=>{const{observable:n,cancel:r}=this._unsafeInternalExecuteDeviceAction(e);return t=r,n}});return{observable:i,cancel:()=>{t?.(),s()}}}_unsafeInternalExecuteDeviceAction(e){const{observable:t,cancel:i}=e._execute({sendApdu:async s=>this._unsafeInternalSendApdu(s),sendCommand:async s=>this._unsafeInternalSendCommand(s),getDeviceModel:()=>this._connectedDevice.deviceModel,getDeviceSessionState:()=>this._deviceState.getValue(),getDeviceSessionStateObservable:()=>this.state,setDeviceSessionState:s=>(this.setDeviceSessionState(s),this._deviceState.getValue()),getManagerApiService:()=>this._managerApiService,getSecureChannelService:()=>this._secureChannelService,loggerFactory:this._loggerModuleFactory});return{observable:t,cancel:i}}close(){this._updateDeviceStatus(l.NOT_CONNECTED),this._deviceState.complete(),this._deviceSessionRefresher.stopRefresher(),this._pinger.unsubscribe()}disableRefresher(e){return this._refresherService.disableRefresher(e)}_unsafeBypassIntentQueue(e){this._bypassIntentQueue=e}_updateDeviceStatus(e){const t=this._deviceState.getValue();this._deviceState.next({...t,deviceStatus:e})}}export{K as DeviceSession};
|
|
2
2
|
//# sourceMappingURL=DeviceSession.js.map
|