@ledgerhq/device-management-kit 0.0.0-develop-20250417001139 → 0.0.0-develop-20250419001123

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +3 -0
  2. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js +1 -1
  3. package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js.map +3 -3
  4. package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
  5. package/lib/cjs/src/api/transport/model/Transport.js.map +1 -1
  6. package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js +1 -1
  7. package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js.map +3 -3
  8. package/lib/cjs/src/internal/device-session/model/DevicePinger.js +1 -1
  9. package/lib/cjs/src/internal/device-session/model/DevicePinger.js.map +3 -3
  10. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  11. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
  12. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
  13. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js.map +1 -1
  14. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
  15. package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +2 -2
  16. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
  17. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +2 -2
  18. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  19. package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  20. package/lib/esm/src/api/command/use-case/SendCommandUseCase.js +1 -1
  21. package/lib/esm/src/api/command/use-case/SendCommandUseCase.js.map +3 -3
  22. package/lib/esm/src/internal/device-session/data/ApduResponseConst.js +1 -1
  23. package/lib/esm/src/internal/device-session/data/ApduResponseConst.js.map +3 -3
  24. package/lib/esm/src/internal/device-session/model/DevicePinger.js +1 -1
  25. package/lib/esm/src/internal/device-session/model/DevicePinger.js.map +3 -3
  26. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  27. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
  28. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
  29. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js.map +1 -1
  30. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
  31. package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +2 -2
  32. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
  33. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +2 -2
  34. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
  35. package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
  36. package/lib/types/src/api/DeviceManagementKit.d.ts +1 -1
  37. package/lib/types/src/api/command/use-case/SendCommandUseCase.d.ts +5 -1
  38. package/lib/types/src/api/command/use-case/SendCommandUseCase.d.ts.map +1 -1
  39. package/lib/types/src/api/device-action/DeviceAction.d.ts +1 -1
  40. package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
  41. package/lib/types/src/api/transport/model/Transport.d.ts +1 -1
  42. package/lib/types/src/api/transport/model/Transport.d.ts.map +1 -1
  43. package/lib/types/src/internal/device-session/data/ApduResponseConst.d.ts +1 -0
  44. package/lib/types/src/internal/device-session/data/ApduResponseConst.d.ts.map +1 -1
  45. package/lib/types/src/internal/device-session/model/DevicePinger.d.ts +1 -1
  46. package/lib/types/src/internal/device-session/model/DevicePinger.d.ts.map +1 -1
  47. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +1 -1
  48. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  49. package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts +1 -1
  50. package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts.map +1 -1
  51. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  52. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/model/DeviceSession.ts"],
