@ledgerhq/device-management-kit 0.0.0-rnble-transport-20250401145214 → 0.0.0-rnble-transport-20250404160243

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 (129) hide show
  1. package/README.md +34 -0
  2. package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
  3. package/lib/cjs/src/api/DeviceManagementKit.js.map +3 -3
  4. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  5. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +3 -3
  6. package/lib/cjs/src/api/DeviceManagementKitBuilder.js +1 -1
  7. package/lib/cjs/src/api/DeviceManagementKitBuilder.js.map +2 -2
  8. package/lib/cjs/src/api/DmkConfig.js +1 -1
  9. package/lib/cjs/src/api/DmkConfig.js.map +1 -1
  10. package/lib/cjs/src/api/index.js +1 -1
  11. package/lib/cjs/src/api/index.js.map +2 -2
  12. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
  13. package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  14. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
  15. package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
  16. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
  17. package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
  18. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  19. package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +2 -2
  20. package/lib/cjs/src/di.js +1 -1
  21. package/lib/cjs/src/di.js.map +2 -2
  22. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  23. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  24. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  25. package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  26. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
  27. package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
  28. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  29. package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  30. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
  31. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  32. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  33. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  34. package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js +1 -1
  35. package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js.map +2 -2
  36. package/lib/cjs/src/internal/manager-api/model/Const.js +1 -1
  37. package/lib/cjs/src/internal/manager-api/model/Const.js.map +3 -3
  38. package/lib/cjs/src/internal/manager-api/model/Params.js +1 -1
  39. package/lib/cjs/src/internal/manager-api/model/Params.js.map +1 -1
  40. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  41. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  42. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  43. package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +2 -2
  44. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
  45. package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
  46. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js +2 -0
  47. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js.map +7 -0
  48. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js +2 -0
  49. package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +7 -0
  50. package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
  51. package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
  52. package/lib/esm/src/api/DeviceManagementKit.js +1 -1
  53. package/lib/esm/src/api/DeviceManagementKit.js.map +3 -3
  54. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  55. package/lib/esm/src/api/DeviceManagementKit.test.js.map +3 -3
  56. package/lib/esm/src/api/DeviceManagementKitBuilder.js +1 -1
  57. package/lib/esm/src/api/DeviceManagementKitBuilder.js.map +3 -3
  58. package/lib/esm/src/api/index.js +1 -1
  59. package/lib/esm/src/api/index.js.map +2 -2
  60. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
  61. package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
  62. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
  63. package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
  64. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
  65. package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
  66. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
  67. package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +2 -2
  68. package/lib/esm/src/di.js +1 -1
  69. package/lib/esm/src/di.js.map +3 -3
  70. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
  71. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
  72. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
  73. package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
  74. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
  75. package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
  76. package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
  77. package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  78. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  79. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  80. package/lib/esm/src/internal/manager-api/di/managerApiTypes.js +1 -1
  81. package/lib/esm/src/internal/manager-api/di/managerApiTypes.js.map +2 -2
  82. package/lib/esm/src/internal/manager-api/model/Const.js +1 -1
  83. package/lib/esm/src/internal/manager-api/model/Const.js.map +3 -3
  84. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
  85. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
  86. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
  87. package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +2 -2
  88. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js +2 -0
  89. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js.map +7 -0
  90. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js +2 -0
  91. package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +7 -0
  92. package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
  93. package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
  94. package/lib/types/src/api/DeviceManagementKit.d.ts +10 -0
  95. package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
  96. package/lib/types/src/api/DeviceManagementKitBuilder.d.ts.map +1 -1
  97. package/lib/types/src/api/DmkConfig.d.ts +1 -0
  98. package/lib/types/src/api/DmkConfig.d.ts.map +1 -1
  99. package/lib/types/src/api/index.d.ts +1 -1
  100. package/lib/types/src/api/index.d.ts.map +1 -1
  101. package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -1
  102. package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -1
  103. package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -1
  104. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +7 -6
  105. package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -1
  106. package/lib/types/src/di.d.ts.map +1 -1
  107. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +5 -2
  108. package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +1 -1
  109. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +10 -0
  110. package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
  111. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +2 -0
  112. package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
  113. package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
  114. package/lib/types/src/internal/manager-api/di/managerApiTypes.d.ts +1 -0
  115. package/lib/types/src/internal/manager-api/di/managerApiTypes.d.ts.map +1 -1
  116. package/lib/types/src/internal/manager-api/model/Const.d.ts +1 -0
  117. package/lib/types/src/internal/manager-api/model/Const.d.ts.map +1 -1
  118. package/lib/types/src/internal/manager-api/model/Params.d.ts +0 -6
  119. package/lib/types/src/internal/manager-api/model/Params.d.ts.map +1 -1
  120. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +3 -3
  121. package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
  122. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +3 -6
  123. package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
  124. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts +11 -0
  125. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts.map +1 -0
  126. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.test.d.ts +2 -0
  127. package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.test.d.ts.map +1 -0
  128. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  129. package/package.json +1 -1
package/README.md CHANGED
@@ -80,6 +80,40 @@ export const sdk = new DeviceManagementKitBuilder()
80
80
  .build();