4
- "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { BehaviorSubject, type Observable } from \"rxjs\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"@api/device-action/DeviceAction\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceSessionId } from \"@api/device-session/types\";\nimport { type DmkError } from \"@api/Error\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { MutexService } from \"@internal/device-session/service/MutexService\";\nimport { RefresherService } from \"@internal/device-session/service/RefresherService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { DevicePinger } from \"./DevicePinger\";\nimport {\n DeviceSessionEventDispatcher,\n SessionEvents,\n} from \"./DeviceSessionEventDispatcher\";\nimport { DeviceSessionRefresher } from \"./DeviceSessionRefresher\";\nimport { DeviceSessionStateHandler } from \"./DeviceSessionStateHandler\";\n\nexport type SessionConstructorArgs = {\n connectedDevice: TransportConnectedDevice;\n id?: DeviceSessionId;\n};\n\nexport type DeviceSessionRefresherOptions = {\n isRefresherDisabled: boolean;\n pollingInterval?: number;\n};\n\ntype SendApduOptions = {\n isPolling?: boolean;\n triggersDisconnection?: boolean;\n abortTimeout?: number;\n};\n\n/**\n * Represents a session with a device.\n */\nexport class DeviceSession {\n private readonly _id: DeviceSessionId;\n private readonly _connectedDevice: TransportConnectedDevice;\n private readonly _deviceState: BehaviorSubject<DeviceSessionState>;\n private readonly _managerApiService: ManagerApiService;\n private readonly _secureChannelService: SecureChannelService;\n private readonly _logger: LoggerPublisherService;\n private readonly _refresherOptions: DeviceSessionRefresherOptions;\n private _pinger: DevicePinger;\n private _deviceSessionRefresher: DeviceSessionRefresher;\n private readonly _refresherService: RefresherService;\n private _commandMutex = new MutexService();\n private _sessionEventDispatcher = new DeviceSessionEventDispatcher();\n\n constructor(\n { connectedDevice, id = uuidv4() }: SessionConstructorArgs,\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n managerApiService: ManagerApiService,\n secureChannelService: SecureChannelService,\n deviceSessionRefresherOptions: DeviceSessionRefresherOptions | undefined,\n ) {\n this._id = id;\n this._connectedDevice = connectedDevice;\n this._logger = loggerModuleFactory(\"device-session\");\n this._managerApiService = managerApiService;\n this._secureChannelService = secureChannelService;\n this._refresherOptions = {\n ...DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n ...deviceSessionRefresherOptions,\n };\n this._deviceState = new BehaviorSubject<DeviceSessionState>({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: this._connectedDevice.deviceModel.id,\n });\n\n this._pinger = new DevicePinger(\n loggerModuleFactory,\n connectedDevice,\n this._sessionEventDispatcher,\n (command) => this.sendCommand(command),\n );\n this._deviceSessionRefresher = new DeviceSessionRefresher(\n loggerModuleFactory,\n this._refresherOptions,\n this._sessionEventDispatcher,\n this._connectedDevice,\n );\n new DeviceSessionStateHandler(\n loggerModuleFactory,\n this._sessionEventDispatcher,\n this._connectedDevice,\n this._deviceState,\n (state) => this.setDeviceSessionState(state),\n );\n\n this._refresherService = new RefresherService(loggerModuleFactory, {\n start: () => this._deviceSessionRefresher.restartRefresher(),\n stop: () => this._deviceSessionRefresher.stopRefresher(),\n });\n }\n\n public async initialiseSession(): Promise<void> {\n try {\n await this._pinger.ping();\n } catch (error) {\n this._logger.error(\"Error while initialising session\", {\n data: { error },\n });\n throw error;\n } finally {\n if (!this._refresherOptions.isRefresherDisabled) {\n this._deviceSessionRefresher.startRefresher();\n }\n }\n }\n\n public get id(): DeviceSessionId {\n return this._id;\n }\n\n public get connectedDevice(): TransportConnectedDevice {\n return this._connectedDevice;\n }\n\n public get state(): Observable<DeviceSessionState> {\n return this._deviceState.asObservable();\n }\n\n public setDeviceSessionState(state: DeviceSessionState): void {\n this._deviceState.next(state);\n }\n\n public async sendApdu(\n rawApdu: Uint8Array,\n options: SendApduOptions = {\n isPolling: false,\n triggersDisconnection: false,\n abortTimeout: undefined,\n },\n ): Promise<Either<DmkError, ApduResponse>> {\n const release = await this._commandMutex.lock();\n\n try {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_BUSY,\n });\n const result = await this._connectedDevice.sendApdu(\n rawApdu,\n options.triggersDisconnection,\n options.abortTimeout,\n );\n\n result\n .ifRight((response: ApduResponse) => {\n if (CommandUtils.isLockedDeviceResponse(response)) {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_LOCKED,\n });\n } else {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n }\n })\n .ifLeft(() => {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n });\n return result;\n } finally {\n release();\n }\n }\n\n public async sendCommand<Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n ): Promise<CommandResult<Response, ErrorStatusCodes>> {\n const apdu = command.getApdu();\n\n const response = await this.sendApdu(apdu.getRawApdu(), {\n isPolling: false,\n triggersDisconnection: command.triggersDisconnection ?? false,\n });\n\n return response.caseOf({\n Left: (err) => {\n throw err;\n },\n Right: (r) =>\n command.parseResponse(r, this._connectedDevice.deviceModel.id),\n });\n }\n\n public executeDeviceAction<\n Output,\n Input,\n E extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n >(\n deviceAction: DeviceAction<Output, Input, E, IntermediateValue>,\n ): ExecuteDeviceActionReturnType<Output, E, IntermediateValue> {\n const { observable, cancel } = deviceAction._execute({\n sendApdu: async (apdu: Uint8Array) => this.sendApdu(apdu),\n sendCommand: async <Response, ErrorStatusCodes, Args>(\n command: Command<Response, ErrorStatusCodes, Args>,\n ) => this.sendCommand(command),\n getDeviceSessionState: () => this._deviceState.getValue(),\n getDeviceSessionStateObservable: () => this.state,\n setDeviceSessionState: (state: DeviceSessionState) => {\n this.setDeviceSessionState(state);\n return this._deviceState.getValue();\n },\n disableRefresher: (blockerId: string) =>\n this._refresherService.disableRefresher(blockerId),\n getManagerApiService: () => this._managerApiService,\n getSecureChannelService: () => this._secureChannelService,\n });\n return { observable, cancel };\n }\n\n public close(): void {\n this._updateDeviceStatus(DeviceStatus.NOT_CONNECTED);\n this._deviceState.complete();\n this._deviceSessionRefresher.stopRefresher();\n }\n\n public disableRefresher(id: string): () => void {\n return this._refresherService.disableRefresher(id);\n }\n\n private _updateDeviceStatus(deviceStatus: DeviceStatus): void {\n const state = this._deviceState.getValue();\n this._deviceState.next({ ...state, deviceStatus });\n }\n}\n"],
5
- "mappings": "AACA,OAAS,mBAAAA,MAAwC,OACjD,OAAS,MAAMC,MAAc,OAI7B,OAAS,gBAAAC,MAAoB,kCAC7B,OAAS,gBAAAC,MAAoB,2BAO7B,OAEE,0BAAAC,MACK,yCAKP,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D,CAC7D,KAAM,CAAE,WAAAC,EAAY,OAAAC,CAAO,EAAIF,EAAa,SAAS,CACnD,SAAU,MAAOH,GAAqB,KAAK,SAASA,CAAI,EACxD,YAAa,MACXR,GACG,KAAK,YAAYA,CAAO,EAC7B,sBAAuB,IAAM,KAAK,aAAa,SAAS,EACxD,gCAAiC,IAAM,KAAK,MAC5C,sBAAwBC,IACtB,KAAK,sBAAsBA,CAAK,EACzB,KAAK,aAAa,SAAS,GAEpC,iBAAmBa,GACjB,KAAK,kBAAkB,iBAAiBA,CAAS,EACnD,qBAAsB,IAAM,KAAK,mBACjC,wBAAyB,IAAM,KAAK,qBACtC,CAAC,EACD,MAAO,CAAE,WAAAF,EAAY,OAAAC,CAAO,CAC9B,CAEO,OAAc,CACnB,KAAK,oBAAoB9B,EAAa,aAAa,EACnD,KAAK,aAAa,SAAS,EAC3B,KAAK,wBAAwB,cAAc,CAC7C,CAEO,iBAAiBY,EAAwB,CAC9C,OAAO,KAAK,kBAAkB,iBAAiBA,CAAE,CACnD,CAEQ,oBAAoBoB,EAAkC,CAC5D,MAAMd,EAAQ,KAAK,aAAa,SAAS,EACzC,KAAK,aAAa,KAAK,CAAE,GAAGA,EAAO,aAAAc,CAAa,CAAC,CACnD,CACF",
6
- "names": ["BehaviorSubject", "uuidv4", "CommandUtils", "DeviceStatus", "DeviceSessionStateType", "DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS", "MutexService", "RefresherService", "DevicePinger", "DeviceSessionEventDispatcher", "SessionEvents", "DeviceSessionRefresher", "DeviceSessionStateHandler", "DeviceSession", "connectedDevice", "id", "loggerModuleFactory", "managerApiService", "secureChannelService", "deviceSessionRefresherOptions", "command", "state", "error", "rawApdu", "options", "release", "result", "response", "apdu", "err", "r", "deviceAction", "observable", "cancel", "blockerId", "deviceStatus"]
4
+ "sourcesContent": ["import { type Either } from \"purify-ts\";\nimport { BehaviorSubject, type Observable } from \"rxjs\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nimport { type Command } from \"@api/command/Command\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"@api/device-action/DeviceAction\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceSessionId } from \"@api/device-session/types\";\nimport { type DmkError } from \"@api/Error\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { type TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nimport { DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS } from \"@internal/device-session/data/DeviceSessionRefresherConst\";\nimport { MutexService } from \"@internal/device-session/service/MutexService\";\nimport { RefresherService } from \"@internal/device-session/service/RefresherService\";\nimport { type ManagerApiService } from \"@internal/manager-api/service/ManagerApiService\";\nimport { type SecureChannelService } from \"@internal/secure-channel/service/SecureChannelService\";\n\nimport { DevicePinger } from \"./DevicePinger\";\nimport {\n DeviceSessionEventDispatcher,\n SessionEvents,\n} from \"./DeviceSessionEventDispatcher\";\nimport { DeviceSessionRefresher } from \"./DeviceSessionRefresher\";\nimport { DeviceSessionStateHandler } from \"./DeviceSessionStateHandler\";\n\nexport type SessionConstructorArgs = {\n connectedDevice: TransportConnectedDevice;\n id?: DeviceSessionId;\n};\n\nexport type DeviceSessionRefresherOptions = {\n isRefresherDisabled: boolean;\n pollingInterval?: number;\n};\n\ntype SendApduOptions = {\n isPolling?: boolean;\n triggersDisconnection?: boolean;\n abortTimeout?: number;\n};\n\n/**\n * Represents a session with a device.\n */\nexport class DeviceSession {\n private readonly _id: DeviceSessionId;\n private readonly _connectedDevice: TransportConnectedDevice;\n private readonly _deviceState: BehaviorSubject<DeviceSessionState>;\n private readonly _managerApiService: ManagerApiService;\n private readonly _secureChannelService: SecureChannelService;\n private readonly _logger: LoggerPublisherService;\n private readonly _refresherOptions: DeviceSessionRefresherOptions;\n private _pinger: DevicePinger;\n private _deviceSessionRefresher: DeviceSessionRefresher;\n private readonly _refresherService: RefresherService;\n private _commandMutex = new MutexService();\n private _sessionEventDispatcher = new DeviceSessionEventDispatcher();\n\n constructor(\n { connectedDevice, id = uuidv4() }: SessionConstructorArgs,\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n managerApiService: ManagerApiService,\n secureChannelService: SecureChannelService,\n deviceSessionRefresherOptions: DeviceSessionRefresherOptions | undefined,\n ) {\n this._id = id;\n this._connectedDevice = connectedDevice;\n this._logger = loggerModuleFactory(\"device-session\");\n this._managerApiService = managerApiService;\n this._secureChannelService = secureChannelService;\n this._refresherOptions = {\n ...DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,\n ...deviceSessionRefresherOptions,\n };\n this._deviceState = new BehaviorSubject<DeviceSessionState>({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: this._connectedDevice.deviceModel.id,\n });\n\n this._pinger = new DevicePinger(\n loggerModuleFactory,\n connectedDevice,\n this._sessionEventDispatcher,\n (command, abortTimeout) => this.sendCommand(command, abortTimeout),\n );\n this._deviceSessionRefresher = new DeviceSessionRefresher(\n loggerModuleFactory,\n this._refresherOptions,\n this._sessionEventDispatcher,\n this._connectedDevice,\n );\n new DeviceSessionStateHandler(\n loggerModuleFactory,\n this._sessionEventDispatcher,\n this._connectedDevice,\n this._deviceState,\n (state) => this.setDeviceSessionState(state),\n );\n\n this._refresherService = new RefresherService(loggerModuleFactory, {\n start: () => this._deviceSessionRefresher.restartRefresher(),\n stop: () => this._deviceSessionRefresher.stopRefresher(),\n });\n }\n\n public async initialiseSession(): Promise<void> {\n try {\n await this._pinger.ping();\n } catch (error) {\n this._logger.error(\"Error while initialising session\", {\n data: { error },\n });\n throw error;\n } finally {\n if (!this._refresherOptions.isRefresherDisabled) {\n this._deviceSessionRefresher.startRefresher();\n }\n }\n }\n\n public get id(): DeviceSessionId {\n return this._id;\n }\n\n public get connectedDevice(): TransportConnectedDevice {\n return this._connectedDevice;\n }\n\n public get state(): Observable<DeviceSessionState> {\n return this._deviceState.asObservable();\n }\n\n public setDeviceSessionState(state: DeviceSessionState): void {\n this._deviceState.next(state);\n }\n\n public async sendApdu(\n rawApdu: Uint8Array,\n options: SendApduOptions = {\n isPolling: false,\n triggersDisconnection: false,\n abortTimeout: undefined,\n },\n ): Promise<Either<DmkError, ApduResponse>> {\n const release = await this._commandMutex.lock();\n\n try {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_BUSY,\n });\n const result = await this._connectedDevice.sendApdu(\n rawApdu,\n options.triggersDisconnection,\n options.abortTimeout,\n );\n\n result\n .ifRight((response: ApduResponse) => {\n if (CommandUtils.isLockedDeviceResponse(response)) {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_LOCKED,\n });\n } else {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n }\n })\n .ifLeft(() => {\n this._sessionEventDispatcher.dispatch({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n });\n return result;\n } finally {\n release();\n }\n }\n\n public async sendCommand<Response, Args, ErrorStatusCodes>(\n command: Command<Response, Args, ErrorStatusCodes>,\n abortTimeout?: number,\n ): Promise<CommandResult<Response, ErrorStatusCodes>> {\n const apdu = command.getApdu();\n\n const response = await this.sendApdu(apdu.getRawApdu(), {\n isPolling: false,\n triggersDisconnection: command.triggersDisconnection ?? false,\n abortTimeout,\n });\n\n return response.caseOf({\n Left: (err) => {\n throw err;\n },\n Right: (r) =>\n command.parseResponse(r, this._connectedDevice.deviceModel.id),\n });\n }\n\n public executeDeviceAction<\n Output,\n Input,\n E extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n >(\n deviceAction: DeviceAction<Output, Input, E, IntermediateValue>,\n ): ExecuteDeviceActionReturnType<Output, E, IntermediateValue> {\n const { observable, cancel } = deviceAction._execute({\n sendApdu: async (apdu: Uint8Array) => this.sendApdu(apdu),\n sendCommand: async <Response, ErrorStatusCodes, Args>(\n command: Command<Response, ErrorStatusCodes, Args>,\n abortTimeout?: number,\n ) => this.sendCommand(command, abortTimeout),\n getDeviceSessionState: () => this._deviceState.getValue(),\n getDeviceSessionStateObservable: () => this.state,\n setDeviceSessionState: (state: DeviceSessionState) => {\n this.setDeviceSessionState(state);\n return this._deviceState.getValue();\n },\n disableRefresher: (blockerId: string) =>\n this._refresherService.disableRefresher(blockerId),\n getManagerApiService: () => this._managerApiService,\n getSecureChannelService: () => this._secureChannelService,\n });\n return { observable, cancel };\n }\n\n public close(): void {\n this._updateDeviceStatus(DeviceStatus.NOT_CONNECTED);\n this._deviceState.complete();\n this._deviceSessionRefresher.stopRefresher();\n }\n\n public disableRefresher(id: string): () => void {\n return this._refresherService.disableRefresher(id);\n }\n\n private _updateDeviceStatus(deviceStatus: DeviceStatus): void {\n const state = this._deviceState.getValue();\n this._deviceState.next({ ...state, deviceStatus });\n }\n}\n"],
5
+ "mappings": "AACA,OAAS,mBAAAA,MAAwC,OACjD,OAAS,MAAMC,MAAc,OAI7B,OAAS,gBAAAC,MAAoB,kCAC7B,OAAS,gBAAAC,MAAoB,2BAO7B,OAEE,0BAAAC,MACK,yCAKP,OAAS,4CAAAC,MAAgD,4DACzD,OAAS,gBAAAC,MAAoB,gDAC7B,OAAS,oBAAAC,MAAwB,oDAIjC,OAAS,gBAAAC,MAAoB,iBAC7B,OACE,gCAAAC,EACA,iBAAAC,MACK,iCACP,OAAS,0BAAAC,MAA8B,2BACvC,OAAS,6BAAAC,MAAiC,8BAqBnC,MAAMC,CAAc,CACR,IACA,iBACA,aACA,mBACA,sBACA,QACA,kBACT,QACA,wBACS,kBACT,cAAgB,IAA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AAsBA,CAAK,EACzB,KAAK,aAAa,SAAS,GAEpC,iBAAmBY,GACjB,KAAK,kBAAkB,iBAAiBA,CAAS,EACnD,qBAAsB,IAAM,KAAK,mBACjC,wBAAyB,IAAM,KAAK,qBACtC,CAAC,EACD,MAAO,CAAE,WAAAF,EAAY,OAAAC,CAAO,CAC9B,CAEO,OAAc,CACnB,KAAK,oBAAoB9B,EAAa,aAAa,EACnD,KAAK,aAAa,SAAS,EAC3B,KAAK,wBAAwB,cAAc,CAC7C,CAEO,iBAAiBY,EAAwB,CAC9C,OAAO,KAAK,kBAAkB,iBAAiBA,CAAE,CACnD,CAEQ,oBAAoBoB,EAAkC,CAC5D,MAAMb,EAAQ,KAAK,aAAa,SAAS,EACzC,KAAK,aAAa,KAAK,CAAE,GAAGA,EAAO,aAAAa,CAAa,CAAC,CACnD,CACF",
6
+ "names": ["BehaviorSubject", "uuidv4", "CommandUtils", "DeviceStatus", "DeviceSessionStateType", "DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS", "MutexService", "RefresherService", "DevicePinger", "DeviceSessionEventDispatcher", "SessionEvents", "DeviceSessionRefresher", "DeviceSessionStateHandler", "DeviceSession", "connectedDevice", "id", "loggerModuleFactory", "managerApiService", "secureChannelService", "deviceSessionRefresherOptions", "command", "abortTimeout", "state", "error", "rawApdu", "options", "release", "result", "response", "apdu", "err", "deviceAction", "observable", "cancel", "blockerId", "deviceStatus"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{DeviceSessionStateType as o,DeviceStatus as t,isSuccessCommandResult as v}from"../../../api/index";import{SessionEvents as i}from"../../device-session/model/DeviceSessionEventDispatcher";class D{constructor(e,s,n,r,a){this._sessionEventDispatcher=s;this._connectedDevice=n;this._deviceState=r;this.setDeviceSessionState=a;this._subscription=this._sessionEventDispatcher.listen().subscribe(c=>this.mapEventAction(c)),this._logger=e("device-session-state-handler")}_subscription;_logger;_updateDeviceState(e){const s=this._parseDeviceStatus(e);if(s){const{sessionStateType:n,deviceStatus:r,currentApp:a}=s;this.setDeviceSessionState({sessionStateType:n,deviceStatus:r,deviceModelId:this._connectedDevice.deviceModel.id,currentApp:a,installedApps:[],isSecureConnectionAllowed:!1})}}mapEventAction=e=>{switch(e.eventName){case i.COMMAND_SUCCEEDED:return this._updateDeviceState(e.eventData);case i.DEVICE_STATE_UPDATE_BUSY:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:t.BUSY});case i.DEVICE_STATE_UPDATE_LOCKED:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:t.LOCKED});case i.DEVICE_STATE_UPDATE_CONNECTED:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:t.CONNECTED});default:return null}};_parseDeviceStatus(e){return v(e)?{sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:t.CONNECTED,currentApp:{name:e.data.name,version:e.data.version}}:(this._logger.error("Error while parsing APDU response",{data:{parsedResponse:e}}),null)}unsubscribe(){this._subscription.unsubscribe()}}export{D as DeviceSessionStateHandler};
1
+ import{DeviceSessionStateType as o,DeviceStatus as t,isSuccessCommandResult as v}from"../../../api/index";import{SessionEvents as i}from"../../device-session/model/DeviceSessionEventDispatcher";class D{constructor(e,s,n,a,r){this._sessionEventDispatcher=s;this._connectedDevice=n;this._deviceState=a;this.setDeviceSessionState=r;this._subscription=this._sessionEventDispatcher.listen().subscribe(c=>this.mapEventAction(c)),this._logger=e("device-session-state-handler")}_subscription;_logger;_updateDeviceState(e){const s=this._parseDeviceStatus(e);if(s){const{sessionStateType:n,deviceStatus:a,currentApp:r}=s;this.setDeviceSessionState({sessionStateType:n,deviceStatus:a,deviceModelId:this._connectedDevice.deviceModel.id,currentApp:r,installedApps:[],isSecureConnectionAllowed:!1})}}mapEventAction=e=>{switch(e.eventName){case i.COMMAND_SUCCEEDED:return this._updateDeviceState(e.eventData);case i.DEVICE_STATE_UPDATE_BUSY:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:t.BUSY});case i.DEVICE_STATE_UPDATE_LOCKED:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:t.LOCKED});case i.DEVICE_STATE_UPDATE_CONNECTED:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:t.CONNECTED});default:return null}};_parseDeviceStatus(e){return v(e)?{sessionStateType:o.ReadyWithoutSecureChannel,deviceStatus:t.CONNECTED,currentApp:{name:e.data.name,version:e.data.version}}:(this._logger.debug("Error while parsing APDU response",{data:{parsedResponse:e}}),null)}unsubscribe(){this._subscription.unsubscribe()}}export{D as DeviceSessionStateHandler};
2
2
  //# sourceMappingURL=DeviceSessionStateHandler.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/model/DeviceSessionStateHandler.ts"],
4
- "sourcesContent": ["import { type BehaviorSubject, type Subscription } from \"rxjs\";\n\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport {\n DeviceSessionStateType,\n DeviceStatus,\n type GetAppAndVersionResponse,\n isSuccessCommandResult,\n type TransportConnectedDevice,\n} from \"@api/index\";\nimport { type CommandResult, type LoggerPublisherService } from \"@api/types\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nexport type SetDeviceSessionStateFn = (state: DeviceSessionState) => void;\n\ntype NewDeviceStatus = {\n sessionStateType: DeviceSessionStateType;\n deviceStatus: DeviceStatus;\n currentApp: {\n name: string;\n version: string;\n };\n};\n\nexport class DeviceSessionStateHandler {\n private _subscription: Subscription;\n private readonly _logger: LoggerPublisherService;\n\n constructor(\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n private _sessionEventDispatcher: DeviceSessionEventDispatcher,\n private _connectedDevice: TransportConnectedDevice,\n private _deviceState: BehaviorSubject<DeviceSessionState>,\n private setDeviceSessionState: SetDeviceSessionStateFn,\n ) {\n this._subscription = this._sessionEventDispatcher\n .listen()\n .subscribe((event) => this.mapEventAction(event));\n this._logger = loggerModuleFactory(\"device-session-state-handler\");\n }\n\n private _updateDeviceState(\n parsedResponse: CommandResult<GetAppAndVersionResponse>,\n ): void {\n const newDeviceStatus = this._parseDeviceStatus(parsedResponse);\n\n if (newDeviceStatus) {\n const { sessionStateType, deviceStatus, currentApp } = newDeviceStatus;\n\n this.setDeviceSessionState({\n sessionStateType,\n deviceStatus,\n deviceModelId: this._connectedDevice.deviceModel.id,\n currentApp,\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n }\n }\n\n private mapEventAction = (event: NewEvent) => {\n switch (event.eventName) {\n case SessionEvents.COMMAND_SUCCEEDED:\n return this._updateDeviceState(event.eventData);\n case SessionEvents.DEVICE_STATE_UPDATE_BUSY:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.BUSY,\n });\n case SessionEvents.DEVICE_STATE_UPDATE_LOCKED:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.LOCKED,\n });\n case SessionEvents.DEVICE_STATE_UPDATE_CONNECTED:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.CONNECTED,\n });\n default:\n return null;\n }\n };\n\n private _parseDeviceStatus(\n parsedResponse: CommandResult<GetAppAndVersionResponse>,\n ): NewDeviceStatus | null {\n if (isSuccessCommandResult(parsedResponse)) {\n return {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: {\n name: parsedResponse.data.name,\n version: parsedResponse.data.version,\n },\n };\n } else {\n this._logger.error(\"Error while parsing APDU response\", {\n data: { parsedResponse },\n });\n return null;\n }\n }\n\n public unsubscribe(): void {\n this._subscription.unsubscribe();\n }\n}\n"],
4
+ "sourcesContent": ["import { type BehaviorSubject, type Subscription } from \"rxjs\";\n\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport {\n DeviceSessionStateType,\n DeviceStatus,\n type GetAppAndVersionResponse,\n isSuccessCommandResult,\n type TransportConnectedDevice,\n} from \"@api/index\";\nimport { type CommandResult, type LoggerPublisherService } from \"@api/types\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nexport type SetDeviceSessionStateFn = (state: DeviceSessionState) => void;\n\ntype NewDeviceStatus = {\n sessionStateType: DeviceSessionStateType;\n deviceStatus: DeviceStatus;\n currentApp: {\n name: string;\n version: string;\n };\n};\n\nexport class DeviceSessionStateHandler {\n private _subscription: Subscription;\n private readonly _logger: LoggerPublisherService;\n\n constructor(\n loggerModuleFactory: (tag: string) => LoggerPublisherService,\n private _sessionEventDispatcher: DeviceSessionEventDispatcher,\n private _connectedDevice: TransportConnectedDevice,\n private _deviceState: BehaviorSubject<DeviceSessionState>,\n private setDeviceSessionState: SetDeviceSessionStateFn,\n ) {\n this._subscription = this._sessionEventDispatcher\n .listen()\n .subscribe((event) => this.mapEventAction(event));\n this._logger = loggerModuleFactory(\"device-session-state-handler\");\n }\n\n private _updateDeviceState(\n parsedResponse: CommandResult<GetAppAndVersionResponse>,\n ): void {\n const newDeviceStatus = this._parseDeviceStatus(parsedResponse);\n\n if (newDeviceStatus) {\n const { sessionStateType, deviceStatus, currentApp } = newDeviceStatus;\n\n this.setDeviceSessionState({\n sessionStateType,\n deviceStatus,\n deviceModelId: this._connectedDevice.deviceModel.id,\n currentApp,\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n }\n }\n\n private mapEventAction = (event: NewEvent) => {\n switch (event.eventName) {\n case SessionEvents.COMMAND_SUCCEEDED:\n return this._updateDeviceState(event.eventData);\n case SessionEvents.DEVICE_STATE_UPDATE_BUSY:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.BUSY,\n });\n case SessionEvents.DEVICE_STATE_UPDATE_LOCKED:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.LOCKED,\n });\n case SessionEvents.DEVICE_STATE_UPDATE_CONNECTED:\n return this.setDeviceSessionState({\n ...this._deviceState.getValue(),\n deviceStatus: DeviceStatus.CONNECTED,\n });\n default:\n return null;\n }\n };\n\n private _parseDeviceStatus(\n parsedResponse: CommandResult<GetAppAndVersionResponse>,\n ): NewDeviceStatus | null {\n if (isSuccessCommandResult(parsedResponse)) {\n return {\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n currentApp: {\n name: parsedResponse.data.name,\n version: parsedResponse.data.version,\n },\n };\n } else {\n this._logger.debug(\"Error while parsing APDU response\", {\n data: { parsedResponse },\n });\n return null;\n }\n }\n\n public unsubscribe(): void {\n this._subscription.unsubscribe();\n }\n}\n"],
5
5
  "mappings": "AAGA,OACE,0BAAAA,EACA,gBAAAC,EAEA,0BAAAC,MAEK,aAEP,OAGE,iBAAAC,MACK,8DAaA,MAAMC,CAA0B,CAIrC,YACEC,EACQC,EACAC,EACAC,EACAC,EACR,CAJQ,6BAAAH,EACA,sBAAAC,EACA,kBAAAC,EACA,2BAAAC,EAER,KAAK,cAAgB,KAAK,wBACvB,OAAO,EACP,UAAWC,GAAU,KAAK,eAAeA,CAAK,CAAC,EAClD,KAAK,QAAUL,EAAoB,8BAA8B,CACnE,CAdQ,cACS,QAeT,mBACNM,EACM,CACN,MAAMC,EAAkB,KAAK,mBAAmBD,CAAc,EAE9D,GAAIC,EAAiB,CACnB,KAAM,CAAE,iBAAAC,EAAkB,aAAAC,EAAc,WAAAC,CAAW,EAAIH,EAEvD,KAAK,sBAAsB,CACzB,iBAAAC,EACA,aAAAC,EACA,cAAe,KAAK,iBAAiB,YAAY,GACjD,WAAAC,EACA,cAAe,CAAC,EAChB,0BAA2B,EAC7B,CAAC,CACH,CACF,CAEQ,eAAkBL,GAAoB,CAC5C,OAAQA,EAAM,UAAW,CACvB,KAAKP,EAAc,kBACjB,OAAO,KAAK,mBAAmBO,EAAM,SAAS,EAChD,KAAKP,EAAc,yBACjB,OAAO,KAAK,sBAAsB,CAChC,GAAG,KAAK,aAAa,SAAS,EAC9B,aAAcF,EAAa,IAC7B,CAAC,EACH,KAAKE,EAAc,2BACjB,OAAO,KAAK,sBAAsB,CAChC,GAAG,KAAK,aAAa,SAAS,EAC9B,aAAcF,EAAa,MAC7B,CAAC,EACH,KAAKE,EAAc,8BACjB,OAAO,KAAK,sBAAsB,CAChC,GAAG,KAAK,aAAa,SAAS,EAC9B,aAAcF,EAAa,SAC7B,CAAC,EACH,QACE,OAAO,IACX,CACF,EAEQ,mBACNU,EACwB,CACxB,OAAIT,EAAuBS,CAAc,EAChC,CACL,iBAAkBX,EAAuB,0BACzC,aAAcC,EAAa,UAC3B,WAAY,CACV,KAAMU,EAAe,KAAK,KAC1B,QAASA,EAAe,KAAK,OAC/B,CACF,GAEA,KAAK,QAAQ,MAAM,oCAAqC,CACtD,KAAM,CAAE,eAAAA,CAAe,CACzB,CAAC,EACM,KAEX,CAEO,aAAoB,CACzB,KAAK,cAAc,YAAY,CACjC,CACF",