81
81
  ```
82
82
 
83
+ ### Add a custom Manager API Provider
84
+
85
+ Custom providers can be set in two ways:
86
+
87
+ - At build time:
88
+
89
+ ```ts
90
+ import {
91
+ ConsoleLogger,
92
+ DeviceManagementKitBuilder,
93
+ } from "@ledgerhq/device-management-kit";
94
+ import { webHidTransportFactory } from "@ledgerhq/device-transport-kit-web-hid";
95
+
96
+ export const sdk = new DeviceManagementKitBuilder()
97
+ .addLogger(new ConsoleLogger())
98
+ .addTransport(webHidTransportFactory)
99
+ .addConfig({ provider: 123 }) // using provider key in the addConfig obj
100
+ .build();
101
+ ```
102
+
103
+ - At runtime:
104
+
105
+ ```ts
106
+ dmk.setProvider(123); // using the setProvider from DMK
107
+ ```
108
+
109
+ ### Get the current provider
110
+
111
+ getProvider function will return the current provider set within the Device Management Kit, whether it has been set at build or run time:
112
+
113
+ ```ts
114
+ dmk.getProvider();
115
+ ```
116
+
83
117
  ### Connecting to a Device
84
118
 
85
119
  There are two steps to connecting to a device:
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},g=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of d(e))!u.call(t,i)&&i!==o&&c(t,i,{get:()=>e[i],enumerable:!(n=D(e,i))||n.enumerable});return t};var y=t=>g(c({},"__esModule",{value:!0}),t);var A={};U(A,{DeviceManagementKit:()=>S});module.exports=y(A);var a=require("./command/di/commandTypes"),C=require("../internal/config/di/configTypes"),r=require("../internal/device-session/di/deviceSessionTypes"),s=require("../internal/discovery/di/discoveryTypes"),p=require("../internal/send/di/sendTypes"),m=require("../../src/di"),v=require("./device-action/di/deviceActionTypes");class S{container;constructor({stub:e,transports:o,loggers:n,config:i}={}){this.container=(0,m.makeContainer)({stub:e,transports:o,loggers:n,config:i})}getVersion(){return this.container.get(C.configTypes.GetDmkVersionUseCase).getDmkVersion()}startDiscovering(e){return this.container.get(s.discoveryTypes.StartDiscoveringUseCase).execute(e)}stopDiscovering(){return this.container.get(s.discoveryTypes.StopDiscoveringUseCase).execute()}listenToAvailableDevices(e){return this.container.get(s.discoveryTypes.ListenToAvailableDevicesUseCase).execute(e)}connect(e){return this.container.get(s.discoveryTypes.ConnectUseCase).execute(e)}disconnect(e){return this.container.get(s.discoveryTypes.DisconnectUseCase).execute(e)}sendApdu(e){return this.container.get(p.sendTypes.SendApduUseCase).execute(e)}sendCommand(e){return this.container.get(a.commandTypes.SendCommandUseCase).execute(e)}executeDeviceAction(e){return this.container.get(v.deviceActionTypes.ExecuteDeviceActionUseCase).execute(e)}getConnectedDevice(e){return this.container.get(s.discoveryTypes.GetConnectedDeviceUseCase).execute(e)}getDeviceSessionState(e){return this.container.get(r.deviceSessionTypes.GetDeviceSessionStateUseCase).execute(e)}close(){return this.container.get(r.deviceSessionTypes.CloseSessionsUseCase).execute()}listConnectedDevices(){return this.container.get(s.discoveryTypes.ListConnectedDevicesUseCase).execute()}listenToConnectedDevice(){return this.container.get(s.discoveryTypes.ListenToConnectedDeviceUseCase).execute()}disableDeviceSessionRefresher(e){return this.container.get(r.deviceSessionTypes.DisableDeviceSessionRefresherUseCase).execute(e)}}0&&(module.exports={DeviceManagementKit});
1
+ "use strict";var c=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var i in e)c(t,i,{get:e[i],enumerable:!0})},y=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of u(e))!U.call(t,r)&&r!==i&&c(t,r,{get:()=>e[r],enumerable:!(o=D(e,r))||o.enumerable});return t};var S=t=>y(c({},"__esModule",{value:!0}),t);var l={};g(l,{DeviceManagementKit:()=>A});module.exports=S(l);var p=require("./command/di/commandTypes"),m=require("../internal/config/di/configTypes"),n=require("../internal/device-session/di/deviceSessionTypes"),s=require("../internal/discovery/di/discoveryTypes"),a=require("../internal/manager-api/di/managerApiTypes"),C=require("../internal/send/di/sendTypes"),v=require("../../src/di"),d=require("./device-action/di/deviceActionTypes");class A{container;constructor({stub:e,transports:i,loggers:o,config:r}={}){this.container=(0,v.makeContainer)({stub:e,transports:i,loggers:o,config:r})}getVersion(){return this.container.get(m.configTypes.GetDmkVersionUseCase).getDmkVersion()}startDiscovering(e){return this.container.get(s.discoveryTypes.StartDiscoveringUseCase).execute(e)}stopDiscovering(){return this.container.get(s.discoveryTypes.StopDiscoveringUseCase).execute()}listenToAvailableDevices(e){return this.container.get(s.discoveryTypes.ListenToAvailableDevicesUseCase).execute(e)}connect(e){return this.container.get(s.discoveryTypes.ConnectUseCase).execute(e)}disconnect(e){return this.container.get(s.discoveryTypes.DisconnectUseCase).execute(e)}sendApdu(e){return this.container.get(C.sendTypes.SendApduUseCase).execute(e)}sendCommand(e){return this.container.get(p.commandTypes.SendCommandUseCase).execute(e)}executeDeviceAction(e){return this.container.get(d.deviceActionTypes.ExecuteDeviceActionUseCase).execute(e)}getConnectedDevice(e){return this.container.get(s.discoveryTypes.GetConnectedDeviceUseCase).execute(e)}getDeviceSessionState(e){return this.container.get(n.deviceSessionTypes.GetDeviceSessionStateUseCase).execute(e)}close(){return this.container.get(n.deviceSessionTypes.CloseSessionsUseCase).execute()}listConnectedDevices(){return this.container.get(s.discoveryTypes.ListConnectedDevicesUseCase).execute()}listenToConnectedDevice(){return this.container.get(s.discoveryTypes.ListenToConnectedDeviceUseCase).execute()}disableDeviceSessionRefresher(e){return this.container.get(n.deviceSessionTypes.DisableDeviceSessionRefresherUseCase).execute(e)}setProvider(e){return this.container.get(a.managerApiTypes.SetProviderUseCase).execute(e)}getProvider(){return this.container.get(a.managerApiTypes.ManagerApiDataSource).getProvider()}}0&&(module.exports={DeviceManagementKit});
2
2
  //# sourceMappingURL=DeviceManagementKit.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/DeviceManagementKit.ts"],
4
- "sourcesContent": ["import { type Container } from \"inversify\";\nimport { type Observable } from \"rxjs\";\n\nimport { commandTypes } from \"@api/command/di/commandTypes\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport {\n type SendCommandUseCase,\n type SendCommandUseCaseArgs,\n} from \"@api/command/use-case/SendCommandUseCase\";\nimport {\n type ExecuteDeviceActionUseCase,\n type ExecuteDeviceActionUseCaseArgs,\n} from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceSessionId } from \"@api/device-session/types\";\nimport { type ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nimport {\n type ConnectUseCaseArgs,\n type DisconnectUseCaseArgs,\n type DiscoveredDevice,\n type GetConnectedDeviceUseCaseArgs,\n type SendApduUseCaseArgs,\n type StartDiscoveringUseCaseArgs,\n} from \"@api/types\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { type GetDmkVersionUseCase } from \"@internal/config/use-case/GetDmkVersionUseCase\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { type CloseSessionsUseCase } from \"@internal/device-session/use-case/CloseSessionsUseCase\";\nimport { type GetDeviceSessionStateUseCase } from \"@internal/device-session/use-case/GetDeviceSessionStateUseCase\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { type ConnectUseCase } from \"@internal/discovery/use-case/ConnectUseCase\";\nimport { type DisconnectUseCase } from \"@internal/discovery/use-case/DisconnectUseCase\";\nimport { type GetConnectedDeviceUseCase } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nimport { type ListConnectedDevicesUseCase } from \"@internal/discovery/use-case/ListConnectedDevicesUseCase\";\nimport {\n type ListenToAvailableDevicesUseCase,\n type ListenToAvailableDevicesUseCaseArgs,\n} from \"@internal/discovery/use-case/ListenToAvailableDevicesUseCase\";\nimport { type ListenToConnectedDeviceUseCase } from \"@internal/discovery/use-case/ListenToConnectedDeviceUseCase\";\nimport type { StartDiscoveringUseCase } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nimport type { StopDiscoveringUseCase } from \"@internal/discovery/use-case/StopDiscoveringUseCase\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport { type SendApduUseCase } from \"@internal/send/use-case/SendApduUseCase\";\nimport { makeContainer, type MakeContainerProps } from \"@root/src/di\";\n\nimport {\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"./device-action/DeviceAction\";\nimport { deviceActionTypes } from \"./device-action/di/deviceActionTypes\";\nimport { type DisableDeviceSessionRefresherUseCase } from \"./device-session/use-case/DisableDeviceSessionRefresher\";\nimport { type DmkError } from \"./Error\";\n\n/**\n * The main class to interact with the Device Management Kit.\n *\n * NB: do not instantiate this class directly, instead, use `LedgerDMKBuilder`.\n */\nexport class DeviceManagementKit {\n readonly container: Container;\n /** @internal */\n constructor({\n stub,\n transports,\n loggers,\n config,\n }: Partial<MakeContainerProps> = {}) {\n // NOTE: MakeContainerProps might not be the exact type here\n // For the init of the project this is sufficient, but we might need to\n // update the constructor arguments as we go (we might have more than just the container config)\n this.container = makeContainer({\n stub,\n transports,\n loggers,\n config,\n });\n }\n\n /**\n * Returns a promise resolving to the version of the SDK.\n */\n getVersion(): Promise<string> {\n return this.container\n .get<GetDmkVersionUseCase>(configTypes.GetDmkVersionUseCase)\n .getDmkVersion();\n }\n\n /**\n * Starts discovering devices connected.\n *\n * For the WeHID implementation, this use-case needs to be called as a result\n * of an user interaction (button \"click\" event for ex).\n *\n * @param {StartDiscoveringUseCaseArgs} args - The transport to use for discover, or undefined to discover from all transports.\n * @returns {Observable<DiscoveredDevice>} An observable of discovered devices.\n */\n startDiscovering(\n args: StartDiscoveringUseCaseArgs,\n ): Observable<DiscoveredDevice> {\n return this.container\n .get<StartDiscoveringUseCase>(discoveryTypes.StartDiscoveringUseCase)\n .execute(args);\n }\n\n /**\n * Stops discovering devices connected.\n */\n stopDiscovering() {\n return this.container\n .get<StopDiscoveringUseCase>(discoveryTypes.StopDiscoveringUseCase)\n .execute();\n }\n\n /**\n * Listen to list of known discovered devices (and later BLE).\n * @param {ListenToAvailableDevicesUseCaseArgs} args - The transport to use for discover, or undefined to discover from all transports.\n * @returns {Observable<DiscoveredDevice[]>} An observable of known discovered devices.\n */\n listenToAvailableDevices(\n args: ListenToAvailableDevicesUseCaseArgs,\n ): Observable<DiscoveredDevice[]> {\n return this.container\n .get<ListenToAvailableDevicesUseCase>(\n discoveryTypes.ListenToAvailableDevicesUseCase,\n )\n .execute(args);\n }\n\n /**\n * Connects to a device previously discovered with `DeviceManagementKit.startDiscovering`.\n * Creates a new device session which:\n * - Represents the connection to the device.\n * - Is terminated upon disconnection of the device.\n * - Exposes the device state through an observable (see `DeviceManagementKit.getDeviceSessionState`)\n * - Should be used for all subsequent communication with the device.\n *\n * @param {ConnectUseCaseArgs} args - The arguments for connecting to the device.\n * - `device`: The discovered device obtained from `StartDiscoveringUseCase`.\n * - `sessionRefresherOptions` (optional): Configuration for session refreshing.\n * - `isRefresherDisabled`: Whether the refresher is disabled.\n * - `pollingInterval`: The refresh interval in milliseconds\n * @returns The session ID to use for further communication with the device.\n */\n connect(args: ConnectUseCaseArgs): Promise<DeviceSessionId> {\n return this.container\n .get<ConnectUseCase>(discoveryTypes.ConnectUseCase)\n .execute(args);\n }\n\n /**\n * Disconnects to a discovered device.\n *\n * @param {DisconnectUseCaseArgs} args - The session ID to disconnect.\n */\n disconnect(args: DisconnectUseCaseArgs): Promise<void> {\n return this.container\n .get<DisconnectUseCase>(discoveryTypes.DisconnectUseCase)\n .execute(args);\n }\n\n /**\n * Sends an APDU command to a device through a device session.\n *\n * @param {SendApduUseCaseArgs} args - The device session ID and APDU command to send.\n */\n sendApdu(args: SendApduUseCaseArgs): Promise<ApduResponse> {\n return this.container\n .get<SendApduUseCase>(sendTypes.SendApduUseCase)\n .execute(args);\n }\n\n /**\n * Sends a command to a device through a device session.\n *\n * @param {SendCommandUseCaseArgs<Response, Args, ErrorCodes>} args - The device session ID, command, command error codes and command parameters to send.\n * @returns A promise resolving with the response from the command.\n */\n sendCommand<Response, Args, ErrorCodes>(\n args: SendCommandUseCaseArgs<Response, Args, ErrorCodes>,\n ): Promise<CommandResult<Response, ErrorCodes>> {\n return this.container\n .get<SendCommandUseCase>(commandTypes.SendCommandUseCase)\n .execute(args);\n }\n\n executeDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n >(\n args: ExecuteDeviceActionUseCaseArgs<\n Output,\n Input,\n Error,\n IntermediateValue\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n return this.container\n .get<ExecuteDeviceActionUseCase>(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n )\n .execute(args);\n }\n\n /**\n * Gets the connected from its device session ID.\n *\n * @param {GetConnectedDeviceUseCaseArgs} args - The device session ID.\n * @returns {ConnectedDevice} The connected device.\n */\n getConnectedDevice(args: GetConnectedDeviceUseCaseArgs): ConnectedDevice {\n return this.container\n .get<GetConnectedDeviceUseCase>(discoveryTypes.GetConnectedDeviceUseCase)\n .execute(args);\n }\n\n /**\n * Gets the device state of a session.\n *\n * @param {{ sessionId: DeviceSessionId }} args - The device session ID.\n * @returns {Observable<DeviceSessionState>} An observable of the session device state.\n */\n getDeviceSessionState(args: {\n sessionId: DeviceSessionId;\n }): Observable<DeviceSessionState> {\n return this.container\n .get<GetDeviceSessionStateUseCase>(\n deviceSessionTypes.GetDeviceSessionStateUseCase,\n )\n .execute(args);\n }\n\n /**\n * Close the Device Management kit.\n *\n */\n close() {\n return this.container\n .get<CloseSessionsUseCase>(deviceSessionTypes.CloseSessionsUseCase)\n .execute();\n }\n\n /**\n * Lists all connected devices.\n *\n * @returns {ConnectedDevice[]} The list of device sessions.\n */\n listConnectedDevices(): ConnectedDevice[] {\n return this.container\n .get<ListConnectedDevicesUseCase>(\n discoveryTypes.ListConnectedDevicesUseCase,\n )\n .execute();\n }\n\n /**\n * Listen to connected device.\n *\n * @returns {Observable<ConnectedDevice>} An observable of connected device.\n */\n listenToConnectedDevice(): Observable<ConnectedDevice> {\n return this.container\n .get<ListenToConnectedDeviceUseCase>(\n discoveryTypes.ListenToConnectedDeviceUseCase,\n )\n .execute();\n }\n\n /**\n * Disable the device session refresher.\n *\n * @param {DisableDeviceSessionRefresherUseCaseArgs} args - The device session ID and a string to identify the blocker.\n * @returns {() => void} A function to reenable the device session refresher.\n */\n disableDeviceSessionRefresher(args: {\n sessionId: DeviceSessionId;\n blockerId: string;\n }) {\n return this.container\n .get<DisableDeviceSessionRefresherUseCase>(\n deviceSessionTypes.DisableDeviceSessionRefresherUseCase,\n )\n .execute(args);\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAGA,IAAAI,EAA6B,wCAsB7BC,EAA4B,2CAE5BC,EAAmC,0DAGnCC,EAA+B,iDAY/BC,EAA0B,uCAE1BC,EAAuD,wBAMvDC,EAAkC,gDAS3B,MAAMR,CAAoB,CACtB,UAET,YAAY,CACV,KAAAS,EACA,WAAAC,EACA,Q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B,EACC,QAAQ,CACb,CAOA,yBAAuD,CACrD,OAAO,KAAK,UACT,IACC,iBAAe,8BACjB,EACC,QAAQ,CACb,CAQA,8BAA8BA,EAG3B,CACD,OAAO,KAAK,UACT,IACC,qBAAmB,oCACrB,EACC,QAAQA,CAAI,CACjB,CACF",
6
- "names": ["DeviceManagementKit_exports", "__export", "DeviceManagementKit", "__toCommonJS", "import_commandTypes", "import_configTypes", "import_deviceSessionTypes", "import_discoveryTypes", "import_sendTypes", "import_di", "import_deviceActionTypes", "stub", "transports", "loggers", "config", "args"]
4
+ "sourcesContent": ["import { type Container } from \"inversify\";\nimport { type Observable } from \"rxjs\";\n\nimport { commandTypes } from \"@api/command/di/commandTypes\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport {\n type SendCommandUseCase,\n type SendCommandUseCaseArgs,\n} from \"@api/command/use-case/SendCommandUseCase\";\nimport {\n type ExecuteDeviceActionUseCase,\n type ExecuteDeviceActionUseCaseArgs,\n} from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceSessionId } from \"@api/device-session/types\";\nimport { type ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nimport {\n type ConnectUseCaseArgs,\n type DisconnectUseCaseArgs,\n type DiscoveredDevice,\n type GetConnectedDeviceUseCaseArgs,\n type SendApduUseCaseArgs,\n type StartDiscoveringUseCaseArgs,\n} from \"@api/types\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { type GetDmkVersionUseCase } from \"@internal/config/use-case/GetDmkVersionUseCase\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { type CloseSessionsUseCase } from \"@internal/device-session/use-case/CloseSessionsUseCase\";\nimport { type GetDeviceSessionStateUseCase } from \"@internal/device-session/use-case/GetDeviceSessionStateUseCase\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { type ConnectUseCase } from \"@internal/discovery/use-case/ConnectUseCase\";\nimport { type DisconnectUseCase } from \"@internal/discovery/use-case/DisconnectUseCase\";\nimport { type GetConnectedDeviceUseCase } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nimport { type ListConnectedDevicesUseCase } from \"@internal/discovery/use-case/ListConnectedDevicesUseCase\";\nimport {\n type ListenToAvailableDevicesUseCase,\n type ListenToAvailableDevicesUseCaseArgs,\n} from \"@internal/discovery/use-case/ListenToAvailableDevicesUseCase\";\nimport { type ListenToConnectedDeviceUseCase } from \"@internal/discovery/use-case/ListenToConnectedDeviceUseCase\";\nimport type { StartDiscoveringUseCase } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nimport type { StopDiscoveringUseCase } from \"@internal/discovery/use-case/StopDiscoveringUseCase\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { managerApiTypes } from \"@internal/manager-api/di/managerApiTypes\";\nimport { type SetProviderUseCase } from \"@internal/manager-api/use-case/SetProviderUseCase\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport { type SendApduUseCase } from \"@internal/send/use-case/SendApduUseCase\";\nimport { makeContainer, type MakeContainerProps } from \"@root/src/di\";\n\nimport {\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"./device-action/DeviceAction\";\nimport { deviceActionTypes } from \"./device-action/di/deviceActionTypes\";\nimport { type DisableDeviceSessionRefresherUseCase } from \"./device-session/use-case/DisableDeviceSessionRefresher\";\nimport { type DmkError } from \"./Error\";\n\n/**\n * The main class to interact with the Device Management Kit.\n *\n * NB: do not instantiate this class directly, instead, use `LedgerDMKBuilder`.\n */\nexport class DeviceManagementKit {\n readonly container: Container;\n /** @internal */\n constructor({\n stub,\n transports,\n loggers,\n config,\n }: Partial<MakeContainerProps> = {}) {\n // NOTE: MakeContainerProps might not be the exact type here\n // For the init of the project this is sufficient, but we might need to\n // update the constructor arguments as we go (we might have more than just the container config)\n this.container = makeContainer({\n stub,\n transports,\n loggers,\n config,\n });\n }\n\n /**\n * Returns a promise resolving to the version of the SDK.\n */\n getVersion(): Promise<string> {\n return this.container\n .get<GetDmkVersionUseCase>(configTypes.GetDmkVersionUseCase)\n .getDmkVersion();\n }\n\n /**\n * Starts discovering devices connected.\n *\n * For the WeHID implementation, this use-case needs to be called as a result\n * of an user interaction (button \"click\" event for ex).\n *\n * @param {StartDiscoveringUseCaseArgs} args - The transport to use for discover, or undefined to discover from all transports.\n * @returns {Observable<DiscoveredDevice>} An observable of discovered devices.\n */\n startDiscovering(\n args: StartDiscoveringUseCaseArgs,\n ): Observable<DiscoveredDevice> {\n return this.container\n .get<StartDiscoveringUseCase>(discoveryTypes.StartDiscoveringUseCase)\n .execute(args);\n }\n\n /**\n * Stops discovering devices connected.\n */\n stopDiscovering() {\n return this.container\n .get<StopDiscoveringUseCase>(discoveryTypes.StopDiscoveringUseCase)\n .execute();\n }\n\n /**\n * Listen to list of known discovered devices (and later BLE).\n * @param {ListenToAvailableDevicesUseCaseArgs} args - The transport to use for discover, or undefined to discover from all transports.\n * @returns {Observable<DiscoveredDevice[]>} An observable of known discovered devices.\n */\n listenToAvailableDevices(\n args: ListenToAvailableDevicesUseCaseArgs,\n ): Observable<DiscoveredDevice[]> {\n return this.container\n .get<ListenToAvailableDevicesUseCase>(\n discoveryTypes.ListenToAvailableDevicesUseCase,\n )\n .execute(args);\n }\n\n /**\n * Connects to a device previously discovered with `DeviceManagementKit.startDiscovering`.\n * Creates a new device session which:\n * - Represents the connection to the device.\n * - Is terminated upon disconnection of the device.\n * - Exposes the device state through an observable (see `DeviceManagementKit.getDeviceSessionState`)\n * - Should be used for all subsequent communication with the device.\n *\n * @param {ConnectUseCaseArgs} args - The arguments for connecting to the device.\n * - `device`: The discovered device obtained from `StartDiscoveringUseCase`.\n * - `sessionRefresherOptions` (optional): Configuration for session refreshing.\n * - `isRefresherDisabled`: Whether the refresher is disabled.\n * - `pollingInterval`: The refresh interval in milliseconds\n * @returns The session ID to use for further communication with the device.\n */\n connect(args: ConnectUseCaseArgs): Promise<DeviceSessionId> {\n return this.container\n .get<ConnectUseCase>(discoveryTypes.ConnectUseCase)\n .execute(args);\n }\n\n /**\n * Disconnects to a discovered device.\n *\n * @param {DisconnectUseCaseArgs} args - The session ID to disconnect.\n */\n disconnect(args: DisconnectUseCaseArgs): Promise<void> {\n return this.container\n .get<DisconnectUseCase>(discoveryTypes.DisconnectUseCase)\n .execute(args);\n }\n\n /**\n * Sends an APDU command to a device through a device session.\n *\n * @param {SendApduUseCaseArgs} args - The device session ID and APDU command to send.\n */\n sendApdu(args: SendApduUseCaseArgs): Promise<ApduResponse> {\n return this.container\n .get<SendApduUseCase>(sendTypes.SendApduUseCase)\n .execute(args);\n }\n\n /**\n * Sends a command to a device through a device session.\n *\n * @param {SendCommandUseCaseArgs<Response, Args, ErrorCodes>} args - The device session ID, command, command error codes and command parameters to send.\n * @returns A promise resolving with the response from the command.\n */\n sendCommand<Response, Args, ErrorCodes>(\n args: SendCommandUseCaseArgs<Response, Args, ErrorCodes>,\n ): Promise<CommandResult<Response, ErrorCodes>> {\n return this.container\n .get<SendCommandUseCase>(commandTypes.SendCommandUseCase)\n .execute(args);\n }\n\n executeDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n >(\n args: ExecuteDeviceActionUseCaseArgs<\n Output,\n Input,\n Error,\n IntermediateValue\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n return this.container\n .get<ExecuteDeviceActionUseCase>(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n )\n .execute(args);\n }\n\n /**\n * Gets the connected from its device session ID.\n *\n * @param {GetConnectedDeviceUseCaseArgs} args - The device session ID.\n * @returns {ConnectedDevice} The connected device.\n */\n getConnectedDevice(args: GetConnectedDeviceUseCaseArgs): ConnectedDevice {\n return this.container\n .get<GetConnectedDeviceUseCase>(discoveryTypes.GetConnectedDeviceUseCase)\n .execute(args);\n }\n\n /**\n * Gets the device state of a session.\n *\n * @param {{ sessionId: DeviceSessionId }} args - The device session ID.\n * @returns {Observable<DeviceSessionState>} An observable of the session device state.\n */\n getDeviceSessionState(args: {\n sessionId: DeviceSessionId;\n }): Observable<DeviceSessionState> {\n return this.container\n .get<GetDeviceSessionStateUseCase>(\n deviceSessionTypes.GetDeviceSessionStateUseCase,\n )\n .execute(args);\n }\n\n /**\n * Close the Device Management kit.\n *\n */\n close() {\n return this.container\n .get<CloseSessionsUseCase>(deviceSessionTypes.CloseSessionsUseCase)\n .execute();\n }\n\n /**\n * Lists all connected devices.\n *\n * @returns {ConnectedDevice[]} The list of device sessions.\n */\n listConnectedDevices(): ConnectedDevice[] {\n return this.container\n .get<ListConnectedDevicesUseCase>(\n discoveryTypes.ListConnectedDevicesUseCase,\n )\n .execute();\n }\n\n /**\n * Listen to connected device.\n *\n * @returns {Observable<ConnectedDevice>} An observable of connected device.\n */\n listenToConnectedDevice(): Observable<ConnectedDevice> {\n return this.container\n .get<ListenToConnectedDeviceUseCase>(\n discoveryTypes.ListenToConnectedDeviceUseCase,\n )\n .execute();\n }\n\n /**\n * Disable the device session refresher.\n *\n * @param {DisableDeviceSessionRefresherUseCaseArgs} args - The device session ID and a string to identify the blocker.\n * @returns {() => void} A function to reenable the device session refresher.\n */\n disableDeviceSessionRefresher(args: {\n sessionId: DeviceSessionId;\n blockerId: string;\n }): () => void {\n return this.container\n .get<DisableDeviceSessionRefresherUseCase>(\n deviceSessionTypes.DisableDeviceSessionRefresherUseCase,\n )\n .execute(args);\n }\n /**\n * Sets the provider for the manager API.\n *\n * @param {number} provider - The provider to set.\n */\n setProvider(provider: number): void {\n return this.container\n .get<SetProviderUseCase>(managerApiTypes.SetProviderUseCase)\n .execute(provider);\n }\n\n /**\n * Returns the current provider value from the manager API data source.\n */\n getProvider(): number {\n return this.container\n .get<ManagerApiDataSource>(managerApiTypes.ManagerApiDataSource)\n .getProvider();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AmBA,EAAsD,CACvE,OAAO,KAAK,UACT,IAA+B,iBAAe,yBAAyB,EACvE,QAAQA,CAAI,CACjB,CAQA,sBAAsBA,EAEa,CACjC,OAAO,KAAK,UACT,IACC,qBAAmB,4BACrB,EACC,QAAQA,CAAI,CACjB,CAMA,OAAQ,CACN,OAAO,KAAK,UACT,IAA0B,qBAAmB,oBAAoB,EACjE,QAAQ,CACb,CAOA,sBAA0C,CACxC,OAAO,KAAK,UACT,IACC,iBAAe,2BACjB,EACC,QAAQ,CACb,CAOA,yBAAuD,CACrD,OAAO,KAAK,UACT,IACC,iBAAe,8BACjB,EACC,QAAQ,CACb,CAQA,8BAA8BA,EAGf,CACb,OAAO,KAAK,UACT,IACC,qBAAmB,oCACrB,EACC,QAAQA,CAAI,CACjB,CAMA,YAAYC,EAAwB,CAClC,OAAO,KAAK,UACT,IAAwB,kBAAgB,kBAAkB,EAC1D,QAAQA,CAAQ,CACrB,CAKA,aAAsB,CACpB,OAAO,KAAK,UACT,IAA0B,kBAAgB,oBAAoB,EAC9D,YAAY,CACjB,CACF",
6
+ "names": ["DeviceManagementKit_exports", "__export", "DeviceManagementKit", "__toCommonJS", "import_commandTypes", "import_configTypes", "import_deviceSessionTypes", "import_discoveryTypes", "import_managerApiTypes", "import_sendTypes", "import_di", "import_deviceActionTypes", "stub", "transports", "loggers", "config", "args", "provider"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var D=Object.create;var a=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var U=(t,o,i,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of b(o))!x.call(t,n)&&n!==i&&a(t,n,{get:()=>o[n],enumerable:!(r=C(o,n))||r.enumerable});return t};var k=(t,o,i)=>(i=t!=null?D(S(t)):{},U(o||!t||!t.__esModule?a(i,"default",{value:t,enumerable:!0}):i,t));var m=require("../internal/config/data/LocalConfigDataSource.stub"),p=require("../internal/config/di/configTypes"),f=require("../internal/device-session/di/deviceSessionTypes"),s=require("../internal/discovery/di/discoveryTypes"),l=require("../internal/send/di/sendTypes"),u=k(require("../../package.json")),h=require("../../src/di.stub"),v=require("./command/di/commandTypes"),g=require("./logger-subscriber/service/ConsoleLogger"),c=require("./DeviceManagementKit");vi.mock("./logger-subscriber/service/ConsoleLogger");let e,d;describe("DeviceManagementKit",()=>{describe("clean",()=>{beforeEach(()=>{d=new g.ConsoleLogger,e=new c.DeviceManagementKit({stub:!1,loggers:[d],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"}})}),it("should create an instance",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.DeviceManagementKit)}),it("should return a clean `version`",async()=>{expect(await e.getVersion()).toBe(u.default.version)}),it("should have startDiscovery method",()=>{expect(e.startDiscovering).toBeDefined()}),it("should have stopDiscovery method",()=>{expect(e.stopDiscovering).toBeDefined()}),it("should have connect method",()=>{expect(e.connect).toBeDefined()}),it("should have sendApdu method",()=>{expect(e.sendApdu).toBeDefined()}),it("should have getConnectedDevice method",()=>{expect(e.getConnectedDevice).toBeDefined()}),it("should have sendCommand method",()=>{expect(e.sendCommand).toBeDefined()}),it("should have listConnectedDevices method",()=>{expect(e.listConnectedDevices).toBeDefined()}),it("should have listenToConnectedDevice method",()=>{expect(e.listenToConnectedDevice).toBeDefined()}),it("should have disableDeviceSessionRefresher method",()=>{expect(e.disableDeviceSessionRefresher).toBeDefined()})}),describe("stubbed",()=>{beforeEach(()=>{e=new c.DeviceManagementKit({stub:!0,loggers:[],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"}})}),it("should create a stubbed dmk",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.DeviceManagementKit)}),it("should return a stubbed config",()=>{expect(e.container.get(p.configTypes.LocalConfigDataSource)).toBeInstanceOf(m.StubLocalConfigDataSource)}),it("should return a stubbed version",async()=>{expect(await e.getVersion()).toBe("0.0.0-stub.1")}),it.each([[s.discoveryTypes.StartDiscoveringUseCase],[s.discoveryTypes.StopDiscoveringUseCase],[s.discoveryTypes.ConnectUseCase],[l.sendTypes.SendApduUseCase],[v.commandTypes.SendCommandUseCase],[s.discoveryTypes.GetConnectedDeviceUseCase],[s.discoveryTypes.DisconnectUseCase],[f.deviceSessionTypes.GetDeviceSessionStateUseCase],[s.discoveryTypes.ListConnectedDevicesUseCase],[s.discoveryTypes.ListenToConnectedDeviceUseCase]])("should have %s use case",t=>{const o=e.container.get(t);expect(o).toBeInstanceOf(h.StubUseCase),expect(o.execute()).toBe("stub")})})});
1
+ "use strict";var C=Object.create;var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var U=(t,o,i,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of k(o))!x.call(t,n)&&n!==i&&a(t,n,{get:()=>o[n],enumerable:!(r=b(o,n))||r.enumerable});return t};var B=(t,o,i)=>(i=t!=null?C(S(t)):{},U(o||!t||!t.__esModule?a(i,"default",{value:t,enumerable:!0}):i,t));var m=require("../internal/config/data/LocalConfigDataSource.stub"),p=require("../internal/config/di/configTypes"),f=require("../internal/device-session/di/deviceSessionTypes"),s=require("../internal/discovery/di/discoveryTypes"),l=require("../internal/manager-api/di/managerApiTypes"),u=require("../internal/send/di/sendTypes"),h=B(require("../../package.json")),v=require("../../src/di.stub"),g=require("./command/di/commandTypes"),D=require("./logger-subscriber/service/ConsoleLogger"),c=require("./DeviceManagementKit");vi.mock("./logger-subscriber/service/ConsoleLogger");let e,d;describe("DeviceManagementKit",()=>{describe("clean",()=>{beforeEach(()=>{d=new D.ConsoleLogger,e=new c.DeviceManagementKit({stub:!1,loggers:[d],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"}})}),it("should create an instance",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.DeviceManagementKit)}),it("should return a clean `version`",async()=>{expect(await e.getVersion()).toBe(h.default.version)}),it("should have startDiscovery method",()=>{expect(e.startDiscovering).toBeDefined()}),it("should have stopDiscovery method",()=>{expect(e.stopDiscovering).toBeDefined()}),it("should have connect method",()=>{expect(e.connect).toBeDefined()}),it("should have sendApdu method",()=>{expect(e.sendApdu).toBeDefined()}),it("should have getConnectedDevice method",()=>{expect(e.getConnectedDevice).toBeDefined()}),it("should have sendCommand method",()=>{expect(e.sendCommand).toBeDefined()}),it("should have listConnectedDevices method",()=>{expect(e.listConnectedDevices).toBeDefined()}),it("should have listenToConnectedDevice method",()=>{expect(e.listenToConnectedDevice).toBeDefined()}),it("should have disableDeviceSessionRefresher method",()=>{expect(e.disableDeviceSessionRefresher).toBeDefined()}),it("should have setProvider method",()=>{expect(e.setProvider).toBeDefined()})}),describe("stubbed",()=>{beforeEach(()=>{e=new c.DeviceManagementKit({stub:!0,loggers:[],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url"}})}),it("should create a stubbed dmk",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.DeviceManagementKit)}),it("should return a stubbed config",()=>{expect(e.container.get(p.configTypes.LocalConfigDataSource)).toBeInstanceOf(m.StubLocalConfigDataSource)}),it("should return a stubbed version",async()=>{expect(await e.getVersion()).toBe("0.0.0-stub.1")}),it.each([[s.discoveryTypes.StartDiscoveringUseCase],[s.discoveryTypes.StopDiscoveringUseCase],[s.discoveryTypes.ConnectUseCase],[u.sendTypes.SendApduUseCase],[g.commandTypes.SendCommandUseCase],[s.discoveryTypes.GetConnectedDeviceUseCase],[s.discoveryTypes.DisconnectUseCase],[f.deviceSessionTypes.GetDeviceSessionStateUseCase],[s.discoveryTypes.ListConnectedDevicesUseCase],[s.discoveryTypes.ListenToConnectedDeviceUseCase],[l.managerApiTypes.SetProviderUseCase]])("should have %s use case",t=>{const o=e.container.get(t);expect(o).toBeInstanceOf(v.StubUseCase),expect(o.execute()).toBe("stub")})})});
2
2
  //# sourceMappingURL=DeviceManagementKit.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/DeviceManagementKit.test.ts"],
4
- "sourcesContent": ["import { type interfaces } from \"inversify\";\n\nimport { type LocalConfigDataSource } from \"@internal/config/data/ConfigDataSource\";\nimport { StubLocalConfigDataSource } from \"@internal/config/data/LocalConfigDataSource.stub\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport pkg from \"@root/package.json\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandTypes } from \"./command/di/commandTypes\";\nimport { ConsoleLogger } from \"./logger-subscriber/service/ConsoleLogger\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\n\nvi.mock(\"./logger-subscriber/service/ConsoleLogger\");\n\nlet dmk: DeviceManagementKit;\nlet logger: ConsoleLogger;\ndescribe(\"DeviceManagementKit\", () => {\n describe(\"clean\", () => {\n beforeEach(() => {\n logger = new ConsoleLogger();\n dmk = new DeviceManagementKit({\n stub: false,\n loggers: [logger],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n },\n });\n });\n\n it(\"should create an instance\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a clean `version`\", async () => {\n expect(await dmk.getVersion()).toBe(pkg.version);\n });\n\n it(\"should have startDiscovery method\", () => {\n expect(dmk.startDiscovering).toBeDefined();\n });\n\n it(\"should have stopDiscovery method\", () => {\n expect(dmk.stopDiscovering).toBeDefined();\n });\n\n it(\"should have connect method\", () => {\n expect(dmk.connect).toBeDefined();\n });\n\n it(\"should have sendApdu method\", () => {\n expect(dmk.sendApdu).toBeDefined();\n });\n\n it(\"should have getConnectedDevice method\", () => {\n expect(dmk.getConnectedDevice).toBeDefined();\n });\n\n it(\"should have sendCommand method\", () => {\n expect(dmk.sendCommand).toBeDefined();\n });\n\n it(\"should have listConnectedDevices method\", () => {\n expect(dmk.listConnectedDevices).toBeDefined();\n });\n\n it(\"should have listenToConnectedDevice method\", () => {\n expect(dmk.listenToConnectedDevice).toBeDefined();\n });\n\n it(\"should have disableDeviceSessionRefresher method\", () => {\n expect(dmk.disableDeviceSessionRefresher).toBeDefined();\n });\n });\n\n describe(\"stubbed\", () => {\n beforeEach(() => {\n dmk = new DeviceManagementKit({\n stub: true,\n loggers: [],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n },\n });\n });\n\n it(\"should create a stubbed dmk\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a stubbed config\", () => {\n expect(\n dmk.container.get<LocalConfigDataSource>(\n configTypes.LocalConfigDataSource,\n ),\n ).toBeInstanceOf(StubLocalConfigDataSource);\n });\n\n it(\"should return a stubbed version\", async () => {\n expect(await dmk.getVersion()).toBe(\"0.0.0-stub.1\");\n });\n\n it.each([\n [discoveryTypes.StartDiscoveringUseCase],\n [discoveryTypes.StopDiscoveringUseCase],\n [discoveryTypes.ConnectUseCase],\n [sendTypes.SendApduUseCase],\n [commandTypes.SendCommandUseCase],\n [discoveryTypes.GetConnectedDeviceUseCase],\n [discoveryTypes.DisconnectUseCase],\n [deviceSessionTypes.GetDeviceSessionStateUseCase],\n [discoveryTypes.ListConnectedDevicesUseCase],\n [discoveryTypes.ListenToConnectedDeviceUseCase],\n ])(\n \"should have %s use case\",\n (diSymbol: interfaces.ServiceIdentifier<StubUseCase>) => {\n const uc = dmk.container.get<StubUseCase>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Types", "import_deviceSessionTypes", "import_discoveryTypes", "import_sendTypes", "import_package", "import_di", "import_commandTypes", "import_ConsoleLogger", "import_DeviceManagementKit", "dmk", "logger", "pkg", "diSymbol", "uc"]
4
+ "sourcesContent": ["import { type interfaces } from \"inversify\";\n\nimport { type LocalConfigDataSource } from \"@internal/config/data/ConfigDataSource\";\nimport { StubLocalConfigDataSource } from \"@internal/config/data/LocalConfigDataSource.stub\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { managerApiTypes } from \"@internal/manager-api/di/managerApiTypes\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport pkg from \"@root/package.json\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandTypes } from \"./command/di/commandTypes\";\nimport { ConsoleLogger } from \"./logger-subscriber/service/ConsoleLogger\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\nimport { type DmkConfig } from \"./DmkConfig\";\n\nvi.mock(\"./logger-subscriber/service/ConsoleLogger\");\n\nlet dmk: DeviceManagementKit;\nlet logger: ConsoleLogger;\ndescribe(\"DeviceManagementKit\", () => {\n describe(\"clean\", () => {\n beforeEach(() => {\n logger = new ConsoleLogger();\n dmk = new DeviceManagementKit({\n stub: false,\n loggers: [logger],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n } as DmkConfig,\n });\n });\n\n it(\"should create an instance\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a clean `version`\", async () => {\n expect(await dmk.getVersion()).toBe(pkg.version);\n });\n\n it(\"should have startDiscovery method\", () => {\n expect(dmk.startDiscovering).toBeDefined();\n });\n\n it(\"should have stopDiscovery method\", () => {\n expect(dmk.stopDiscovering).toBeDefined();\n });\n\n it(\"should have connect method\", () => {\n expect(dmk.connect).toBeDefined();\n });\n\n it(\"should have sendApdu method\", () => {\n expect(dmk.sendApdu).toBeDefined();\n });\n\n it(\"should have getConnectedDevice method\", () => {\n expect(dmk.getConnectedDevice).toBeDefined();\n });\n\n it(\"should have sendCommand method\", () => {\n expect(dmk.sendCommand).toBeDefined();\n });\n\n it(\"should have listConnectedDevices method\", () => {\n expect(dmk.listConnectedDevices).toBeDefined();\n });\n\n it(\"should have listenToConnectedDevice method\", () => {\n expect(dmk.listenToConnectedDevice).toBeDefined();\n });\n\n it(\"should have disableDeviceSessionRefresher method\", () => {\n expect(dmk.disableDeviceSessionRefresher).toBeDefined();\n });\n\n it(\"should have setProvider method\", () => {\n expect(dmk.setProvider).toBeDefined();\n });\n });\n\n describe(\"stubbed\", () => {\n beforeEach(() => {\n dmk = new DeviceManagementKit({\n stub: true,\n loggers: [],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n } as DmkConfig,\n });\n });\n\n it(\"should create a stubbed dmk\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a stubbed config\", () => {\n expect(\n dmk.container.get<LocalConfigDataSource>(\n configTypes.LocalConfigDataSource,\n ),\n ).toBeInstanceOf(StubLocalConfigDataSource);\n });\n\n it(\"should return a stubbed version\", async () => {\n expect(await dmk.getVersion()).toBe(\"0.0.0-stub.1\");\n });\n\n it.each([\n [discoveryTypes.StartDiscoveringUseCase],\n [discoveryTypes.StopDiscoveringUseCase],\n [discoveryTypes.ConnectUseCase],\n [sendTypes.SendApduUseCase],\n [commandTypes.SendCommandUseCase],\n [discoveryTypes.GetConnectedDeviceUseCase],\n [discoveryTypes.DisconnectUseCase],\n [deviceSessionTypes.GetDeviceSessionStateUseCase],\n [discoveryTypes.ListConnectedDevicesUseCase],\n [discoveryTypes.ListenToConnectedDeviceUseCase],\n [managerApiTypes.SetProviderUseCase],\n ])(\n \"should have %s use case\",\n (diSymbol: interfaces.ServiceIdentifier<StubUseCase>) => {\n const uc = dmk.container.get<StubUseCase>(diSymbol);\n expect(uc).toBeInstanceOf(StubUseCase);\n expect(uc.execute()).toBe(\"stub\");\n },\n );\n });\n});\n"],
5
+ "mappings": "wdAGA,IAAAA,EAA0C,4DAC1CC,EAA4B,2CAC5BC,EAAmC,0DACnCC,EAA+B,iDAC/BC,EAAgC,oDAChCC,EAA0B,uCAC1BC,EAAgB,iCAChBC,EAA4B,6BAE5BC,EAA6B,qCAC7BC,EAA8B,qDAC9BC,EAAoC,iCAGpC,GAAG,KAAK,2CAA2C,EAEnD,IAAIC,EACAC,EACJ,SAAS,sBAAuB,IAAM,CACpC,SAAS,QAAS,IAAM,CACtB,WAAW,IAAM,CACfA,EAAS,IAAI,gBACbD,EAAM,IAAI,sBAAoB,CAC5B,KAAM,GACN,QAAS,CAACC,CAAM,EAChB,OAAQ,CACN,cAAe,kBACf,QAAS,uBACT,aAAc,2BAChB,CACF,CAAC,CACH,CAAC,EAED,GAAG,4BAA6B,IAAM,CACpC,OAAOD,CAAG,EAAE,YAAY,EACxB,OAAOA,CAAG,EAAE,eAAe,qBAAmB,CAChD,CAAC,EAED,GAAG,kCAAmC,SAAY,CAChD,OAAO,MAAMA,EAAI,WAAW,CAAC,EAAE,KAAK,EAAAE,QAAI,OAAO,CACjD,CAAC,EAED,GAAG,oCAAqC,IAAM,CAC5C,OAAOF,EAAI,gBAAgB,EAAE,YAAY,CAC3C,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,OAAOA,EAAI,eAAe,EAAE,YAAY,CAC1C,CAAC,EAED,GAAG,6BAA8B,IAAM,CACrC,OAAOA,EAAI,OAAO,EAAE,YAAY,CAClC,CAAC,EAED,GAAG,8BAA+B,IAAM,CACtC,OAAOA,EAAI,QAAQ,EAAE,YAAY,CACnC,CAAC,EAED,GAAG,wCAAyC,IAAM,CAChD,OAAOA,EAAI,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,CAAC,EACC,0BACCG,GAAwD,CACvD,MAAMC,EAAKJ,EAAI,UAAU,IAAiBG,CAAQ,EAClD,OAAOC,CAAE,EAAE,eAAe,aAAW,EACrC,OAAOA,EAAG,QAAQ,CAAC,EAAE,KAAK,MAAM,CAClC,CACF,CACF,CAAC,CACH,CAAC",
6
+ "names": ["import_LocalConfigDataSource", "import_configTypes", "import_deviceSessionTypes", "import_discoveryTypes", "import_managerApiTypes", "import_sendTypes", "import_package", "import_di", "import_commandTypes", "import_ConsoleLogger", "import_DeviceManagementKit", "dmk", "logger", "pkg", "diSymbol", "uc"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var u=(e,r)=>{for(var i in r)s(e,i,{get:r[i],enumerable:!0})},l=(e,r,i,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of c(r))!m.call(e,t)&&t!==i&&s(e,t,{get:()=>r[t],enumerable:!(a=p(r,t))||a.enumerable});return e};var f=e=>l(s({},"__esModule",{value:!0}),e);var b={};u(b,{DeviceManagementKitBuilder:()=>h});module.exports=f(b);var o=require("../internal/manager-api/model/Const"),n=require("../internal/secure-channel/model/Const"),g=require("./DeviceManagementKit");class h{stub=!1;loggers=[];transports=[];config={managerApiUrl:o.DEFAULT_MANAGER_API_BASE_URL,mockUrl:o.DEFAULT_MOCK_SERVER_BASE_URL,webSocketUrl:n.DEFAULT_WEB_SOCKET_BASE_URL};build(){return new g.DeviceManagementKit({stub:this.stub,transports:this.transports,loggers:this.loggers,config:this.config})}setStub(r){return this.stub=r,this}addTransport(r){return this.transports.push(r),this}addLogger(r){return this.loggers.push(r),this}addConfig(r){return this.config={...this.config,...r},this}}0&&(module.exports={DeviceManagementKitBuilder});
1
+ "use strict";var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var u=(e,r)=>{for(var o in r)s(e,o,{get:r[o],enumerable:!0})},l=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of c(r))!m.call(e,i)&&i!==o&&s(e,i,{get:()=>r[i],enumerable:!(a=p(r,i))||a.enumerable});return e};var f=e=>l(s({},"__esModule",{value:!0}),e);var h={};u(h,{DeviceManagementKitBuilder:()=>d});module.exports=f(h);var t=require("../internal/manager-api/model/Const"),n=require("../internal/secure-channel/model/Const"),g=require("./DeviceManagementKit");class d{stub=!1;loggers=[];transports=[];config={managerApiUrl:t.DEFAULT_MANAGER_API_BASE_URL,mockUrl:t.DEFAULT_MOCK_SERVER_BASE_URL,webSocketUrl:n.DEFAULT_WEB_SOCKET_BASE_URL,provider:t.DEFAULT_PROVIDER};build(){return new g.DeviceManagementKit({stub:this.stub,transports:this.transports,loggers:this.loggers,config:this.config})}setStub(r){return this.stub=r,this}addTransport(r){return this.transports.push(r),this}addLogger(r){return this.loggers.push(r),this}addConfig(r){return this.config={...this.config,...r},this}}0&&(module.exports={DeviceManagementKitBuilder});
2
2
  //# sourceMappingURL=DeviceManagementKitBuilder.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/DeviceManagementKitBuilder.ts"],
4
- "sourcesContent": ["import {\n DEFAULT_MANAGER_API_BASE_URL,\n DEFAULT_MOCK_SERVER_BASE_URL,\n} from \"@internal/manager-api/model/Const\";\nimport { DEFAULT_WEB_SOCKET_BASE_URL } from \"@internal/secure-channel/model/Const\";\n\nimport { type LoggerSubscriberService } from \"./logger-subscriber/service/LoggerSubscriberService\";\nimport { type TransportFactory } from \"./transport/model/Transport\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\nimport { type DmkConfig } from \"./DmkConfig\";\n\n/**\n * Builder for the `DeviceManagementKit` class.\n *\n * @example\n * ```\n * const dmk = new LedgerDeviceManagementKitBuilder()\n * .setStub(false)\n * .addTransport((args) => transportFactory(args))\n * .addTransport(transportFactory)\n * .addLogger(myLogger)\n * .build();\n * ```\n */\nexport class DeviceManagementKitBuilder {\n private stub = false;\n private readonly loggers: LoggerSubscriberService[] = [];\n private readonly transports: TransportFactory[] = [];\n private config: DmkConfig = {\n managerApiUrl: DEFAULT_MANAGER_API_BASE_URL,\n mockUrl: DEFAULT_MOCK_SERVER_BASE_URL,\n webSocketUrl: DEFAULT_WEB_SOCKET_BASE_URL,\n };\n\n build(): DeviceManagementKit {\n return new DeviceManagementKit({\n stub: this.stub,\n transports: this.transports,\n loggers: this.loggers,\n config: this.config,\n });\n }\n\n setStub(stubbed: boolean): DeviceManagementKitBuilder {\n this.stub = stubbed;\n return this;\n }\n\n addTransport(transport: TransportFactory): DeviceManagementKitBuilder {\n this.transports.push(transport);\n return this;\n }\n\n /**\n * Add a logger to the SDK that will receive its logs\n */\n addLogger(logger: LoggerSubscriberService): DeviceManagementKitBuilder {\n this.loggers.push(logger);\n return this;\n }\n\n addConfig(config: Partial<DmkConfig>): DeviceManagementKitBuilder {\n this.config = {\n ...this.config,\n ...config,\n };\n return this;\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAGO,6CACPA,EAA4C,gDAI5CC,EAAoC,iCAgB7B,MAAMH,CAA2B,CAC9B,KAAO,GACE,QAAqC,CAAC,EACtC,WAAiC,CAAC,EAC3C,OAAoB,CAC1B,cAAe,+BACf,QAAS,+BACT,aAAc,6BAChB,EAEA,OAA6B,CAC3B,OAAO,IAAI,sBAAoB,CAC7B,KAAM,KAAK,KACX,WAAY,KAAK,WACjB,QAAS,KAAK,QACd,OAAQ,KAAK,MACf,CAAC,CACH,CAEA,QAAQI,EAA8C,CACpD,YAAK,KAAOA,EACL,IACT,CAEA,aAAaC,EAAyD,CACpE,YAAK,WAAW,KAAKA,CAAS,EACvB,IACT,CAKA,UAAUC,EAA6D,CACrE,YAAK,QAAQ,KAAKA,CAAM,EACjB,IACT,CAEA,UAAUC,EAAwD,CAChE,YAAK,OAAS,CACZ,GAAG,KAAK,OACR,GAAGA,CACL,EACO,IACT,CACF",
4
+ "sourcesContent": ["import {\n DEFAULT_MANAGER_API_BASE_URL,\n DEFAULT_MOCK_SERVER_BASE_URL,\n DEFAULT_PROVIDER,\n} from \"@internal/manager-api/model/Const\";\nimport { DEFAULT_WEB_SOCKET_BASE_URL } from \"@internal/secure-channel/model/Const\";\n\nimport { type LoggerSubscriberService } from \"./logger-subscriber/service/LoggerSubscriberService\";\nimport { type TransportFactory } from \"./transport/model/Transport\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\nimport { type DmkConfig } from \"./DmkConfig\";\n\n/**\n * Builder for the `DeviceManagementKit` class.\n *\n * @example\n * ```\n * const dmk = new LedgerDeviceManagementKitBuilder()\n * .setStub(false)\n * .addTransport((args) => transportFactory(args))\n * .addTransport(transportFactory)\n * .addLogger(myLogger)\n * .build();\n * ```\n */\nexport class DeviceManagementKitBuilder {\n private stub = false;\n private readonly loggers: LoggerSubscriberService[] = [];\n private readonly transports: TransportFactory[] = [];\n private config: DmkConfig = {\n managerApiUrl: DEFAULT_MANAGER_API_BASE_URL,\n mockUrl: DEFAULT_MOCK_SERVER_BASE_URL,\n webSocketUrl: DEFAULT_WEB_SOCKET_BASE_URL,\n provider: DEFAULT_PROVIDER,\n };\n\n build(): DeviceManagementKit {\n return new DeviceManagementKit({\n stub: this.stub,\n transports: this.transports,\n loggers: this.loggers,\n config: this.config,\n });\n }\n\n setStub(stubbed: boolean): DeviceManagementKitBuilder {\n this.stub = stubbed;\n return this;\n }\n\n addTransport(transport: TransportFactory): DeviceManagementKitBuilder {\n this.transports.push(transport);\n return this;\n }\n\n /**\n * Add a logger to the SDK that will receive its logs\n */\n addLogger(logger: LoggerSubscriberService): DeviceManagementKitBuilder {\n this.loggers.push(logger);\n return this;\n }\n\n addConfig(config: Partial<DmkConfig>): DeviceManagementKitBuilder {\n this.config = {\n ...this.config,\n ...config,\n };\n return this;\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,6CACPA,EAA4C,gDAI5CC,EAAoC,iCAgB7B,MAAMH,CAA2B,CAC9B,KAAO,GACE,QAAqC,CAAC,EACtC,WAAiC,CAAC,EAC3C,OAAoB,CAC1B,cAAe,+BACf,QAAS,+BACT,aAAc,8BACd,SAAU,kBACZ,EAEA,OAA6B,CAC3B,OAAO,IAAI,sBAAoB,CAC7B,KAAM,KAAK,KACX,WAAY,KAAK,WACjB,QAAS,KAAK,QACd,OAAQ,KAAK,MACf,CAAC,CACH,CAEA,QAAQI,EAA8C,CACpD,YAAK,KAAOA,EACL,IACT,CAEA,aAAaC,EAAyD,CACpE,YAAK,WAAW,KAAKA,CAAS,EACvB,IACT,CAKA,UAAUC,EAA6D,CACrE,YAAK,QAAQ,KAAKA,CAAM,EACjB,IACT,CAEA,UAAUC,EAAwD,CAChE,YAAK,OAAS,CACZ,GAAG,KAAK,OACR,GAAGA,CACL,EACO,IACT,CACF",
6
6
  "names": ["DeviceManagementKitBuilder_exports", "__export", "DeviceManagementKitBuilder", "__toCommonJS", "import_Const", "import_DeviceManagementKit", "stubbed", "transport", "logger", "config"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var m=(t,r,n,g)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of k(r))!l.call(t,e)&&e!==n&&i(t,e,{get:()=>r[e],enumerable:!(g=o(r,e))||g.enumerable});return t};var p=t=>m(i({},"__esModule",{value:!0}),t);var s={};module.exports=p(s);
1
+ "use strict";var t=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var k=(e,r,g,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of m(r))!p.call(e,i)&&i!==g&&t(e,i,{get:()=>r[i],enumerable:!(n=o(r,i))||n.enumerable});return e};var l=e=>k(t({},"__esModule",{value:!0}),e);var s={};module.exports=l(s);
2
2
  //# sourceMappingURL=DmkConfig.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/DmkConfig.ts"],
4
- "sourcesContent": ["export type DmkConfig = {\n mockUrl: string;\n managerApiUrl: string;\n webSocketUrl: string;\n};\n"],
4
+ "sourcesContent": ["export type DmkConfig = {\n mockUrl: string;\n managerApiUrl: string;\n webSocketUrl: string;\n provider: number;\n};\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["DmkConfig_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var A=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var fe=Object.prototype.hasOwnProperty;var ce=(t,r)=>{for(var p in r)A(t,p,{get:r[p],enumerable:!0})},d=(t,r,p,D)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of se(r))!fe.call(t,a)&&a!==p&&A(t,a,{get:()=>r[a],enumerable:!(D=ae(r,a))||D.enumerable});return t},o=(t,r,p)=>(d(t,r,"default"),p&&d(p,r,"default"));var xe=t=>d(A({},"__esModule",{value:!0}),t);var e={};ce(e,{APDU_MAX_PAYLOAD:()=>s.APDU_MAX_PAYLOAD,Apdu:()=>u.Apdu,ApduBuilder:()=>s.ApduBuilder,ApduParser:()=>l.ApduParser,ApduResponse:()=>q.ApduResponse,BatteryStatusType:()=>f.BatteryStatusType,BleDeviceInfos:()=>K.BleDeviceInfos,ByteArrayBuilder:()=>v.ByteArrayBuilder,ByteArrayParser:()=>S.ByteArrayParser,CallTaskInAppDeviceAction:()=>O.CallTaskInAppDeviceAction,CloseAppCommand:()=>y.CloseAppCommand,CommandResultFactory:()=>i.CommandResultFactory,CommandResultStatus:()=>i.CommandResultStatus,CommandUtils:()=>I.CommandUtils,ConnectedDevice:()=>pe.ConnectedDevice,ConsoleLogger:()=>re.ConsoleLogger,DeviceActionStatus:()=>b.DeviceActionStatus,DeviceConnectionStateMachine:()=>ie.DeviceConnectionStateMachine,DeviceManagementKit:()=>$.DeviceManagementKit,DeviceManagementKitBuilder:()=>ee.DeviceManagementKitBuilder,DeviceModel:()=>m.DeviceModel,DeviceModelId:()=>m.DeviceModelId,DeviceSessionStateType:()=>w.DeviceSessionStateType,DeviceStatus:()=>M.DeviceStatus,FramerUtils:()=>Z.FramerUtils,GenuineCheckDeviceAction:()=>N.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>g.GetAppAndVersionCommand,GetBatteryStatusCommand:()=>f.GetBatteryStatusCommand,GetDeviceStatusDeviceAction:()=>U.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>L.GetOsVersionCommand,GlobalCommandError:()=>c.GlobalCommandError,GlobalCommandErrorHandler:()=>c.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>V.GoToDashboardDeviceAction,InstallAppDeviceAction:()=>Y.InstallAppDeviceAction,InvalidStatusWordError:()=>C.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>m.LEDGER_VENDOR_ID,ListAppsCommand:()=>B.ListAppsCommand,ListAppsDeviceAction:()=>P.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>_.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>j.ListInstalledAppsDeviceAction,LoadCertificateCommand:()=>G.LoadCertificateCommand,LogLevel:()=>oe.LogLevel,OpenAppCommand:()=>R.OpenAppCommand,OpenAppDeviceAction:()=>k.OpenAppDeviceAction,SendCommandInAppDeviceAction:()=>H.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>F.StaticDeviceModelDataSource,TransportConnectedDevice:()=>me.TransportConnectedDevice,TransportDeviceModel:()=>X.TransportDeviceModel,UninstallAppDeviceAction:()=>z.UninstallAppDeviceAction,UnknownDAError:()=>h.UnknownDAError,UserInteractionRequired:()=>T.UserInteractionRequired,WebLogsExporterLogger:()=>te.WebLogsExporterLogger,XStateDeviceAction:()=>W.XStateDeviceAction,base64StringToBuffer:()=>x.base64StringToBuffer,bufferToHexaString:()=>n.bufferToHexaString,connectedDeviceStubBuilder:()=>ne.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>J.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>Q.defaultApduSenderServiceStubBuilder,hexaStringToBuffer:()=>n.hexaStringToBuffer,isBase64String:()=>x.isBase64String,isCommandErrorCode:()=>E.isCommandErrorCode,isHexaString:()=>n.isHexaString,isSuccessCommandResult:()=>i.isSuccessCommandResult});module.exports=xe(e);var u=require("./apdu/model/Apdu"),s=require("./apdu/utils/ApduBuilder"),l=require("./apdu/utils/ApduParser");o(e,require("./apdu/utils/AppBuilderError"),module.exports);var v=require("./apdu/utils/ByteArrayBuilder"),S=require("./apdu/utils/ByteArrayParser"),C=require("./command/Errors"),i=require("./command/model/CommandResult"),y=require("./command/os/CloseAppCommand"),g=require("./command/os/GetAppAndVersionCommand"),f=require("./command/os/GetBatteryStatusCommand"),L=require("./command/os/GetOsVersionCommand"),B=require("./command/os/ListAppsCommand"),G=require("./command/os/LoadCertificateCommand"),R=require("./command/os/OpenAppCommand"),E=require("./command/utils/CommandErrors"),I=require("./command/utils/CommandUtils"),c=require("./command/utils/GlobalCommandError"),m=require("./device/DeviceModel"),M=require("./device/DeviceStatus"),b=require("./device-action/model/DeviceActionState"),T=require("./device-action/model/UserInteractionRequired"),O=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),h=require("./device-action/os/Errors"),U=require("./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),V=require("./device-action/os/GoToDashboard/GoToDashboardDeviceAction"),P=require("./device-action/os/ListApps/ListAppsDeviceAction"),_=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),k=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),H=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),W=require("./device-action/xstate-utils/XStateDeviceAction"),F=require("./device-model/data/StaticDeviceModelDataSource"),K=require("./device-model/model/BleDeviceInfos"),X=require("./device-model/model/DeviceModel"),q=require("./device-session/ApduResponse");o(e,require("./device-session/data/FramerConst"),module.exports);var w=require("./device-session/DeviceSessionState"),N=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),Y=require("./secure-channel/device-action/InstallApp/InstallAppDeviceAction"),j=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),z=require("./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction"),J=require("./device-session/service/DefaultApduReceiverService.stub"),Q=require("./device-session/service/DefaultApduSenderService.stub"),Z=require("./device-session/utils/FramerUtils"),$=require("./DeviceManagementKit"),ee=require("./DeviceManagementKitBuilder");o(e,require("./Error"),module.exports);var oe=require("./logger-subscriber/model/LogLevel"),re=require("./logger-subscriber/service/ConsoleLogger"),te=require("./logger-subscriber/service/WebLogsExporterLogger"),pe=require("./transport/model/ConnectedDevice"),ie=require("./transport/model/DeviceConnectionStateMachine");o(e,require("./transport/model/Errors"),module.exports);var me=require("./transport/model/TransportConnectedDevice"),ne=require("./transport/model/TransportConnectedDevice.stub");o(e,require("./types"),module.exports);var x=require("./utils/Base64String"),n=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectedDevice,ConsoleLogger,DeviceActionStatus,DeviceConnectionStateMachine,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceSessionStateType,DeviceStatus,FramerUtils,GenuineCheckDeviceAction,GetAppAndVersionCommand,GetBatteryStatusCommand,GetDeviceStatusDeviceAction,GetOsVersionCommand,GlobalCommandError,GlobalCommandErrorHandler,GoToDashboardDeviceAction,InstallAppDeviceAction,InvalidStatusWordError,LEDGER_VENDOR_ID,ListAppsCommand,ListAppsDeviceAction,ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction,LoadCertificateCommand,LogLevel,OpenAppCommand,OpenAppDeviceAction,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UninstallAppDeviceAction,UnknownDAError,UserInteractionRequired,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,hexaStringToBuffer,isBase64String,isCommandErrorCode,isHexaString,isSuccessCommandResult,...require("./apdu/utils/AppBuilderError"),...require("./device-session/data/FramerConst"),...require("./Error"),...require("./transport/model/Errors"),...require("./types")});
1
+ "use strict";var A=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var fe=Object.prototype.hasOwnProperty;var ce=(t,r)=>{for(var p in r)A(t,p,{get:r[p],enumerable:!0})},d=(t,r,p,D)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of se(r))!fe.call(t,a)&&a!==p&&A(t,a,{get:()=>r[a],enumerable:!(D=ae(r,a))||D.enumerable});return t},o=(t,r,p)=>(d(t,r,"default"),p&&d(p,r,"default"));var xe=t=>d(A({},"__esModule",{value:!0}),t);var e={};ce(e,{APDU_MAX_PAYLOAD:()=>s.APDU_MAX_PAYLOAD,Apdu:()=>u.Apdu,ApduBuilder:()=>s.ApduBuilder,ApduParser:()=>l.ApduParser,ApduResponse:()=>q.ApduResponse,BatteryStatusType:()=>f.BatteryStatusType,BleDeviceInfos:()=>K.BleDeviceInfos,ByteArrayBuilder:()=>v.ByteArrayBuilder,ByteArrayParser:()=>S.ByteArrayParser,CallTaskInAppDeviceAction:()=>h.CallTaskInAppDeviceAction,CloseAppCommand:()=>y.CloseAppCommand,CommandResultFactory:()=>i.CommandResultFactory,CommandResultStatus:()=>i.CommandResultStatus,CommandUtils:()=>M.CommandUtils,ConnectedDevice:()=>pe.ConnectedDevice,ConsoleLogger:()=>re.ConsoleLogger,DeviceActionStatus:()=>b.DeviceActionStatus,DeviceConnectionStateMachine:()=>ie.DeviceConnectionStateMachine,DeviceManagementKit:()=>$.DeviceManagementKit,DeviceManagementKitBuilder:()=>ee.DeviceManagementKitBuilder,DeviceModel:()=>m.DeviceModel,DeviceModelId:()=>m.DeviceModelId,DeviceSessionStateType:()=>w.DeviceSessionStateType,DeviceStatus:()=>I.DeviceStatus,FramerUtils:()=>Z.FramerUtils,GenuineCheckDeviceAction:()=>N.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>g.GetAppAndVersionCommand,GetBatteryStatusCommand:()=>f.GetBatteryStatusCommand,GetDeviceStatusDeviceAction:()=>U.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>L.GetOsVersionCommand,GlobalCommandError:()=>c.GlobalCommandError,GlobalCommandErrorHandler:()=>c.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>P.GoToDashboardDeviceAction,InstallAppDeviceAction:()=>Y.InstallAppDeviceAction,InvalidStatusWordError:()=>C.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>m.LEDGER_VENDOR_ID,ListAppsCommand:()=>B.ListAppsCommand,ListAppsDeviceAction:()=>V.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>_.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>j.ListInstalledAppsDeviceAction,LoadCertificateCommand:()=>G.LoadCertificateCommand,LogLevel:()=>oe.LogLevel,OpenAppCommand:()=>R.OpenAppCommand,OpenAppDeviceAction:()=>k.OpenAppDeviceAction,SendCommandInAppDeviceAction:()=>H.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>F.StaticDeviceModelDataSource,TransportConnectedDevice:()=>me.TransportConnectedDevice,TransportDeviceModel:()=>X.TransportDeviceModel,UninstallAppDeviceAction:()=>z.UninstallAppDeviceAction,UnknownDAError:()=>O.UnknownDAError,UserInteractionRequired:()=>T.UserInteractionRequired,WebLogsExporterLogger:()=>te.WebLogsExporterLogger,XStateDeviceAction:()=>W.XStateDeviceAction,base64StringToBuffer:()=>x.base64StringToBuffer,bufferToHexaString:()=>n.bufferToHexaString,connectedDeviceStubBuilder:()=>ne.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>J.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>Q.defaultApduSenderServiceStubBuilder,hexaStringToBuffer:()=>n.hexaStringToBuffer,isBase64String:()=>x.isBase64String,isCommandErrorCode:()=>E.isCommandErrorCode,isHexaString:()=>n.isHexaString,isSuccessCommandResult:()=>i.isSuccessCommandResult});module.exports=xe(e);var u=require("./apdu/model/Apdu"),s=require("./apdu/utils/ApduBuilder"),l=require("./apdu/utils/ApduParser");o(e,require("./apdu/utils/AppBuilderError"),module.exports);var v=require("./apdu/utils/ByteArrayBuilder"),S=require("./apdu/utils/ByteArrayParser"),C=require("./command/Errors"),i=require("./command/model/CommandResult"),y=require("./command/os/CloseAppCommand"),g=require("./command/os/GetAppAndVersionCommand"),f=require("./command/os/GetBatteryStatusCommand"),L=require("./command/os/GetOsVersionCommand"),B=require("./command/os/ListAppsCommand"),G=require("./command/os/LoadCertificateCommand"),R=require("./command/os/OpenAppCommand"),E=require("./command/utils/CommandErrors"),M=require("./command/utils/CommandUtils"),c=require("./command/utils/GlobalCommandError"),m=require("./device/DeviceModel"),I=require("./device/DeviceStatus"),b=require("./device-action/model/DeviceActionState"),T=require("./device-action/model/UserInteractionRequired"),h=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),O=require("./device-action/os/Errors"),U=require("./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),P=require("./device-action/os/GoToDashboard/GoToDashboardDeviceAction"),V=require("./device-action/os/ListApps/ListAppsDeviceAction"),_=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),k=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),H=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),W=require("./device-action/xstate-utils/XStateDeviceAction"),F=require("./device-model/data/StaticDeviceModelDataSource"),K=require("./device-model/model/BleDeviceInfos"),X=require("./device-model/model/DeviceModel"),q=require("./device-session/ApduResponse");o(e,require("./device-session/data/FramerConst"),module.exports);var w=require("./device-session/DeviceSessionState"),N=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),Y=require("./secure-channel/device-action/InstallApp/InstallAppDeviceAction"),j=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),z=require("./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction"),J=require("./device-session/service/DefaultApduReceiverService.stub"),Q=require("./device-session/service/DefaultApduSenderService.stub"),Z=require("./device-session/utils/FramerUtils"),$=require("./DeviceManagementKit"),ee=require("./DeviceManagementKitBuilder");o(e,require("./Error"),module.exports);var oe=require("./logger-subscriber/model/LogLevel"),re=require("./logger-subscriber/service/ConsoleLogger"),te=require("./logger-subscriber/service/WebLogsExporterLogger"),pe=require("./transport/model/ConnectedDevice"),ie=require("./transport/model/DeviceConnectionStateMachine");o(e,require("./transport/model/Errors"),module.exports);var me=require("./transport/model/TransportConnectedDevice"),ne=require("./transport/model/TransportConnectedDevice.stub");o(e,require("./types"),module.exports);var x=require("./utils/Base64String"),n=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectedDevice,ConsoleLogger,DeviceActionStatus,DeviceConnectionStateMachine,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceSessionStateType,DeviceStatus,FramerUtils,GenuineCheckDeviceAction,GetAppAndVersionCommand,GetBatteryStatusCommand,GetDeviceStatusDeviceAction,GetOsVersionCommand,GlobalCommandError,GlobalCommandErrorHandler,GoToDashboardDeviceAction,InstallAppDeviceAction,InvalidStatusWordError,LEDGER_VENDOR_ID,ListAppsCommand,ListAppsDeviceAction,ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction,LoadCertificateCommand,LogLevel,OpenAppCommand,OpenAppDeviceAction,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UninstallAppDeviceAction,UnknownDAError,UserInteractionRequired,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,hexaStringToBuffer,isBase64String,isCommandErrorCode,isHexaString,isSuccessCommandResult,...require("./apdu/utils/AppBuilderError"),...require("./device-session/data/FramerConst"),...require("./Error"),...require("./transport/model/Errors"),...require("./types")});
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/index.ts"],
4
- "sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport { InvalidStatusWordError } from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport { UnknownDAError } from \"@api/device-action/os/Errors\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\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 { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport { DeviceConnectionStateMachine } from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
5
- "mappings": "meAAA,IAAAA,EAAA,GAAAC,GAAAD,EAAA,k5FAAAE,GAAAF,GAEA,IAAAG,EAAqB,gCACrBC,EAA8C,uCAC9CC,EAA2B,sCAC3BC,EAAAN,EAAc,2CALd,gBAMA,IAAAO,EAAiC,4CACjCC,EAAgC,2CAChCC,EAAuC,+BACvCC,EAIO,4CACPC,EAAgC,2CAChCC,EAGO,mDACPC,EAKO,mDACPC,EAGO,+CACPC,EAKO,2CACPC,EAIO,kDACPC,EAGO,0CACPC,EAAmC,4CACnCC,EAA6B,2CAC7BC,EAGO,iDACPC,EAIO,mCACPC,EAA6B,oCAE7BC,EAGO,sDACPC,EAAwC,4DACxCC,EAA0C,qFAC1ChB,EAA+B,wCAC/BiB,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAqC,+DACrCC,EAAiD,uFACjDC,EAAoC,yEACpCC,EAA6C,2FAC7CC,EAGO,8DACPC,EAA4C,8DAC5CC,EAA+B,kDAC/Bb,EAAqC,+CACrCc,EAA6B,4CAC7B7B,EAAAN,EAAc,gDA9Ed,gBA+EA,IAAAoC,EAGO,kDACPC,EAAyC,mFACzCC,EAAuC,+EACvCC,EAA8C,6FAC9CC,EAAyC,mFAEzCC,EAAsD,uEACtDC,EAAoD,qEACpDC,EAA4B,iDAC5BC,EAAoC,oCACpCC,GAA2C,2CAC3CvC,EAAAN,EAAc,sBA7Fd,gBA8FA,IAAA8C,GAAyB,iDACzBC,GAA8B,wDAC9BC,GAAsC,gEACtCC,GAAgC,gDAChCC,GAA6C,6DAC7C5C,EAAAN,EAAc,uCAnGd,gBAoGA,IAAAmD,GAAyC,yDACzCA,GAA2C,8DAC3C7C,EAAAN,EAAc,sBAtGd,gBAuGA,IAAAoD,EAAqD,mCACrDC,EAIO",
4
+ "sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport { InvalidStatusWordError } from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport { UnknownDAError } from \"@api/device-action/os/Errors\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\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 { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\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 { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
5
+ "mappings": "meAAA,IAAAA,EAAA,GAAAC,GAAAD,EAAA,k5FAAAE,GAAAF,GAEA,IAAAG,EAAqB,gCACrBC,EAA8C,uCAC9CC,EAA2B,sCAC3BC,EAAAN,EAAc,2CALd,gBAMA,IAAAO,EAAiC,4CACjCC,EAAgC,2CAChCC,EAAuC,+BACvCC,EAIO,4CACPC,EAAgC,2CAChCC,EAGO,mDACPC,EAKO,mDACPC,EAGO,+CACPC,EAKO,2CACPC,EAIO,kDACPC,EAGO,0CACPC,EAAmC,4CACnCC,EAA6B,2CAC7BC,EAGO,iDACPC,EAIO,mCACPC,EAA6B,oCAE7BC,EAGO,sDACPC,EAAwC,4DACxCC,EAA0C,qFAC1ChB,EAA+B,wCAC/BiB,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAqC,+DACrCC,EAAiD,uFACjDC,EAAoC,yEACpCC,EAA6C,2FAC7CC,EAGO,8DACPC,EAA4C,8DAC5CC,EAA+B,kDAC/Bb,EAAqC,+CACrCc,EAA6B,4CAC7B7B,EAAAN,EAAc,gDA9Ed,gBA+EA,IAAAoC,EAGO,kDACPC,EAAyC,mFACzCC,EAAuC,+EACvCC,EAA8C,6FAC9CC,EAAyC,mFAEzCC,EAAsD,uEACtDC,EAAoD,qEACpDC,EAA4B,iDAC5BC,EAAoC,oCACpCC,GAA2C,2CAC3CvC,EAAAN,EAAc,sBA7Fd,gBA8FA,IAAA8C,GAAyB,iDACzBC,GAA8B,wDAC9BC,GAAsC,gEACtCC,GAAgC,gDAChCC,GAGO,6DACP5C,EAAAN,EAAc,uCAtGd,gBAuGA,IAAAmD,GAAyC,yDACzCA,GAA2C,8DAC3C7C,EAAAN,EAAc,sBAzGd,gBA0GA,IAAAoD,EAAqD,mCACrDC,EAIO",
6
6
  "names": ["api_exports", "__export", "__toCommonJS", "import_Apdu", "import_ApduBuilder", "import_ApduParser", "__reExport", "import_ByteArrayBuilder", "import_ByteArrayParser", "import_Errors", "import_CommandResult", "import_CloseAppCommand", "import_GetAppAndVersionCommand", "import_GetBatteryStatusCommand", "import_GetOsVersionCommand", "import_ListAppsCommand", "import_LoadCertificateCommand", "import_OpenAppCommand", "import_CommandErrors", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_DeviceStatus", "import_DeviceActionState", "import_UserInteractionRequired", "import_CallTaskInAppDeviceAction", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_ListAppsDeviceAction", "import_ListAppsWithMetadataDeviceAction", "import_OpenAppDeviceAction", "import_SendCommandInAppDeviceAction", "import_XStateDeviceAction", "import_StaticDeviceModelDataSource", "import_BleDeviceInfos", "import_ApduResponse", "import_DeviceSessionState", "import_GenuineCheckDeviceAction", "import_InstallAppDeviceAction", "import_ListInstalledAppsDeviceAction", "import_UninstallAppDeviceAction", "import_DefaultApduReceiverService", "import_DefaultApduSenderService", "import_FramerUtils", "import_DeviceManagementKit", "import_DeviceManagementKitBuilder", "import_LogLevel", "import_ConsoleLogger", "import_WebLogsExporterLogger", "import_ConnectedDevice", "import_DeviceConnectionStateMachine", "import_TransportConnectedDevice", "import_Base64String", "import_HexaString"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var S=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var O=(o,t)=>{for(var s in t)S(o,s,{get:t[s],enumerable:!0})},F=(o,t,s,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of x(t))!w.call(o,a)&&a!==s&&S(o,a,{get:()=>t[a],enumerable:!(u=I(t,a))||u.enumerable});return o};var T=o=>F(S({},"__esModule",{value:!0}),o);var M={};O(M,{GenuineCheckDeviceAction:()=>A});module.exports=T(M);var m=require("purify-ts"),n=require("xstate"),v=require("../../../command/model/CommandResult"),D=require("../../../command/os/GetOsVersionCommand"),h=require("../../../device-action/model/UserInteractionRequired"),V=require("../../../device-action/os/Const"),k=require("../../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),C=require("../../../device-action/xstate-utils/XStateDeviceAction"),G=require("../../../device-session/DeviceSessionState"),f=require("../../../secure-channel/task/ConnectToSecureChannelTask"),l=require("../../../secure-channel/task/types"),y=require("../../../secure-channel/utils");class A extends C.XStateDeviceAction{makeStateMachine(t){const{getOsVersion:s,getDeviceVersion:u,getFirmwareVersion:a,genuineCheck:g,getDeviceSessionState:d,setDeviceSessionState:i}=this.extractDependencies(t),c=this.input.unlockTimeout??V.DEFAULT_UNLOCK_TIMEOUT_MS,p=new k.GoToDashboardDeviceAction({input:{unlockTimeout:c}}).makeStateMachine(t);return(0,n.setup)({types:{input:{},context:{},output:{}},actors:{goToDashboard:p,getOsVersion:(0,n.fromPromise)(s),getDeviceVersion:(0,n.fromPromise)(u),getFirmwareVersion:(0,n.fromPromise)(a),genuineCheck:(0,n.fromObservable)(g)},guards:{hasError:e=>e.context._internalState.error!==null},actions:{assignErrorFromEvent:(0,n.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"GenuineCheckDeviceAction",initial:"DeviceReady",context:e=>({input:{unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:h.UserInteractionRequired.None},_internalState:{error:null,result:{isGenuine:!1},getOsVersionResponse:null,deviceVersion:null,firmwareVersion:null}}),states:{DeviceReady:{always:{target:"GoToDashboard"}},GoToDashboard:{invoke:{id:"goToDashboard",src:"goToDashboard",input:e=>({unlockTimeout:e.context.input.unlockTimeout}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:e.event.snapshot.context.intermediateValue.requiredUserInteraction})})},onDone:{target:"GoToDashboardCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GoToDashboardCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetOsVersion"}]},GetOsVersion:{invoke:{id:"getOsVersion",src:"getOsVersion",input:e=>{},onDone:{target:"GetOsVersionCheck",actions:(0,n.assign)({_internalState:e=>{if((0,v.isSuccessCommandResult)(e.event.output)){const r=d(),E=e.event.output.data.secureElementFlags.isSecureConnectionAllowed;return r.sessionStateType!==G.DeviceSessionStateType.Connected&&i({...r,isSecureConnectionAllowed:E}),{...e.context._internalState,getOsVersionResponse:e.event.output.data}}return{...e.context._internalState,error:e.event.output.error}}})}}},GetOsVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetDeviceVersion"}]},GetDeviceVersion:{invoke:{id:"getDeviceVersion",src:"getDeviceVersion",input:e=>({deviceInfo:e.context._internalState.getOsVersionResponse}),onDone:{target:"GetDeviceVersionCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:r=>({...e.context._internalState,deviceVersion:r}),Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetDeviceVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetFirmwareVersion"}]},GetFirmwareVersion:{invoke:{id:"getFirmwareVersion",src:"getFirmwareVersion",input:e=>({deviceInfo:e.context._internalState.getOsVersionResponse,deviceVersion:e.context._internalState.deviceVersion}),onDone:{target:"GetFirmwareVersionCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:r=>({...e.context._internalState,firmwareVersion:r}),Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetFirmwareVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GenuineCheck"}]},GenuineCheck:{invoke:{id:"genuineCheck",src:"genuineCheck",input:e=>({deviceInfo:e.context._internalState.getOsVersionResponse,finalFirmware:e.context._internalState.firmwareVersion}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>{switch(e.event.snapshot.context?.type){case l.SecureChannelEventType.PermissionRequested:return{requiredUserInteraction:h.UserInteractionRequired.AllowSecureConnection};case l.SecureChannelEventType.PermissionGranted:return{requiredUserInteraction:h.UserInteractionRequired.None};default:return{...e.context.intermediateValue}}},_internalState:e=>e.event.snapshot.context?.type===l.SecureChannelEventType.Result?{...e.context._internalState,result:{isGenuine:(0,y.isDeviceGenuine)(e.event.snapshot.context.payload)}}:e.context._internalState})},onDone:{target:"GenuineCheckCheck"},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GenuineCheckCheck:{always:[{target:"Error",guard:"hasError"},{target:"Success"}]},Success:{type:"final"},Error:{type:"final"}},output:e=>e.context._internalState.error?(0,m.Left)(e.context._internalState.error):(0,m.Right)(e.context._internalState.result)})}extractDependencies(t){return{getOsVersion:()=>t.sendCommand(new D.GetOsVersionCommand),getDeviceVersion:({input:i})=>{const{deviceInfo:c}=i;return t.getManagerApiService().getDeviceVersion(c,1)},getFirmwareVersion:({input:i})=>{const{deviceInfo:c,deviceVersion:p}=i;return t.getManagerApiService().getFirmwareVersion(c,p,1)},genuineCheck:({input:i})=>{const{deviceInfo:c,finalFirmware:p}=i,e=t.getSecureChannelService().genuineCheck(c,p);return new f.ConnectToSecureChannelTask(t,{connection:e}).run()},getDeviceSessionState:()=>t.getDeviceSessionState(),setDeviceSessionState:i=>t.setDeviceSessionState(i)}}}0&&(module.exports={GenuineCheckDeviceAction});
1
+ "use strict";var g=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var O=(o,t)=>{for(var s in t)g(o,s,{get:t[s],enumerable:!0})},F=(o,t,s,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of x(t))!w.call(o,a)&&a!==s&&g(o,a,{get:()=>t[a],enumerable:!(u=I(t,a))||u.enumerable});return o};var T=o=>F(g({},"__esModule",{value:!0}),o);var M={};O(M,{GenuineCheckDeviceAction:()=>A});module.exports=T(M);var m=require("purify-ts"),n=require("xstate"),v=require("../../../command/model/CommandResult"),D=require("../../../command/os/GetOsVersionCommand"),h=require("../../../device-action/model/UserInteractionRequired"),V=require("../../../device-action/os/Const"),k=require("../../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),C=require("../../../device-action/xstate-utils/XStateDeviceAction"),G=require("../../../device-session/DeviceSessionState"),f=require("../../../secure-channel/task/ConnectToSecureChannelTask"),l=require("../../../secure-channel/task/types"),y=require("../../../secure-channel/utils");class A extends C.XStateDeviceAction{makeStateMachine(t){const{getOsVersion:s,getDeviceVersion:u,getFirmwareVersion:a,genuineCheck:d,getDeviceSessionState:i,setDeviceSessionState:c}=this.extractDependencies(t),p=this.input.unlockTimeout??V.DEFAULT_UNLOCK_TIMEOUT_MS,S=new k.GoToDashboardDeviceAction({input:{unlockTimeout:p}}).makeStateMachine(t);return(0,n.setup)({types:{input:{},context:{},output:{}},actors:{goToDashboard:S,getOsVersion:(0,n.fromPromise)(s),getDeviceVersion:(0,n.fromPromise)(u),getFirmwareVersion:(0,n.fromPromise)(a),genuineCheck:(0,n.fromObservable)(d)},guards:{hasError:e=>e.context._internalState.error!==null},actions:{assignErrorFromEvent:(0,n.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"GenuineCheckDeviceAction",initial:"DeviceReady",context:e=>({input:{unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:h.UserInteractionRequired.None},_internalState:{error:null,result:{isGenuine:!1},getOsVersionResponse:null,deviceVersion:null,firmwareVersion:null}}),states:{DeviceReady:{always:{target:"GoToDashboard"}},GoToDashboard:{invoke:{id:"goToDashboard",src:"goToDashboard",input:e=>({unlockTimeout:e.context.input.unlockTimeout}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>({...e.context.intermediateValue,requiredUserInteraction:e.event.snapshot.context.intermediateValue.requiredUserInteraction})})},onDone:{target:"GoToDashboardCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GoToDashboardCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetOsVersion"}]},GetOsVersion:{invoke:{id:"getOsVersion",src:"getOsVersion",input:e=>{},onDone:{target:"GetOsVersionCheck",actions:(0,n.assign)({_internalState:e=>{if((0,v.isSuccessCommandResult)(e.event.output)){const r=i(),E=e.event.output.data.secureElementFlags.isSecureConnectionAllowed;return r.sessionStateType!==G.DeviceSessionStateType.Connected&&c({...r,isSecureConnectionAllowed:E}),{...e.context._internalState,getOsVersionResponse:e.event.output.data}}return{...e.context._internalState,error:e.event.output.error}}})}}},GetOsVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetDeviceVersion"}]},GetDeviceVersion:{invoke:{id:"getDeviceVersion",src:"getDeviceVersion",input:e=>({deviceInfo:e.context._internalState.getOsVersionResponse}),onDone:{target:"GetDeviceVersionCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:r=>({...e.context._internalState,deviceVersion:r}),Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetDeviceVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetFirmwareVersion"}]},GetFirmwareVersion:{invoke:{id:"getFirmwareVersion",src:"getFirmwareVersion",input:e=>({deviceInfo:e.context._internalState.getOsVersionResponse,deviceVersion:e.context._internalState.deviceVersion}),onDone:{target:"GetFirmwareVersionCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:r=>({...e.context._internalState,firmwareVersion:r}),Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetFirmwareVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GenuineCheck"}]},GenuineCheck:{invoke:{id:"genuineCheck",src:"genuineCheck",input:e=>({deviceInfo:e.context._internalState.getOsVersionResponse,finalFirmware:e.context._internalState.firmwareVersion}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>{switch(e.event.snapshot.context?.type){case l.SecureChannelEventType.PermissionRequested:return{requiredUserInteraction:h.UserInteractionRequired.AllowSecureConnection};case l.SecureChannelEventType.PermissionGranted:return{requiredUserInteraction:h.UserInteractionRequired.None};default:return{...e.context.intermediateValue}}},_internalState:e=>e.event.snapshot.context?.type===l.SecureChannelEventType.Result?{...e.context._internalState,result:{isGenuine:(0,y.isDeviceGenuine)(e.event.snapshot.context.payload)}}:e.context._internalState})},onDone:{target:"GenuineCheckCheck"},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GenuineCheckCheck:{always:[{target:"Error",guard:"hasError"},{target:"Success"}]},Success:{type:"final"},Error:{type:"final"}},output:e=>e.context._internalState.error?(0,m.Left)(e.context._internalState.error):(0,m.Right)(e.context._internalState.result)})}extractDependencies(t){return{getOsVersion:()=>t.sendCommand(new D.GetOsVersionCommand),getDeviceVersion:({input:i})=>{const{deviceInfo:c}=i;return t.getManagerApiService().getDeviceVersion(c)},getFirmwareVersion:({input:i})=>{const{deviceInfo:c,deviceVersion:p}=i;return t.getManagerApiService().getFirmwareVersion(c,p)},genuineCheck:({input:i})=>{const{deviceInfo:c,finalFirmware:p}=i,S=t.getSecureChannelService().genuineCheck(c,p);return new f.ConnectToSecureChannelTask(t,{connection:S}).run()},getDeviceSessionState:()=>t.getDeviceSessionState(),setDeviceSessionState:i=>t.setDeviceSessionState(i)}}}0&&(module.exports={GenuineCheckDeviceAction});
2
2
  //# sourceMappingURL=GenuineCheckDeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.ts"],
4
- "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromObservable, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nimport {\n type GenuineCheckDAError,\n type GenuineCheckDAInput,\n type GenuineCheckDAIntermediateValue,\n type GenuineCheckDAOutput,\n type GenuineCheckStateMachineInternalState,\n type MachineDependencies,\n} from \"@api/secure-channel/device-action/GenuineCheck/types\";\nimport { ConnectToSecureChannelTask } from \"@api/secure-channel/task/ConnectToSecureChannelTask\";\nimport { SecureChannelEventType } from \"@api/secure-channel/task/types\";\nimport { type Input } from \"@api/secure-channel/types\";\nimport { isDeviceGenuine } from \"@api/secure-channel/utils\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { type FinalFirmware } from \"@internal/manager-api/model/Firmware\";\n\nexport class GenuineCheckDeviceAction extends XStateDeviceAction<\n GenuineCheckDAOutput,\n GenuineCheckDAInput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue,\n GenuineCheckStateMachineInternalState\n> {\n override makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GenuineCheckDAOutput,\n GenuineCheckDAInput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue,\n GenuineCheckStateMachineInternalState\n > {\n type types = StateMachineTypes<\n GenuineCheckDAOutput,\n GenuineCheckDAInput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue,\n GenuineCheckStateMachineInternalState\n >;\n\n const {\n getOsVersion,\n getDeviceVersion,\n getFirmwareVersion,\n genuineCheck,\n getDeviceSessionState,\n setDeviceSessionState,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const goToDashboardMachine = new GoToDashboardDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalApi);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n goToDashboard: goToDashboardMachine,\n getOsVersion: fromPromise(getOsVersion),\n getDeviceVersion: fromPromise(getDeviceVersion),\n getFirmwareVersion: fromPromise(getFirmwareVersion),\n genuineCheck: fromObservable(genuineCheck),\n },\n guards: {\n hasError: (_) => _.context._internalState.error !== null,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"],\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHEwDsCuBLNYDCAFmAMYDWAImAG5bFgCCxALlgPZoB0lNdASmAEMIATwDEAbQAMAXUSgADq1hYW7OSAAeiAIwB2AGwAWDvskBOAKwAmC9YvbJADkMAaEMMQBmT2ZPazuo6SFp6SDpKG+gC+UW6omDj4RGTctAzMbJzIrAAqrOQCsAQARqwCAE4QohDsYBw4VKykdVC5+YUlZZVSskggisqqaOpaCFaGntocEwaOFkYR2oa6bh4IZsEcuta6Nmbajp76tjFx6Ni4hCQU1GmMQxzZeQVFpRVVYOXlrOUc8gA2AiYADMfgBbDitZ4dN7dGTqAYqTIjRDjSbTTyzeaGRbLVaIOa6LY7PYHI4nWIgeIXJLXVJ0e6ZR5tF6dd5XMgSeF9RFDFFjQ5WExhXQbYKGRxWKwrdyoo4cbT+UUOQz+UyeU5U86JDk3HjpB5PdqvLoQXUSbS9BRKJFqPqjKyC4V6MUWCVSmVrfySBVKsxSyxmAKSaKU6k65J6u4ZdiPMBMADysAAap9lOxqrV6mhGs1IfGk6nyum0D0ETa+favJFPNNDBtHAcQ8cQ-j1qEOJ43d5JMFG8dDJrw5dI-SDUzUImU2nMuayzyK8iq2NDELtoFVWZ9JilmY2-X9BxnNvbLYjBMzEPtSO6bcGTGsgXp8XZ5GLVb+ou7aAHaviRu1R3es220Kx-A4EMbEmVcg0kaUrwSG8UjvcdY0nMcixLTNcGzXMWnjDCZ3YedrUGJcf0QAxjElRZMWcSx5hAqxzA4Cw5i3XtRWcKUEJpXUx0ZNCCJQzDMlET5vl+AEgVB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3YKIASfMCxhljRT0OYfex0b7xMqWInmtT9H0PqYw1EIVRYYL0MFJqRwtrSnHs3BwmIQiOFcZ3ISFS0kx3mMA221hHDnJqjiOm9dHasRqmVR0cx+w7OGa1URXcKkGOmVIhAkhR5Q1Yvwt0JTmL1ReXEt5OjYwAGUMDEDoLAeA3yjFjEsD0+Yug9AzFhp4ECBghQ4qMuclsl9dmwM4AAUQeuUQ5+VvA1S2JKbOzEWZ1xPm6Q8QiJSSwdkcDUMQohAA */\n id: \"GenuineCheckDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n error: null,\n result: { isGenuine: false },\n getOsVersionResponse: null,\n deviceVersion: null,\n firmwareVersion: null,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"GoToDashboard\",\n },\n },\n GoToDashboard: {\n invoke: {\n id: \"goToDashboard\",\n src: \"goToDashboard\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n requiredUserInteraction:\n _.event.snapshot.context.intermediateValue\n .requiredUserInteraction,\n }),\n }),\n },\n onDone: {\n target: \"GoToDashboardCheck\",\n actions: assign({\n _internalState: (_) =>\n _.event.output.caseOf<GenuineCheckStateMachineInternalState>({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GoToDashboardCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"GetOsVersion\",\n },\n ],\n },\n GetOsVersion: {\n invoke: {\n id: \"getOsVersion\",\n src: \"getOsVersion\",\n input: (_) => undefined,\n onDone: {\n target: \"GetOsVersionCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n const currentState: DeviceSessionState =\n getDeviceSessionState();\n const isSecureConnectionAllowed =\n _.event.output.data.secureElementFlags\n .isSecureConnectionAllowed;\n if (\n currentState.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n setDeviceSessionState({\n ...currentState,\n isSecureConnectionAllowed,\n });\n }\n return {\n ..._.context._internalState,\n getOsVersionResponse: _.event.output.data,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n },\n },\n GetOsVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"GetDeviceVersion\",\n },\n ],\n },\n GetDeviceVersion: {\n invoke: {\n id: \"getDeviceVersion\",\n src: \"getDeviceVersion\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n }),\n onDone: {\n target: \"GetDeviceVersionCheck\",\n actions: assign({\n _internalState: (_) =>\n _.event.output.caseOf<GenuineCheckStateMachineInternalState>({\n Right: (deviceVersion) => ({\n ..._.context._internalState,\n deviceVersion,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GetDeviceVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"GetFirmwareVersion\" },\n ],\n },\n GetFirmwareVersion: {\n invoke: {\n id: \"getFirmwareVersion\",\n src: \"getFirmwareVersion\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n deviceVersion: _.context._internalState.deviceVersion!,\n }),\n onDone: {\n target: \"GetFirmwareVersionCheck\",\n actions: assign({\n _internalState: (_) =>\n _.event.output.caseOf<GenuineCheckStateMachineInternalState>({\n Right: (firmwareVersion) => ({\n ..._.context._internalState,\n firmwareVersion,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GetFirmwareVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"GenuineCheck\" },\n ],\n },\n GenuineCheck: {\n invoke: {\n id: \"genuineCheck\",\n src: \"genuineCheck\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n finalFirmware: _.context._internalState.firmwareVersion!,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => {\n switch (_.event.snapshot.context?.type) {\n case SecureChannelEventType.PermissionRequested: {\n return {\n requiredUserInteraction:\n UserInteractionRequired.AllowSecureConnection,\n };\n }\n case SecureChannelEventType.PermissionGranted: {\n return {\n requiredUserInteraction: UserInteractionRequired.None,\n };\n }\n default:\n return {\n ..._.context.intermediateValue,\n };\n }\n },\n _internalState: (_) => {\n if (\n _.event.snapshot.context?.type ===\n SecureChannelEventType.Result\n ) {\n return {\n ..._.context._internalState,\n result: {\n isGenuine: isDeviceGenuine(\n _.event.snapshot.context.payload,\n ),\n },\n };\n }\n return _.context._internalState;\n },\n }),\n },\n onDone: {\n target: \"GenuineCheckCheck\",\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GenuineCheckCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (_) => {\n if (_.context._internalState.error) {\n return Left(_.context._internalState.error);\n } else {\n return Right(_.context._internalState.result);\n }\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const provider = 1; // TODO: get the provider from user configuration\n\n const getOsVersion = () =>\n internalApi.sendCommand(new GetOsVersionCommand());\n\n const getDeviceVersion = ({\n input,\n }: Input<{ deviceInfo: GetOsVersionResponse }>) => {\n const { deviceInfo } = input;\n return internalApi\n .getManagerApiService()\n .getDeviceVersion(deviceInfo, provider);\n };\n\n const getFirmwareVersion = ({\n input,\n }: Input<{\n deviceInfo: GetOsVersionResponse;\n deviceVersion: DeviceVersion;\n }>) => {\n const { deviceInfo, deviceVersion } = input;\n return internalApi\n .getManagerApiService()\n .getFirmwareVersion(deviceInfo, deviceVersion, provider);\n };\n\n const genuineCheck = ({\n input,\n }: Input<{\n deviceInfo: GetOsVersionResponse;\n finalFirmware: FinalFirmware;\n }>) => {\n const { deviceInfo, finalFirmware } = input;\n const eitherConnection = internalApi\n .getSecureChannelService()\n .genuineCheck(deviceInfo, finalFirmware);\n return new ConnectToSecureChannelTask(internalApi, {\n connection: eitherConnection,\n }).run();\n };\n\n return {\n getOsVersion,\n getDeviceVersion,\n getFirmwareVersion,\n genuineCheck,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,qBAC5BC,EAA2D,kBAE3DC,EAAuC,4CACvCC,EAGO,+CAEPC,EAAwC,4DACxCC,EAA0C,uCAC1CC,EAA0C,yEAE1CC,EAGO,8DACPC,EAGO,kDASPC,EAA2C,+DAC3CC,EAAuC,0CAEvCC,EAAgC,qCAIzB,MAAMb,UAAiC,oBAM5C,CACS,iBACPc,EAOA,CASA,KAAM,CACJ,aAAAC,EACA,iBAAAC,EACA,mBAAAC,EACA,aAAAC,EACA,sBAAAC,EACA,sBAAAC,CACF,EAAI,KAAK,oBAAoBN,CAAW,EAElCO,EAAgB,KAAK,MAAM,eAAiB,4BAE5CC,EAAuB,IAAI,4BAA0B,CACzD,MAAO,CACL,cAAAD,CACF,CACF,CAAC,EAAE,iBAAiBP,CAAW,EAE/B,SAAO,SAAM,CACX,MAAO,CACL,MAAO,CAAC,EACR,QAAS,CAAC,EACV,OAAQ,CAAC,CACX,EACA,OAAQ,CACN,cA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EAAE,QAAQ,eAAe,SACpB,QAAKA,EAAE,QAAQ,eAAe,KAAK,KAEnC,SAAMA,EAAE,QAAQ,eAAe,MAAM,CAGlD,CAAC,CACH,CAEA,oBAAoBT,EAA+C,CA0CjE,MAAO,CACL,aAxCmB,IACnBA,EAAY,YAAY,IAAI,qBAAqB,EAwCjD,iBAtCuB,CAAC,CACxB,MAAAe,CACF,IAAmD,CACjD,KAAM,CAAE,WAAAC,CAAW,EAAID,EACvB,OAAOf,EACJ,qBAAqB,EACrB,iBAAiBgB,EAAY,CAAQ,CAC1C,EAgCE,mBA9ByB,CAAC,CAC1B,MAAAD,CACF,IAGO,CACL,KAAM,CAAE,WAAAC,EAAY,cAAAH,CAAc,EAAIE,EACtC,OAAOf,EACJ,qBAAqB,EACrB,mBAAmBgB,EAAYH,EAAe,CAAQ,CAC3D,EAqBE,aAnBmB,CAAC,CACpB,MAAAE,CACF,IAGO,CACL,KAAM,CAAE,WAAAC,EAAY,cAAAC,CAAc,EAAIF,EAChCG,EAAmBlB,EACtB,wBAAwB,EACxB,aAAagB,EAAYC,CAAa,EACzC,OAAO,IAAI,6BAA2BjB,EAAa,CACjD,WAAYkB,CACd,CAAC,EAAE,IAAI,CACT,EAOE,sBAAuB,IAAMlB,EAAY,sBAAsB,EAC/D,sBAAwBmB,GACtBnB,EAAY,sBAAsBmB,CAAK,CAC3C,CACF,CACF",
4
+ "sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromObservable, fromPromise, setup } from \"xstate\";\n\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { DEFAULT_UNLOCK_TIMEOUT_MS } from \"@api/device-action/os/Const\";\nimport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nimport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nimport {\n type GenuineCheckDAError,\n type GenuineCheckDAInput,\n type GenuineCheckDAIntermediateValue,\n type GenuineCheckDAOutput,\n type GenuineCheckStateMachineInternalState,\n type MachineDependencies,\n} from \"@api/secure-channel/device-action/GenuineCheck/types\";\nimport { ConnectToSecureChannelTask } from \"@api/secure-channel/task/ConnectToSecureChannelTask\";\nimport { SecureChannelEventType } from \"@api/secure-channel/task/types\";\nimport { type Input } from \"@api/secure-channel/types\";\nimport { isDeviceGenuine } from \"@api/secure-channel/utils\";\nimport { type DeviceVersion } from \"@internal/manager-api/model/Device\";\nimport { type FinalFirmware } from \"@internal/manager-api/model/Firmware\";\n\nexport class GenuineCheckDeviceAction extends XStateDeviceAction<\n GenuineCheckDAOutput,\n GenuineCheckDAInput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue,\n GenuineCheckStateMachineInternalState\n> {\n override makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GenuineCheckDAOutput,\n GenuineCheckDAInput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue,\n GenuineCheckStateMachineInternalState\n > {\n type types = StateMachineTypes<\n GenuineCheckDAOutput,\n GenuineCheckDAInput,\n GenuineCheckDAError,\n GenuineCheckDAIntermediateValue,\n GenuineCheckStateMachineInternalState\n >;\n\n const {\n getOsVersion,\n getDeviceVersion,\n getFirmwareVersion,\n genuineCheck,\n getDeviceSessionState,\n setDeviceSessionState,\n } = this.extractDependencies(internalApi);\n\n const unlockTimeout = this.input.unlockTimeout ?? DEFAULT_UNLOCK_TIMEOUT_MS;\n\n const goToDashboardMachine = new GoToDashboardDeviceAction({\n input: {\n unlockTimeout,\n },\n }).makeStateMachine(internalApi);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n goToDashboard: goToDashboardMachine,\n getOsVersion: fromPromise(getOsVersion),\n getDeviceVersion: fromPromise(getDeviceVersion),\n getFirmwareVersion: fromPromise(getFirmwareVersion),\n genuineCheck: fromObservable(genuineCheck),\n },\n guards: {\n hasError: (_) => _.context._internalState.error !== null,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"],\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QHEwDsCuBLNYDCAFmAMYDWAImAG5bFgCCxALlgPZoB0lNdASmAEMIATwDEAbQAMAXUSgADq1hYW7OSAAeiAIwB2AGwAWDvskBOAKwAmC9YvbJADkMAaEMMQBmT2ZPazuo6SFp6SDpKG+gC+UW6omDj4RGTctAzMbJzIrAAqrOQCsAQARqwCAE4QohDsYBw4VKykdVC5+YUlZZVSskggisqqaOpaCFaGntocEwaOFkYR2oa6bh4IZsEcuta6Nmbajp76tjFx6Ni4hCQU1GmMQxzZeQVFpRVVYOXlrOUc8gA2AiYADMfgBbDitZ4dN7dGTqAYqTIjRDjSbTTyzeaGRbLVaIOa6LY7PYHI4nWIgeIXJLXVJ0e6ZR5tF6dd5XMgSeF9RFDFFjQ5WExhXQbYKGRxWKwrdyoo4cbT+UUOQz+UyeU5U86JDk3HjpB5PdqvLoQXUSbS9BRKJFqPqjKyC4V6MUWCVSmVrfySBVKsxSyxmAKSaKU6k65J6u4ZdiPMBMADysAAap9lOxqrV6mhGs1IfGk6nyum0D0ETa+favJFPNNDBtHAcQ8cQ-j1qEOJ43d5JMFG8dDJrw5dI-SDUzUImU2nMuayzyK8iq2NDELtoFVWZ9JilmY2-X9BxnNvbLYjBMzEPtSO6bcGTGsgXp8XZ5GLVb+ou7aAHaviRu1R3es220Kx-A4EMbEmVcg0kaUr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ajBxCZeqngaL2BCttGxBV-C1kpm6L2U8kZQMSjA86qUPGvmuF4-kh8pgGCahEJqsNTyVSmPMZu9VoqQK1BHSh-t3rTRuhI-uyD-p022PYkKys3YKIASfMCxhljRT0OYfex0b7xMqWInmtT9H0PqYw1EIVRYYL0MFJqRwtrSnHs3BwmIQiOFcZ3ISFS0kx3mMA221hHDnJqjiOm9dHasRqmVR0cx+w7OGa1URXcKkGOmVIhAkhR5Q1Yvwt0JTmL1ReXEt5OjYwAGUMDEDoLAeA3yjFjEsD0+Yug9AzFhp4ECBghQ4qMuclsl9dmwM4AAUQeuUQ5+VvA1S2JKbOzEWZ1xPm6Q8QiJSSwdkcDUMQohAA */\n id: \"GenuineCheckDeviceAction\",\n initial: \"DeviceReady\",\n context: (_) => {\n return {\n input: {\n unlockTimeout: _.input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n error: null,\n result: { isGenuine: false },\n getOsVersionResponse: null,\n deviceVersion: null,\n firmwareVersion: null,\n },\n };\n },\n states: {\n DeviceReady: {\n always: {\n target: \"GoToDashboard\",\n },\n },\n GoToDashboard: {\n invoke: {\n id: \"goToDashboard\",\n src: \"goToDashboard\",\n input: (_) => ({\n unlockTimeout: _.context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n requiredUserInteraction:\n _.event.snapshot.context.intermediateValue\n .requiredUserInteraction,\n }),\n }),\n },\n onDone: {\n target: \"GoToDashboardCheck\",\n actions: assign({\n _internalState: (_) =>\n _.event.output.caseOf<GenuineCheckStateMachineInternalState>({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GoToDashboardCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"GetOsVersion\",\n },\n ],\n },\n GetOsVersion: {\n invoke: {\n id: \"getOsVersion\",\n src: \"getOsVersion\",\n input: (_) => undefined,\n onDone: {\n target: \"GetOsVersionCheck\",\n actions: assign({\n _internalState: (_) => {\n if (isSuccessCommandResult(_.event.output)) {\n const currentState: DeviceSessionState =\n getDeviceSessionState();\n const isSecureConnectionAllowed =\n _.event.output.data.secureElementFlags\n .isSecureConnectionAllowed;\n if (\n currentState.sessionStateType !==\n DeviceSessionStateType.Connected\n ) {\n setDeviceSessionState({\n ...currentState,\n isSecureConnectionAllowed,\n });\n }\n return {\n ..._.context._internalState,\n getOsVersionResponse: _.event.output.data,\n };\n }\n return {\n ..._.context._internalState,\n error: _.event.output.error,\n };\n },\n }),\n },\n },\n },\n GetOsVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"GetDeviceVersion\",\n },\n ],\n },\n GetDeviceVersion: {\n invoke: {\n id: \"getDeviceVersion\",\n src: \"getDeviceVersion\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n }),\n onDone: {\n target: \"GetDeviceVersionCheck\",\n actions: assign({\n _internalState: (_) =>\n _.event.output.caseOf<GenuineCheckStateMachineInternalState>({\n Right: (deviceVersion) => ({\n ..._.context._internalState,\n deviceVersion,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GetDeviceVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"GetFirmwareVersion\" },\n ],\n },\n GetFirmwareVersion: {\n invoke: {\n id: \"getFirmwareVersion\",\n src: \"getFirmwareVersion\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n deviceVersion: _.context._internalState.deviceVersion!,\n }),\n onDone: {\n target: \"GetFirmwareVersionCheck\",\n actions: assign({\n _internalState: (_) =>\n _.event.output.caseOf<GenuineCheckStateMachineInternalState>({\n Right: (firmwareVersion) => ({\n ..._.context._internalState,\n firmwareVersion,\n }),\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n }),\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GetFirmwareVersionCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n { target: \"GenuineCheck\" },\n ],\n },\n GenuineCheck: {\n invoke: {\n id: \"genuineCheck\",\n src: \"genuineCheck\",\n input: (_) => ({\n deviceInfo: _.context._internalState.getOsVersionResponse!,\n finalFirmware: _.context._internalState.firmwareVersion!,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => {\n switch (_.event.snapshot.context?.type) {\n case SecureChannelEventType.PermissionRequested: {\n return {\n requiredUserInteraction:\n UserInteractionRequired.AllowSecureConnection,\n };\n }\n case SecureChannelEventType.PermissionGranted: {\n return {\n requiredUserInteraction: UserInteractionRequired.None,\n };\n }\n default:\n return {\n ..._.context.intermediateValue,\n };\n }\n },\n _internalState: (_) => {\n if (\n _.event.snapshot.context?.type ===\n SecureChannelEventType.Result\n ) {\n return {\n ..._.context._internalState,\n result: {\n isGenuine: isDeviceGenuine(\n _.event.snapshot.context.payload,\n ),\n },\n };\n }\n return _.context._internalState;\n },\n }),\n },\n onDone: {\n target: \"GenuineCheckCheck\",\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GenuineCheckCheck: {\n always: [\n {\n target: \"Error\",\n guard: \"hasError\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: (_) => {\n if (_.context._internalState.error) {\n return Left(_.context._internalState.error);\n } else {\n return Right(_.context._internalState.result);\n }\n },\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\n const getOsVersion = () =>\n internalApi.sendCommand(new GetOsVersionCommand());\n\n const getDeviceVersion = ({\n input,\n }: Input<{ deviceInfo: GetOsVersionResponse }>) => {\n const { deviceInfo } = input;\n return internalApi.getManagerApiService().getDeviceVersion(deviceInfo);\n };\n\n const getFirmwareVersion = ({\n input,\n }: Input<{\n deviceInfo: GetOsVersionResponse;\n deviceVersion: DeviceVersion;\n }>) => {\n const { deviceInfo, deviceVersion } = input;\n return internalApi\n .getManagerApiService()\n .getFirmwareVersion(deviceInfo, deviceVersion);\n };\n\n const genuineCheck = ({\n input,\n }: Input<{\n deviceInfo: GetOsVersionResponse;\n finalFirmware: FinalFirmware;\n }>) => {\n const { deviceInfo, finalFirmware } = input;\n const eitherConnection = internalApi\n .getSecureChannelService()\n .genuineCheck(deviceInfo, finalFirmware);\n return new ConnectToSecureChannelTask(internalApi, {\n connection: eitherConnection,\n }).run();\n };\n\n return {\n getOsVersion,\n getDeviceVersion,\n getFirmwareVersion,\n genuineCheck,\n getDeviceSessionState: () => internalApi.getDeviceSessionState(),\n setDeviceSessionState: (state: DeviceSessionState) =>\n internalApi.setDeviceSessionState(state),\n };\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,qBAC5BC,EAA2D,kBAE3DC,EAAuC,4CACvCC,EAGO,+CAEPC,EAAwC,4DACxCC,EAA0C,uCAC1CC,EAA0C,yEAE1CC,EAGO,8DACPC,EAGO,kDASPC,EAA2C,+DAC3CC,EAAuC,0CAEvCC,EAAgC,qCAIzB,MAAMb,UAAiC,oBAM5C,CACS,iBACPc,EAOA,CASA,KAAM,CACJ,aAAAC,EACA,iBAAAC,EACA,mBAAAC,EACA,aAAAC,EACA,sBAAAC,EACA,sBAAAC,CACF,EAAI,KAAK,oBAAoBN,CAAW,EAElCO,EAAgB,KAAK,MAAM,eAAiB,4BAE5CC,EAAuB,IAAI,4BAA0B,CACzD,MAAO,CACL,cAAAD,CACF,CACF,CAAC,EAAE,iBAAiBP,CAAW,EAE/B,SAAO,SAAM,CACX,MA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CACF,EACA,QAAS,CACP,KAAM,OACR,EACA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAASA,GACHA,EAAE,QAAQ,eAAe,SACpB,QAAKA,EAAE,QAAQ,eAAe,KAAK,KAEnC,SAAMA,EAAE,QAAQ,eAAe,MAAM,CAGlD,CAAC,CACH,CAEA,oBAAoBT,EAA+C,CAsCjE,MAAO,CACL,aAtCmB,IACnBA,EAAY,YAAY,IAAI,qBAAqB,EAsCjD,iBApCuB,CAAC,CACxB,MAAAe,CACF,IAAmD,CACjD,KAAM,CAAE,WAAAC,CAAW,EAAID,EACvB,OAAOf,EAAY,qBAAqB,EAAE,iBAAiBgB,CAAU,CACvE,EAgCE,mBA9ByB,CAAC,CAC1B,MAAAD,CACF,IAGO,CACL,KAAM,CAAE,WAAAC,EAAY,cAAAH,CAAc,EAAIE,EACtC,OAAOf,EACJ,qBAAqB,EACrB,mBAAmBgB,EAAYH,CAAa,CACjD,EAqBE,aAnBmB,CAAC,CACpB,MAAAE,CACF,IAGO,CACL,KAAM,CAAE,WAAAC,EAAY,cAAAC,CAAc,EAAIF,EAChCG,EAAmBlB,EACtB,wBAAwB,EACxB,aAAagB,EAAYC,CAAa,EACzC,OAAO,IAAI,6BAA2BjB,EAAa,CACjD,WAAYkB,CACd,CAAC,EAAE,IAAI,CACT,EAOE,sBAAuB,IAAMlB,EAAY,sBAAsB,EAC/D,sBAAwBmB,GACtBnB,EAAY,sBAAsBmB,CAAK,CAC3C,CACF,CACF",
6
6
  "names": ["GenuineCheckDeviceAction_exports", "__export", "GenuineCheckDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandResult", "import_GetOsVersionCommand", "import_UserInteractionRequired", "import_Const", "import_GoToDashboardDeviceAction", "import_XStateDeviceAction", "import_DeviceSessionState", "import_ConnectToSecureChannelTask", "import_types", "import_utils", "internalApi", "getOsVersion", "getDeviceVersion", "getFirmwareVersion", "genuineCheck", "getDeviceSessionState", "setDeviceSessionState", "unlockTimeout", "goToDashboardMachine", "_", "error", "currentState", "isSecureConnectionAllowed", "deviceVersion", "firmwareVersion", "input", "deviceInfo", "finalFirmware", "eitherConnection", "state"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var m=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var M=(r,n)=>{for(var s in n)m(r,s,{get:n[s],enumerable:!0})},C=(r,n,s,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of T(n))!k.call(r,o)&&o!==s&&m(r,o,{get:()=>n[o],enumerable:!(l=O(n,o))||l.enumerable});return r};var N=r=>C(m({},"__esModule",{value:!0}),r);var R={};M(R,{InstallAppDeviceAction:()=>G});module.exports=N(R);var u=require("purify-ts"),a=require("xstate"),g=require("../../../command/model/CommandResult"),h=require("../../../command/os/GetOsVersionCommand"),D=require("../../../device-action/model/UserInteractionRequired"),v=require("../../../device-action/os/Const"),S=require("../../../device-action/os/Errors"),f=require("../../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),x=require("../../../device-action/xstate-utils/XStateDeviceAction"),y=require("../../../device-session/DeviceSessionState"),V=require("../../../secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),E=require("../../../secure-channel/task/ConnectToSecureChannelTask"),L=require("../../../secure-channel/task/types");class G extends x.XStateDeviceAction{makeStateMachine(n){const{getOsVersion:s,getAppList:l,installApp:o,getDeviceSessionState:I,setDeviceSessionState:i}=this.extractDependencies(n),p=this.input.unlockTimeout??v.DEFAULT_UNLOCK_TIMEOUT_MS,d=new V.ListInstalledAppsDeviceAction({input:{unlockTimeout:p}}).makeStateMachine(n),A=new f.GoToDashboardDeviceAction({input:{unlockTimeout:p}}).makeStateMachine(n);return(0,a.setup)({types:{input:{},context:{},output:{}},actors:{listInstalledApps:d,goToDashboard:A,getOsVersion:(0,a.fromPromise)(s),getAppList:(0,a.fromPromise)(l),installApp:(0,a.fromObservable)(o)},guards:{hasError:t=>t.context._internalState.error!==null,appInstalled:t=>t.context._internalState.installedApps.some(e=>e.name===t.context.input.appName),appNotFound:t=>t.context._internalState.appList.findIndex(({versionName:e})=>e===t.context.input.appName)===-1,depAppNotInstalled:t=>{const e=t.context._internalState.appList.find(({versionName:c})=>c===t.context.input.appName);return e?.parentName?t.context._internalState.installedApps.findIndex(({name:c})=>c===e.parentName)===-1:!1}},actions:{assignErrorFromEvent:(0,a.assign)({_internalState:t=>({...t.context._internalState,error:t.event.error})}),assignAppNotFound:(0,a.assign)({_internalState:t=>({...t.context._internalState,error:new S.UnknownDAError("App to install not found in manager API")})}),assignDepAppNotInstalled:(0,a.assign)({_internalState:t=>({...t.context._internalState,error:new S.UnknownDAError("Dep app is not installed on the device")})})}}).createMachine({id:"InstallAppDeviceAction",initial:"DeviceReady",context:t=>({input:{unlockTimeout:t.input.unlockTimeout,appName:t.input.appName},intermediateValue:{requiredUserInteraction:D.UserInteractionRequired.None,progress:0},_internalState:{error:null,installedApps:[],getOsVersionResponse:null,appList:[]}}),states:{DeviceReady:{always:{target:"ListInstalledApps"}},ListInstalledApps:{value:"ListInstalledApps",invoke:{id:"listInstalledApps",src:"listInstalledApps",input:t=>({unlockTimeout:t.context.input.unlockTimeout}),onSnapshot:{actions:(0,a.assign)({intermediateValue:t=>({...t.context.intermediateValue,requiredUserInteraction:t.event.snapshot.context.intermediateValue.requiredUserInteraction})})},onDone:{target:"ListInstalledAppsCheck",actions:(0,a.assign)({_internalState:t=>t.event.output.caseOf({Right:({installedApps:e})=>({...t.context._internalState,installedApps:e}),Left:e=>({...t.context._internalState,error:e})})})}}},ListInstalledAppsCheck:{always:[{target:"Error",guard:"hasError"},{target:"Success",guard:"appInstalled"},{target:"GoToDashboard"}]},GoToDashboard:{invoke:{id:"goToDashboard",src:"goToDashboard",input:t=>({unlockTimeout:t.context.input.unlockTimeout}),onSnapshot:{actions:(0,a.assign)({intermediateValue:t=>({...t.context.intermediateValue,requiredUserInteraction:t.event.snapshot.context.intermediateValue.requiredUserInteraction})})},onDone:{target:"GoToDashboardCheck",actions:(0,a.assign)({_internalState:t=>t.event.output.caseOf({Right:()=>t.context._internalState,Left:e=>({...t.context._internalState,error:e})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GoToDashboardCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetOsVersion"}]},GetOsVersion:{invoke:{id:"getOsVersion",src:"getOsVersion",input:t=>{},onDone:{target:"GetOsVersionCheck",actions:(0,a.assign)({_internalState:t=>{if((0,g.isSuccessCommandResult)(t.event.output)){const e=I(),c=t.event.output.data.secureElementFlags.isSecureConnectionAllowed;return e.sessionStateType!==y.DeviceSessionStateType.Connected&&i({...e,isSecureConnectionAllowed:c}),{...t.context._internalState,getOsVersionResponse:t.event.output.data}}return{...t.context._internalState,error:t.event.output.error}}})}}},GetOsVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetAppList"}]},GetAppList:{invoke:{id:"getAppList",src:"getAppList",input:t=>({deviceInfo:t.context._internalState.getOsVersionResponse}),onDone:{target:"GetAppListCheck",actions:(0,a.assign)({_internalState:t=>t.event.output.caseOf({Right:e=>({...t.context._internalState,appList:e}),Left:e=>({...t.context._internalState,error:e})})})}}},GetAppListCheck:{always:[{target:"Error",guard:"hasError"},{target:"Error",guard:"appNotFound",actions:"assignAppNotFound"},{target:"Error",guard:"depAppNotInstalled",actions:"assignDepAppNotInstalled"},{target:"InstallApp"}]},InstallApp:{invoke:{id:"installApp",src:"installApp",input:t=>({deviceInfo:t.context._internalState.getOsVersionResponse,app:t.context._internalState.appList.find(({versionName:e})=>e===t.context.input.appName)}),onSnapshot:{actions:(0,a.assign)({intermediateValue:t=>t.event.snapshot.context?.type===L.SecureChannelEventType.Progress?{...t.context.intermediateValue,progress:t.event.snapshot.context.payload.progress}:{...t.context.intermediateValue}})},onDone:{target:"ListInstalledApps"},onError:{target:"Error",actions:"assignErrorFromEvent"}}},Success:{type:"final",description:"App installed successfully"},Error:{type:"final"}},output:({context:t})=>t._internalState.error?(0,u.Left)(t._internalState.error):(0,u.Right)(void 0)})}extractDependencies(n){return{getOsVersion:()=>n.sendCommand(new h.GetOsVersionCommand),getAppList:({input:i})=>{const{deviceInfo:p}=i;return n.getManagerApiService().getAppList(p,1)},installApp:({input:i})=>{const{deviceInfo:p,app:d}=i,A=n.getSecureChannelService().installApp(p,d);return new E.ConnectToSecureChannelTask(n,{connection:A}).run()},getDeviceSessionState:()=>n.getDeviceSessionState(),setDeviceSessionState:i=>n.setDeviceSessionState(i)}}}0&&(module.exports={InstallAppDeviceAction});
1
+ "use strict";var m=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var M=(r,n)=>{for(var s in n)m(r,s,{get:n[s],enumerable:!0})},C=(r,n,s,p)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of T(n))!k.call(r,o)&&o!==s&&m(r,o,{get:()=>n[o],enumerable:!(p=O(n,o))||p.enumerable});return r};var N=r=>C(m({},"__esModule",{value:!0}),r);var R={};M(R,{InstallAppDeviceAction:()=>G});module.exports=N(R);var d=require("purify-ts"),a=require("xstate"),I=require("../../../command/model/CommandResult"),g=require("../../../command/os/GetOsVersionCommand"),h=require("../../../device-action/model/UserInteractionRequired"),D=require("../../../device-action/os/Const"),S=require("../../../device-action/os/Errors"),v=require("../../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),f=require("../../../device-action/xstate-utils/XStateDeviceAction"),x=require("../../../device-session/DeviceSessionState"),y=require("../../../secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),V=require("../../../secure-channel/task/ConnectToSecureChannelTask"),E=require("../../../secure-channel/task/types");class G extends f.XStateDeviceAction{makeStateMachine(n){const{getOsVersion:s,getAppList:p,installApp:o,getDeviceSessionState:i,setDeviceSessionState:l}=this.extractDependencies(n),u=this.input.unlockTimeout??D.DEFAULT_UNLOCK_TIMEOUT_MS,A=new y.ListInstalledAppsDeviceAction({input:{unlockTimeout:u}}).makeStateMachine(n),L=new v.GoToDashboardDeviceAction({input:{unlockTimeout:u}}).makeStateMachine(n);return(0,a.setup)({types:{input:{},context:{},output:{}},actors:{listInstalledApps:A,goToDashboard:L,getOsVersion:(0,a.fromPromise)(s),getAppList:(0,a.fromPromise)(p),installApp:(0,a.fromObservable)(o)},guards:{hasError:t=>t.context._internalState.error!==null,appInstalled:t=>t.context._internalState.installedApps.some(e=>e.name===t.context.input.appName),appNotFound:t=>t.context._internalState.appList.findIndex(({versionName:e})=>e===t.context.input.appName)===-1,depAppNotInstalled:t=>{const e=t.context._internalState.appList.find(({versionName:c})=>c===t.context.input.appName);return e?.parentName?t.context._internalState.installedApps.findIndex(({name:c})=>c===e.parentName)===-1:!1}},actions:{assignErrorFromEvent:(0,a.assign)({_internalState:t=>({...t.context._internalState,error:t.event.error})}),assignAppNotFound:(0,a.assign)({_internalState:t=>({...t.context._internalState,error:new S.UnknownDAError("App to install not found in manager API")})}),assignDepAppNotInstalled:(0,a.assign)({_internalState:t=>({...t.context._internalState,error:new S.UnknownDAError("Dep app is not installed on the device")})})}}).createMachine({id:"InstallAppDeviceAction",initial:"DeviceReady",context:t=>({input:{unlockTimeout:t.input.unlockTimeout,appName:t.input.appName},intermediateValue:{requiredUserInteraction:h.UserInteractionRequired.None,progress:0},_internalState:{error:null,installedApps:[],getOsVersionResponse:null,appList:[]}}),states:{DeviceReady:{always:{target:"ListInstalledApps"}},ListInstalledApps:{value:"ListInstalledApps",invoke:{id:"listInstalledApps",src:"listInstalledApps",input:t=>({unlockTimeout:t.context.input.unlockTimeout}),onSnapshot:{actions:(0,a.assign)({intermediateValue:t=>({...t.context.intermediateValue,requiredUserInteraction:t.event.snapshot.context.intermediateValue.requiredUserInteraction})})},onDone:{target:"ListInstalledAppsCheck",actions:(0,a.assign)({_internalState:t=>t.event.output.caseOf({Right:({installedApps:e})=>({...t.context._internalState,installedApps:e}),Left:e=>({...t.context._internalState,error:e})})})}}},ListInstalledAppsCheck:{always:[{target:"Error",guard:"hasError"},{target:"Success",guard:"appInstalled"},{target:"GoToDashboard"}]},GoToDashboard:{invoke:{id:"goToDashboard",src:"goToDashboard",input:t=>({unlockTimeout:t.context.input.unlockTimeout}),onSnapshot:{actions:(0,a.assign)({intermediateValue:t=>({...t.context.intermediateValue,requiredUserInteraction:t.event.snapshot.context.intermediateValue.requiredUserInteraction})})},onDone:{target:"GoToDashboardCheck",actions:(0,a.assign)({_internalState:t=>t.event.output.caseOf({Right:()=>t.context._internalState,Left:e=>({...t.context._internalState,error:e})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GoToDashboardCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetOsVersion"}]},GetOsVersion:{invoke:{id:"getOsVersion",src:"getOsVersion",input:t=>{},onDone:{target:"GetOsVersionCheck",actions:(0,a.assign)({_internalState:t=>{if((0,I.isSuccessCommandResult)(t.event.output)){const e=i(),c=t.event.output.data.secureElementFlags.isSecureConnectionAllowed;return e.sessionStateType!==x.DeviceSessionStateType.Connected&&l({...e,isSecureConnectionAllowed:c}),{...t.context._internalState,getOsVersionResponse:t.event.output.data}}return{...t.context._internalState,error:t.event.output.error}}})}}},GetOsVersionCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetAppList"}]},GetAppList:{invoke:{id:"getAppList",src:"getAppList",input:t=>({deviceInfo:t.context._internalState.getOsVersionResponse}),onDone:{target:"GetAppListCheck",actions:(0,a.assign)({_internalState:t=>t.event.output.caseOf({Right:e=>({...t.context._internalState,appList:e}),Left:e=>({...t.context._internalState,error:e})})})}}},GetAppListCheck:{always:[{target:"Error",guard:"hasError"},{target:"Error",guard:"appNotFound",actions:"assignAppNotFound"},{target:"Error",guard:"depAppNotInstalled",actions:"assignDepAppNotInstalled"},{target:"InstallApp"}]},InstallApp:{invoke:{id:"installApp",src:"installApp",input:t=>({deviceInfo:t.context._internalState.getOsVersionResponse,app:t.context._internalState.appList.find(({versionName:e})=>e===t.context.input.appName)}),onSnapshot:{actions:(0,a.assign)({intermediateValue:t=>t.event.snapshot.context?.type===E.SecureChannelEventType.Progress?{...t.context.intermediateValue,progress:t.event.snapshot.context.payload.progress}:{...t.context.intermediateValue}})},onDone:{target:"ListInstalledApps"},onError:{target:"Error",actions:"assignErrorFromEvent"}}},Success:{type:"final",description:"App installed successfully"},Error:{type:"final"}},output:({context:t})=>t._internalState.error?(0,d.Left)(t._internalState.error):(0,d.Right)(void 0)})}extractDependencies(n){return{getOsVersion:()=>n.sendCommand(new g.GetOsVersionCommand),getAppList:({input:i})=>{const{deviceInfo:l}=i;return n.getManagerApiService().getAppList(l)},installApp:({input:i})=>{const{deviceInfo:l,app:u}=i,A=n.getSecureChannelService().installApp(l,u);return new V.ConnectToSecureChannelTask(n,{connection:A}).run()},getDeviceSessionState:()=>n.getDeviceSessionState(),setDeviceSessionState:i=>n.setDeviceSessionState(i)}}}0&&(module.exports={InstallAppDeviceAction});
2
2
  //# sourceMappingURL=InstallAppDeviceAction.js.map