6
6
  "names": ["DeviceSessionStateType", "DeviceStatus", "isSuccessCommandResult", "SessionEvents", "DeviceSessionStateHandler", "loggerModuleFactory", "_sessionEventDispatcher", "_connectedDevice", "_deviceState", "setDeviceSessionState", "event", "parsedResponse", "newDeviceStatus", "sessionStateType", "deviceStatus", "currentApp"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{BehaviorSubject as E,Subject as u}from"rxjs";import{expect as e}from"vitest";import{CommandResultStatus as D,DeviceModelId as C,DeviceSessionStateType as l,DeviceStatus as i}from"../../../api/index";import{SessionEvents as o}from"../../device-session/model/DeviceSessionEventDispatcher";import{DeviceSessionStateHandler as p}from"./DeviceSessionStateHandler";describe("DeviceSessionStateHandler",()=>{let t,c,r;const S=vi.fn(()=>r);let d,v,n,a;beforeEach(()=>{t=new u,c={listen:()=>t,dispatch:vi.fn()},r={error:vi.fn()},d={deviceModel:{id:"device-model-1"}},v=new E({sessionStateType:l.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,deviceModelId:C.NANO_X,currentApp:{name:"",version:""},installedApps:[],isSecureConnectionAllowed:!1}),n=vi.fn(),a=new p(S,c,d,v,n)}),afterEach(()=>{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}),it("updates device state on COMMAND_SUCCEEDED event with a successful response",()=>{const s={data:{name:"TestApp",version:"1.0.0"},status:D.Success};t.next({eventName:o.COMMAND_SUCCEEDED,eventData:s}),e(n).toHaveBeenCalledWith({sessionStateType:l.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,deviceModelId:"device-model-1",currentApp:{name:"TestApp",version:"1.0.0"},installedApps:[],isSecureConnectionAllowed:!1})}),it("updates device state on DEVICE_STATE_UPDATE_BUSY event",()=>{t.next({eventName:o.DEVICE_STATE_UPDATE_BUSY}),e(n).toHaveBeenCalledWith(e.objectContaining({deviceStatus:i.BUSY}))}),it("updates device state on DEVICE_STATE_UPDATE_CONNECTED event",()=>{t.next({eventName:o.DEVICE_STATE_UPDATE_CONNECTED}),e(n).toHaveBeenCalledWith(e.objectContaining({deviceStatus:i.CONNECTED}))}),it("logs error and does not update state if command result is unsuccessful",()=>{const s={data:null,error:{_tag:"SomeOtherError"}};t.next({eventName:o.COMMAND_SUCCEEDED,eventData:s}),e(r.error).toHaveBeenCalledWith("Error while parsing APDU response",{data:{parsedResponse:s}}),e(n).not.toHaveBeenCalled()}),it("does not update state if command result is not a success",()=>{const s={data:null,error:{_tag:"SomeOtherError"}};t.next({eventName:o.COMMAND_SUCCEEDED,eventData:s}),e(n).not.toHaveBeenCalled()})});
1
+ import{BehaviorSubject as E,Subject as u}from"rxjs";import{expect as e}from"vitest";import{CommandResultStatus as D,DeviceModelId as C,DeviceSessionStateType as l,DeviceStatus as i}from"../../../api/index";import{SessionEvents as o}from"../../device-session/model/DeviceSessionEventDispatcher";import{DeviceSessionStateHandler as m}from"./DeviceSessionStateHandler";describe("DeviceSessionStateHandler",()=>{let t,c,r;const S=vi.fn(()=>r);let d,v,n,a;beforeEach(()=>{t=new u,c={listen:()=>t,dispatch:vi.fn()},r={error:vi.fn(),debug:vi.fn()},d={deviceModel:{id:"device-model-1"}},v=new E({sessionStateType:l.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,deviceModelId:C.NANO_X,currentApp:{name:"",version:""},installedApps:[],isSecureConnectionAllowed:!1}),n=vi.fn(),a=new m(S,c,d,v,n)}),afterEach(()=>{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}),it("updates device state on COMMAND_SUCCEEDED event with a successful response",()=>{const s={data:{name:"TestApp",version:"1.0.0"},status:D.Success};t.next({eventName:o.COMMAND_SUCCEEDED,eventData:s}),e(n).toHaveBeenCalledWith({sessionStateType:l.ReadyWithoutSecureChannel,deviceStatus:i.CONNECTED,deviceModelId:"device-model-1",currentApp:{name:"TestApp",version:"1.0.0"},installedApps:[],isSecureConnectionAllowed:!1})}),it("updates device state on DEVICE_STATE_UPDATE_BUSY event",()=>{t.next({eventName:o.DEVICE_STATE_UPDATE_BUSY}),e(n).toHaveBeenCalledWith(e.objectContaining({deviceStatus:i.BUSY}))}),it("updates device state on DEVICE_STATE_UPDATE_CONNECTED event",()=>{t.next({eventName:o.DEVICE_STATE_UPDATE_CONNECTED}),e(n).toHaveBeenCalledWith(e.objectContaining({deviceStatus:i.CONNECTED}))}),it("logs error and does not update state if command result is unsuccessful",()=>{const s={data:null,error:{_tag:"SomeOtherError"}};t.next({eventName:o.COMMAND_SUCCEEDED,eventData:s}),e(r.debug).toHaveBeenCalledWith("Error while parsing APDU response",{data:{parsedResponse:s}}),e(n).not.toHaveBeenCalled()}),it("does not update state if command result is not a success",()=>{const s={data:null,error:{_tag:"SomeOtherError"}};t.next({eventName:o.COMMAND_SUCCEEDED,eventData:s}),e(n).not.toHaveBeenCalled()})});
2
2
  //# sourceMappingURL=DeviceSessionStateHandler.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/device-session/model/DeviceSessionStateHandler.test.ts"],
4
- "sourcesContent": ["import { BehaviorSubject, Subject } from \"rxjs\";\nimport { expect, type Mock } from \"vitest\";\n\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport {\n CommandResultStatus,\n DeviceModelId,\n DeviceSessionStateType,\n DeviceStatus,\n} from \"@api/index\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nimport {\n DeviceSessionStateHandler,\n type SetDeviceSessionStateFn,\n} from \"./DeviceSessionStateHandler\";\n\ndescribe(\"DeviceSessionStateHandler\", () => {\n let fakeEventSubject: Subject<NewEvent>;\n let fakeSessionEventDispatcher: DeviceSessionEventDispatcher;\n let mockLogger: {\n error: (message: string, meta?: Record<string, unknown>) => void;\n };\n const mockLoggerModuleFactory = vi.fn(() => mockLogger);\n let fakeConnectedDevice: { deviceModel: { id: string } };\n let deviceState: BehaviorSubject<DeviceSessionState>;\n let setDeviceSessionState: Mock<SetDeviceSessionStateFn>;\n let handler: DeviceSessionStateHandler;\n\n beforeEach(() => {\n fakeEventSubject = new Subject<NewEvent>();\n //@ts-expect-error mock\n fakeSessionEventDispatcher = {\n listen: () => fakeEventSubject,\n dispatch: vi.fn(),\n };\n\n mockLogger = {\n error: vi.fn(),\n };\n\n fakeConnectedDevice = {\n deviceModel: {\n id: \"device-model-1\",\n },\n };\n\n deviceState = new BehaviorSubject<DeviceSessionState>({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: DeviceModelId.NANO_X,\n currentApp: { name: \"\", version: \"\" },\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n\n setDeviceSessionState = vi.fn();\n\n handler = new DeviceSessionStateHandler(\n //@ts-expect-error mock\n mockLoggerModuleFactory,\n fakeSessionEventDispatcher,\n fakeConnectedDevice,\n deviceState,\n setDeviceSessionState,\n );\n });\n\n afterEach(() => {\n if (handler && typeof handler.unsubscribe === \"function\") {\n handler.unsubscribe();\n }\n });\n\n it(\"updates device state on COMMAND_SUCCEEDED event with a successful response\", () => {\n // Given\n const fakeCommandResult = {\n data: {\n name: \"TestApp\",\n version: \"1.0.0\",\n },\n status: CommandResultStatus.Success,\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: \"device-model-1\",\n currentApp: { name: \"TestApp\", version: \"1.0.0\" },\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n });\n\n it(\"updates device state on DEVICE_STATE_UPDATE_BUSY event\", () => {\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_BUSY,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith(\n expect.objectContaining({ deviceStatus: DeviceStatus.BUSY }),\n );\n });\n\n it(\"updates device state on DEVICE_STATE_UPDATE_CONNECTED event\", () => {\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith(\n expect.objectContaining({ deviceStatus: DeviceStatus.CONNECTED }),\n );\n });\n\n it(\"logs error and does not update state if command result is unsuccessful\", () => {\n // Given\n const fakeErrorCommandResult = {\n data: null,\n error: { _tag: \"SomeOtherError\" },\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeErrorCommandResult,\n });\n\n // Then\n expect(mockLogger.error).toHaveBeenCalledWith(\n \"Error while parsing APDU response\",\n { data: { parsedResponse: fakeErrorCommandResult } },\n );\n expect(setDeviceSessionState).not.toHaveBeenCalled();\n });\n\n it(\"does not update state if command result is not a success\", () => {\n // Given\n const fakeErrorCommandResult = {\n data: null,\n error: { _tag: \"SomeOtherError\" },\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeErrorCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).not.toHaveBeenCalled();\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,mBAAAA,EAAiB,WAAAC,MAAe,OACzC,OAAS,UAAAC,MAAyB,SAGlC,OACE,uBAAAC,EACA,iBAAAC,EACA,0BAAAC,EACA,gBAAAC,MACK,aACP,OAGE,iBAAAC,MACK,8DAEP,OACE,6BAAAC,MAEK,8BAEP,SAAS,4BAA6B,IAAM,CAC1C,IAAIC,EACAC,EACAC,EAGJ,MAAMC,EAA0B,GAAG,GAAG,IAAMD,CAAU,EACtD,IAAIE,EACAC,EACAC,EACAC,EAEJ,WAAW,IAAM,CACfP,EAAmB,IAAIR,EAEvBS,EAA6B,CAC3B,OAAQ,IAAMD,EACd,SAAU,GAAG,GAAG,CAClB,EAEAE,EAAa,CACX,MAAO,GAAG,GAAG,CACf,EAEAE,EAAsB,CACpB,YAAa,CACX,GAAI,gBACN,CACF,EAEAC,EAAc,IAAId,EAAoC,CACpD,iBAAkBK,EAAuB,0BACzC,aAAcC,EAAa,UAC3B,cAAeF,EAAc,OAC7B,WAAY,CAAE,KAAM,GAAI,QAAS,EAAG,EACpC,cAAe,CAAC,EAChB,0BAA2B,EAC7B,CAAC,EAEDW,EAAwB,GAAG,GAAG,EAE9BC,EAAU,IAAIR,EAEZI,EACAF,EACAG,EACAC,EACAC,CACF,CACF,CAAC,EAED,UAAU,IAAM,CACVC,GAAW,OAAOA,EAAQ,aAAgB,YAC5CA,EAAQ,YAAY,CAExB,CAAC,EAED,GAAG,6EAA8E,IAAM,CAErF,MAAMC,EAAoB,CACxB,KAAM,CACJ,KAAM,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Subject, Subject } from \"rxjs\";\nimport { expect, type Mock } from \"vitest\";\n\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport {\n CommandResultStatus,\n DeviceModelId,\n DeviceSessionStateType,\n DeviceStatus,\n} from \"@api/index\";\nimport {\n type DeviceSessionEventDispatcher,\n type NewEvent,\n SessionEvents,\n} from \"@internal/device-session/model/DeviceSessionEventDispatcher\";\n\nimport {\n DeviceSessionStateHandler,\n type SetDeviceSessionStateFn,\n} from \"./DeviceSessionStateHandler\";\n\ndescribe(\"DeviceSessionStateHandler\", () => {\n let fakeEventSubject: Subject<NewEvent>;\n let fakeSessionEventDispatcher: DeviceSessionEventDispatcher;\n let mockLogger: {\n error: (message: string, meta?: Record<string, unknown>) => void;\n debug: (message: string, meta?: Record<string, unknown>) => void;\n };\n const mockLoggerModuleFactory = vi.fn(() => mockLogger);\n let fakeConnectedDevice: { deviceModel: { id: string } };\n let deviceState: BehaviorSubject<DeviceSessionState>;\n let setDeviceSessionState: Mock<SetDeviceSessionStateFn>;\n let handler: DeviceSessionStateHandler;\n\n beforeEach(() => {\n fakeEventSubject = new Subject<NewEvent>();\n //@ts-expect-error mock\n fakeSessionEventDispatcher = {\n listen: () => fakeEventSubject,\n dispatch: vi.fn(),\n };\n\n mockLogger = {\n error: vi.fn(),\n debug: vi.fn(),\n };\n\n fakeConnectedDevice = {\n deviceModel: {\n id: \"device-model-1\",\n },\n };\n\n deviceState = new BehaviorSubject<DeviceSessionState>({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: DeviceModelId.NANO_X,\n currentApp: { name: \"\", version: \"\" },\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n\n setDeviceSessionState = vi.fn();\n\n handler = new DeviceSessionStateHandler(\n //@ts-expect-error mock\n mockLoggerModuleFactory,\n fakeSessionEventDispatcher,\n fakeConnectedDevice,\n deviceState,\n setDeviceSessionState,\n );\n });\n\n afterEach(() => {\n if (handler && typeof handler.unsubscribe === \"function\") {\n handler.unsubscribe();\n }\n });\n\n it(\"updates device state on COMMAND_SUCCEEDED event with a successful response\", () => {\n // Given\n const fakeCommandResult = {\n data: {\n name: \"TestApp\",\n version: \"1.0.0\",\n },\n status: CommandResultStatus.Success,\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n deviceModelId: \"device-model-1\",\n currentApp: { name: \"TestApp\", version: \"1.0.0\" },\n installedApps: [],\n isSecureConnectionAllowed: false,\n });\n });\n\n it(\"updates device state on DEVICE_STATE_UPDATE_BUSY event\", () => {\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_BUSY,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith(\n expect.objectContaining({ deviceStatus: DeviceStatus.BUSY }),\n );\n });\n\n it(\"updates device state on DEVICE_STATE_UPDATE_CONNECTED event\", () => {\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.DEVICE_STATE_UPDATE_CONNECTED,\n });\n\n // Then\n expect(setDeviceSessionState).toHaveBeenCalledWith(\n expect.objectContaining({ deviceStatus: DeviceStatus.CONNECTED }),\n );\n });\n\n it(\"logs error and does not update state if command result is unsuccessful\", () => {\n // Given\n const fakeErrorCommandResult = {\n data: null,\n error: { _tag: \"SomeOtherError\" },\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeErrorCommandResult,\n });\n\n // Then\n expect(mockLogger.debug).toHaveBeenCalledWith(\n \"Error while parsing APDU response\",\n { data: { parsedResponse: fakeErrorCommandResult } },\n );\n expect(setDeviceSessionState).not.toHaveBeenCalled();\n });\n\n it(\"does not update state if command result is not a success\", () => {\n // Given\n const fakeErrorCommandResult = {\n data: null,\n error: { _tag: \"SomeOtherError\" },\n };\n\n // When\n fakeEventSubject.next({\n eventName: SessionEvents.COMMAND_SUCCEEDED,\n //@ts-expect-error mock\n eventData: fakeErrorCommandResult,\n });\n\n // Then\n expect(setDeviceSessionState).not.toHaveBeenCalled();\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,EAAiB,WAAAC,MAAe,OACzC,OAAS,UAAAC,MAAyB,SAGlC,OACE,uBAAAC,EACA,iBAAAC,EACA,0BAAAC,EACA,gBAAAC,MACK,aACP,OAGE,iBAAAC,MACK,8DAEP,OACE,6BAAAC,MAEK,8BAEP,SAAS,4BAA6B,IAAM,CAC1C,IAAIC,EACAC,EACAC,EAIJ,MAAMC,EAA0B,GAAG,GAAG,IAAMD,CAAU,EACtD,IAAIE,EACAC,EACAC,EACAC,EAEJ,WAAW,IAAM,CACfP,EAAmB,IAAIR,EAEvBS,EAA6B,CAC3B,OAAQ,IAAMD,EACd,SAAU,GAAG,GAAG,CAClB,EAEAE,EAAa,CACX,MAAO,GAAG,GAAG,EACb,MAAO,GAAG,GAAG,CACf,EAEAE,EAAsB,CACpB,YAAa,CACX,GAAI,gBACN,CACF,EAEAC,EAAc,IAAId,EAAoC,CACpD,iBAAkBK,EAAuB,0BACzC,aAAcC,EAAa,UAC3B,cAAeF,EAAc,OAC7B,WAAY,CAAE,KAAM,GAAI,QAAS,EAAG,EACpC,cAAe,CAAC,EAChB,0BAA2B,EAC7B,CAAC,EAEDW,EAAwB,GAAG,GAAG,EAE9BC,EAAU,IAAIR,EAEZI,EACAF,EACAG,EACAC,EACAC,CACF,CACF,CAAC,EAED,UAAU,IAAM,CACVC,GAAW,OAAOA,EAAQ,aAAgB,YAC5CA,EAAQ,YAAY,CAExB,CAAC,EAED,GAAG,6EAA8E,IAAM,CAErF,MAAMC,EAAoB,CACxB,KAAM,CACJ,KAAM,UACN,QAAS,OACX,EAC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us", "DeviceModelId", "DeviceSessionStateType", "DeviceStatus", "SessionEvents", "DeviceSessionStateHandler", "fakeEventSubject", "fakeSessionEventDispatcher", "mockLogger", "mockLoggerModuleFactory", "fakeConnectedDevice", "deviceState", "setDeviceSessionState", "handler", "fakeCommandResult", "fakeErrorCommandResult"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var m=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var a=(e,r,p,o)=>{for(var t=o>1?void 0:o?f(r,p):r,i=e.length-1,n;i>=0;i--)(n=e[i])&&(t=(o?n(r,p,t):n(t))||t);return o&&t&&m(r,p,t),t},s=(e,r)=>(p,o)=>r(p,o,e);import{inject as v,injectable as T}from"inversify";import{transportDiTypes as l}from"../../transport/di/transportDiTypes";let c=class{constructor(r){this.transportService=r}execute(){for(const r of this.transportService.getAllTransports())r.stopDiscovering()}};c=a([T(),s(0,v(l.TransportService))],c);export{c as StopDiscoveringUseCase};
1
+ var m=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var n=(e,r,p,o)=>{for(var t=o>1?void 0:o?f(r,p):r,a=e.length-1,c;a>=0;a--)(c=e[a])&&(t=(o?c(r,p,t):c(t))||t);return o&&t&&m(r,p,t),t},s=(e,r)=>(p,o)=>r(p,o,e);import{inject as v,injectable as T}from"inversify";import{transportDiTypes as l}from"../../transport/di/transportDiTypes";let i=class{constructor(r){this.transportService=r}async execute(){for(const r of this.transportService.getAllTransports())await r.stopDiscovering()}};i=n([T(),s(0,v(l.TransportService))],i);export{i as StopDiscoveringUseCase};
2
2
  //# sourceMappingURL=StopDiscoveringUseCase.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/discovery/use-case/StopDiscoveringUseCase.ts"],
4
- "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { transportDiTypes } from \"@internal/transport/di/transportDiTypes\";\nimport { type TransportService } from \"@internal/transport/service/TransportService\";\n\n/**\n * Stops discovering devices connected.\n */\n@injectable()\nexport class StopDiscoveringUseCase {\n constructor(\n @inject(transportDiTypes.TransportService)\n private transportService: TransportService,\n ) {}\n\n execute(): void {\n for (const transport of this.transportService.getAllTransports()) {\n transport.stopDiscovering();\n }\n }\n}\n"],
5
- "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAEnC,OAAS,oBAAAC,MAAwB,0CAO1B,IAAMC,EAAN,KAA6B,CAClC,YAEUC,EACR,CADQ,sBAAAA,CACP,CAEH,SAAgB,CACd,UAAWC,KAAa,KAAK,iBAAiB,iBAAiB,EAC7DA,EAAU,gBAAgB,CAE9B,CACF,EAXaF,EAANG,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAiB,gBAAgB,IAFhCP",
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { transportDiTypes } from \"@internal/transport/di/transportDiTypes\";\nimport { type TransportService } from \"@internal/transport/service/TransportService\";\n\n/**\n * Stops discovering devices connected.\n */\n@injectable()\nexport class StopDiscoveringUseCase {\n constructor(\n @inject(transportDiTypes.TransportService)\n private transportService: TransportService,\n ) {}\n\n async execute(): Promise<void> {\n for (const transport of this.transportService.getAllTransports()) {\n await transport.stopDiscovering();\n }\n }\n}\n"],
5
+ "mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAEnC,OAAS,oBAAAC,MAAwB,0CAO1B,IAAMC,EAAN,KAA6B,CAClC,YAEUC,EACR,CADQ,sBAAAA,CACP,CAEH,MAAM,SAAyB,CAC7B,UAAWC,KAAa,KAAK,iBAAiB,iBAAiB,EAC7D,MAAMA,EAAU,gBAAgB,CAEpC,CACF,EAXaF,EAANG,EAAA,CADNC,EAAW,EAGPC,EAAA,EAAAC,EAAOC,EAAiB,gBAAgB,IAFhCP",
6
6
  "names": ["inject", "injectable", "transportDiTypes", "StopDiscoveringUseCase", "transportService", "transport", "__decorateClass", "injectable", "__decorateParam", "inject", "transportDiTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{TransportMock as s}from"../../../api/transport/model/__mocks__/TransportMock";import{DefaultTransportService as n}from"../../transport/service/DefaultTransportService";import{StopDiscoveringUseCase as a}from"./StopDiscoveringUseCase";vi.mock("@internal/transport/service/DefaultTransportService");let e,r,t;describe("StopDiscoveringUseCase",()=>{beforeEach(()=>{e=new s,r=[e],t=new n(r)}),afterEach(()=>{vi.clearAllMocks()}),test("should call stop discovering",()=>{const o=vi.fn();vi.spyOn(e,"stopDiscovering").mockImplementation(o),vi.spyOn(t,"getAllTransports").mockReturnValue(r),new a(t).execute(),expect(o).toHaveBeenCalled()})});
1
+ import{TransportMock as s}from"../../../api/transport/model/__mocks__/TransportMock";import{DefaultTransportService as n}from"../../transport/service/DefaultTransportService";import{StopDiscoveringUseCase as a}from"./StopDiscoveringUseCase";vi.mock("@internal/transport/service/DefaultTransportService");let e,r,t,o;describe("StopDiscoveringUseCase",()=>{beforeEach(()=>{e=new s,r=new s,t=[e,r],o=new n(t)}),afterEach(()=>{vi.clearAllMocks()}),test("should call stop discovering",async()=>{vi.spyOn(e,"stopDiscovering").mockImplementation(vi.fn()),vi.spyOn(r,"stopDiscovering").mockImplementation(async()=>Promise.resolve(void 0)),vi.spyOn(o,"getAllTransports").mockReturnValue(t),await new a(o).execute(),expect(e.stopDiscovering).toHaveBeenCalled(),expect(r.stopDiscovering).toHaveBeenCalled()})});
2
2
  //# sourceMappingURL=StopDiscoveringUseCase.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/discovery/use-case/StopDiscoveringUseCase.test.ts"],
4
- "sourcesContent": ["import { TransportMock } from \"@api/transport/model/__mocks__/TransportMock\";\nimport { type Transport } from \"@api/types\";\nimport { DefaultTransportService } from \"@internal/transport/service/DefaultTransportService\";\nimport { type TransportService } from \"@internal/transport/service/TransportService\";\n\nimport { StopDiscoveringUseCase } from \"./StopDiscoveringUseCase\";\n\nvi.mock(\"@internal/transport/service/DefaultTransportService\");\n\n// TODO test several transports\nlet transport: Transport;\nlet transports: Transport[];\nlet transportService: TransportService;\n\ndescribe(\"StopDiscoveringUseCase\", () => {\n beforeEach(() => {\n transport = new TransportMock();\n transports = [transport];\n // @ts-expect-error mock\n transportService = new DefaultTransportService(transports);\n });\n\n afterEach(() => {\n vi.clearAllMocks();\n });\n\n test(\"should call stop discovering\", () => {\n const mockedStopDiscovering = vi.fn();\n vi.spyOn(transport, \"stopDiscovering\").mockImplementation(\n mockedStopDiscovering,\n );\n\n vi.spyOn(transportService, \"getAllTransports\").mockReturnValue(transports);\n\n const usecase = new StopDiscoveringUseCase(transportService);\n\n usecase.execute();\n\n expect(mockedStopDiscovering).toHaveBeenCalled();\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,iBAAAA,MAAqB,+CAE9B,OAAS,2BAAAC,MAA+B,sDAGxC,OAAS,0BAAAC,MAA8B,2BAEvC,GAAG,KAAK,qDAAqD,EAG7D,IAAIC,EACAC,EACAC,EAEJ,SAAS,yBAA0B,IAAM,CACvC,WAAW,IAAM,CACfF,EAAY,IAAIH,EAChBI,EAAa,CAACD,CAAS,EAEvBE,EAAmB,IAAIJ,EAAwBG,CAAU,CAC3D,CAAC,EAED,UAAU,IAAM,CACd,GAAG,cAAc,CACnB,CAAC,EAED,KAAK,+BAAgC,IAAM,CACzC,MAAME,EAAwB,GAAG,GAAG,EACpC,GAAG,MAAMH,EAAW,iBAAiB,EAAE,mBACrCG,CACF,EAEA,GAAG,MAAMD,EAAkB,kBAAkB,EAAE,gBAAgBD,CAAU,EAEzD,IAAIF,EAAuBG,CAAgB,EAEnD,QAAQ,EAEhB,OAAOC,CAAqB,EAAE,iBAAiB,CACjD,CAAC,CACH,CAAC",
6
- "names": ["TransportMock", "DefaultTransportService", "StopDiscoveringUseCase", "transport", "transports", "transportService", "mockedStopDiscovering"]
4
+ "sourcesContent": ["import { TransportMock } from \"@api/transport/model/__mocks__/TransportMock\";\nimport { type Transport } from \"@api/types\";\nimport { DefaultTransportService } from \"@internal/transport/service/DefaultTransportService\";\nimport { type TransportService } from \"@internal/transport/service/TransportService\";\n\nimport { StopDiscoveringUseCase } from \"./StopDiscoveringUseCase\";\n\nvi.mock(\"@internal/transport/service/DefaultTransportService\");\n\n// TODO test several transports\nlet transport: Transport;\nlet transport2: Transport;\nlet transports: Transport[];\nlet transportService: TransportService;\n\ndescribe(\"StopDiscoveringUseCase\", () => {\n beforeEach(() => {\n transport = new TransportMock();\n transport2 = new TransportMock();\n transports = [transport, transport2];\n // @ts-expect-error mock\n transportService = new DefaultTransportService(transports);\n });\n\n afterEach(() => {\n vi.clearAllMocks();\n });\n\n test(\"should call stop discovering\", async () => {\n vi.spyOn(transport, \"stopDiscovering\").mockImplementation(vi.fn());\n vi.spyOn(transport2, \"stopDiscovering\").mockImplementation(async () =>\n Promise.resolve(undefined),\n );\n\n vi.spyOn(transportService, \"getAllTransports\").mockReturnValue(transports);\n\n const usecase = new StopDiscoveringUseCase(transportService);\n\n await usecase.execute();\n\n expect(transport.stopDiscovering).toHaveBeenCalled();\n expect(transport2.stopDiscovering).toHaveBeenCalled();\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,iBAAAA,MAAqB,+CAE9B,OAAS,2BAAAC,MAA+B,sDAGxC,OAAS,0BAAAC,MAA8B,2BAEvC,GAAG,KAAK,qDAAqD,EAG7D,IAAIC,EACAC,EACAC,EACAC,EAEJ,SAAS,yBAA0B,IAAM,CACvC,WAAW,IAAM,CACfH,EAAY,IAAIH,EAChBI,EAAa,IAAIJ,EACjBK,EAAa,CAACF,EAAWC,CAAU,EAEnCE,EAAmB,IAAIL,EAAwBI,CAAU,CAC3D,CAAC,EAED,UAAU,IAAM,CACd,GAAG,cAAc,CACnB,CAAC,EAED,KAAK,+BAAgC,SAAY,CAC/C,GAAG,MAAMF,EAAW,iBAAiB,EAAE,mBAAmB,GAAG,GAAG,CAAC,EACjE,GAAG,MAAMC,EAAY,iBAAiB,EAAE,mBAAmB,SACzD,QAAQ,QAAQ,MAAS,CAC3B,EAEA,GAAG,MAAME,EAAkB,kBAAkB,EAAE,gBAAgBD,CAAU,EAIzE,MAFgB,IAAIH,EAAuBI,CAAgB,EAE7C,QAAQ,EAEtB,OAAOH,EAAU,eAAe,EAAE,iBAAiB,EACnD,OAAOC,EAAW,eAAe,EAAE,iBAAiB,CACtD,CAAC,CACH,CAAC",
6
+ "names": ["TransportMock", "DefaultTransportService", "StopDiscoveringUseCase", "transport", "transport2", "transports", "transportService"]
7
7
  }
@@ -35,7 +35,7 @@ export declare class DeviceManagementKit {
35
35
  /**
36
36
  * Stops discovering devices connected.
37
37
  */
38
- stopDiscovering(): void;
38
+ stopDiscovering(): Promise<void>;
39
39
  /**
40
40
  * Listen to list of known discovered devices (and later BLE).
41
41
  * @param {ListenToAvailableDevicesUseCaseArgs} args - The transport to use for discover, or undefined to discover from all transports.
@@ -11,6 +11,10 @@ export type SendCommandUseCaseArgs<Response, ErrorStatusCodes, Args = void> = {
11
11
  * The command to send.
12
12
  */
13
13
  readonly command: Command<Response, ErrorStatusCodes, Args>;
14
+ /**
15
+ * The timeout to abort the command.
16
+ */
17
+ readonly abortTimeout?: number;
14
18
  };
15
19
  /**
16
20
  * Sends a command to a device through a device session.
@@ -26,6 +30,6 @@ export declare class SendCommandUseCase {
26
30
  * @param command - The command to send.
27
31
  * @returns The response from the command.
28
32
  */
29
- execute<Response, Args, ErrorStatusCodes>({ sessionId, command, }: SendCommandUseCaseArgs<Response, Args, ErrorStatusCodes>): Promise<CommandResult<Response, ErrorStatusCodes>>;
33
+ execute<Response, Args, ErrorStatusCodes>({ sessionId, command, abortTimeout, }: SendCommandUseCaseArgs<Response, Args, ErrorStatusCodes>): Promise<CommandResult<Response, ErrorStatusCodes>>;
30
34
  }
31
35
  //# sourceMappingURL=SendCommandUseCase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SendCommandUseCase.d.ts","sourceRoot":"","sources":["../../../../../../src/api/command/use-case/SendCommandUseC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E,oBAAoB,EAAE,MAAM,uDAAuD,CAAC;AAGlG,MAAM,MAAM,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,GAAG,IAAI,IAAI;IAC5E;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAC5D;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,qBACa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAuB;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;gBAG/C,cAAc,EAAE,oBAAoB,EAEpC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,sBAAsB;IAMxD;;;;;;OAMG;IACG,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAC9C,SAAS,EACT,OAAO,EACP,YAAY,GACb,EAAE,sBAAsB,CAAC,QAAQ,EAAE,IAAI,EAAE,gBAAgB,CAAC,GAAG,OAAO,CACnE,aAAa,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAC1C;CAoBF"}
@@ -10,7 +10,7 @@ import { type SecureChannelService } from "../../internal/secure-channel/service
10
10
  import { type DeviceActionState } from "./model/DeviceActionState";
11
11
  export type InternalApi = {
12
12
  readonly sendApdu: (apdu: Uint8Array) => Promise<Either<DmkError, ApduResponse>>;
13
- readonly sendCommand: <Response, Args, ErrorStatusCodes>(command: Command<Response, Args, ErrorStatusCodes>) => Promise<CommandResult<Response, ErrorStatusCodes>>;
13
+ readonly sendCommand: <Response, Args, ErrorStatusCodes>(command: Command<Response, Args, ErrorStatusCodes>, abortTimeout?: number) => Promise<CommandResult<Response, ErrorStatusCodes>>;
14
14
  readonly getDeviceSessionState: () => DeviceSessionState;
15
15
  readonly getDeviceSessionStateObservable: () => Observable<DeviceSessionState>;
16
16
  readonly setDeviceSessionState: (state: DeviceSessionState) => DeviceSessionState;
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceAction.d.ts","sourceRoot":"","sources":["../../../../../src/api/device-action/DeviceAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,uDAAuD,CAAC;AAElG,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,QAAQ,EAAE,CACjB,IAAI,EAAE,UAAU,KACb,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IAC7C,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EACrD,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,gBAAgB,CAAC,KAC/C,OAAO,CAAC,aAAa,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;IACxD,QAAQ,CAAC,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;IACzD,QAAQ,CAAC,+BAA+B,EAAE,MAAM,UAAU,C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,6BAA6B,CAAC,MAAM,EAAE,KAAK,EAAE,iBAAiB,IAAI;IAC5E,QAAQ,CAAC,UAAU,EAAE,UAAU,CAC7B,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,iBAAiB,CAAC,CACpD,CAAC;IACF,MAAM,IAAI,IAAI,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,YAAY,CAC3B,MAAM,EACN,KAAK,EACL,KAAK,SAAS,QAAQ,EACtB,iBAAiB,SAAS,6BAA6B;IAEvD,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAEtB,QAAQ,CACN,MAAM,EAAE,WAAW,GAClB,6BAA6B,CAAC,MAAM,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;CACpE"}
@@ -22,7 +22,7 @@ export interface Transport {
22
22
  getIdentifier(): TransportIdentifier;
23
23
  isSupported(): boolean;
24
24
  startDiscovering(): Observable<TransportDiscoveredDevice>;
25
- stopDiscovering(): void;
25
+ stopDiscovering(): void | Promise<void>;
26
26
  listenToAvailableDevices(): Observable<TransportDiscoveredDevice[]>;
27
27
  /**
28
28
  * Enables communication with the device by connecting to it.
@@ -1 +1 @@
1
- {"version":3,"file":"Transport.d.ts","sourceRoot":"","sources":["../../../../../../src/api/transport/model/Transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,iDAAiD,CAAC;AAClG,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,KAAK,QAA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,IAAI,UAAU,CAAC,yBAAyB,EAAE,CAAC,CAAC;IAEpE;;;;;OAKG;IACH,OAAO,CAAC,MAAM,EAAE;QACd,QAAQ,EAAE,QAAQ,CAAC;QACnB,YAAY,EAAE,iBAAiB,CAAC;KACjC,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,wBAAwB,CAAC,CAAC,CAAC;IAE5D,UAAU,CAAC,MAAM,EAAE;QACjB,eAAe,EAAE,wBAAwB,CAAC;KAC3C,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;CACrC;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,oBAAoB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,sBAAsB,CAAC;IAC9D,MAAM,EAAE,SAAS,CAAC;IAClB,wBAAwB,EAAE,wBAAwB,CAAC;IACnD,0BAA0B,EAAE,0BAA0B,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,aAAa,KAAK,SAAS,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export declare const APDU_RESPONSE_STATUS_CODE_LENGTH = 2;
2
+ export declare const PINGER_TIMEOUT = 800;
2
3
  //# sourceMappingURL=ApduResponseConst.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApduResponseConst.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/device-session/data/ApduResponseConst.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,IAAI,CAAC"}
1
+ {"version":3,"file":"ApduResponseConst.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/device-session/data/ApduResponseConst.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,eAAO,MAAM,cAAc,MAAM,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type GetAppAndVersionResponse, type TransportConnectedDevice } from "../../../api/index";
2
2
  import { type Command, type CommandResult, type LoggerPublisherService } from "../../../api/types";
3
3
  import { type DeviceSessionEventDispatcher } from "../../device-session/model/DeviceSessionEventDispatcher";
4
- type SendCommandFunction = <Response, Args, ErrorStatusCodes>(command: Command<Response, Args, ErrorStatusCodes>) => Promise<CommandResult<Response, ErrorStatusCodes>>;
4
+ type SendCommandFunction = <Response, Args, ErrorStatusCodes>(command: Command<Response, Args, ErrorStatusCodes>, abortTimeout?: number) => Promise<CommandResult<Response, ErrorStatusCodes>>;
5
5
  export declare class DevicePinger {
6
6
  private connectedDevice;
7
7
  private _sessionEventDispatcher;
@@ -1 +1 @@
1
- {"version":3,"file":"DevicePinger.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/device-session/model/DevicePinger.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,wBAAwB,EAE7B,KAAK,wBAAwB,EAC9B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,4BAA4B,EAGlC,MAAM,6DAA6D,CAAC;AAErE,KAAK,mBAAmB,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAC1D,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,gBAAgB,CAAC,KAC/C,OAAO,CAAC,aAAa,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAExD,qBAAa,YAAY;IAOrB,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,uBAAuB;IAPjC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAsB;IAC3D,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,OAAO,CAAyB;gBAGtC,mBAAmB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,sBAAsB,EACpD,eAAe,EAAE,wBAAwB,EACzC,uBAAuB,EAAE,4BAA4B,EAC7D,m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
@@ -47,7 +47,7 @@ export declare class DeviceSession {
47
47
  get state(): Observable<DeviceSessionState>;
48
48
  setDeviceSessionState(state: DeviceSessionState): void;
49
49
  sendApdu(rawApdu: Uint8Array, options?: SendApduOptions): Promise<Either<DmkError, ApduResponse>>;
50
- sendCommand<Response, Args, ErrorStatusCodes>(command: Command<Response, Args, ErrorStatusCodes>): Promise<CommandResult<Response, ErrorStatusCodes>>;
50
+ sendCommand<Response, Args, ErrorStatusCodes>(command: Command<Response, Args, ErrorStatusCodes>, abortTimeout?: number): Promise<CommandResult<Response, ErrorStatusCodes>>;
51
51
  executeDeviceAction<Output, Input, E extends DmkError, IntermediateValue extends DeviceActionIntermediateValue>(deviceAction: DeviceAction<Output, Input, E, IntermediateValue>): ExecuteDeviceActionReturnType<Output, E, IntermediateValue>;
52
52
  close(): void;
53
53
  disableRefresher(id: string): () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceSession.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/device-session/model/DeviceSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAGxD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGtE,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EACnC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,KAAK,sBAAsB,EAA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AAM,EAAE,KAAK,EAAE,CAAC,EAAE,iBAAiB,CAAC,GAC9D,6BAA6B,CAAC,MAAM,EAAE,CAAC,EAAE,iBAAiB,CAAC;IAqBvD,KAAK,IAAI,IAAI;IAMb,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,IAAI;IAI/C,OAAO,CAAC,mBAAmB;CAI5B"}
@@ -5,6 +5,6 @@ import { type TransportService } from "../../transport/service/TransportService"
5
5
  export declare class StopDiscoveringUseCase {
6
6
  private transportService;
7
7
  constructor(transportService: TransportService);
8
- execute(): void;
8
+ execute(): Promise<void>;
9
9
  }
10
10
  //# sourceMappingURL=StopDiscoveringUseCase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StopDiscoveringUseCase.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/discovery/use-case/StopDiscoveringUseCase.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAErF;;GAEG;AACH,qBACa,sBAAsB;IAG/B,OAAO,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,gBAAgB;IAG5C,OAAO,IAAI,IAAI;CAKhB"}
1
+ {"version":3,"file":"StopDiscoveringUseCase.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/discovery/use-case/StopDiscoveringUseCase.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAErF;;GAEG;AACH,qBACa,sBAAsB;IAG/B,OAAO,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,gBAAgB;IAGtC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAK/B"}