@ledgerhq/device-management-kit 0.0.0-develop-20250513001204 → 0.0.0-develop-20250605001209

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 (136) hide show
  1. package/lib/cjs/package.json +1 -2
  2. package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
  3. package/lib/cjs/src/api/DeviceManagementKit.test.js.map +2 -2
  4. package/lib/cjs/src/api/command/di/commandModule.js +1 -1
  5. package/lib/cjs/src/api/command/di/commandModule.js.map +3 -3
  6. package/lib/cjs/src/api/command/di/commandModule.test.js +1 -1
  7. package/lib/cjs/src/api/command/di/commandModule.test.js.map +2 -2
  8. package/lib/cjs/src/api/device-action/di/deviceActionModule.js +1 -1
  9. package/lib/cjs/src/api/device-action/di/deviceActionModule.js.map +3 -3
  10. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js +1 -1
  11. package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  12. package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +1 -1
  13. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +1 -1
  14. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +2 -2
  15. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +1 -1
  16. package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +2 -2
  17. package/lib/cjs/src/di.js +1 -1
  18. package/lib/cjs/src/di.js.map +2 -2
  19. package/lib/cjs/src/internal/config/di/configModule.js +1 -1
  20. package/lib/cjs/src/internal/config/di/configModule.js.map +3 -3
  21. package/lib/cjs/src/internal/config/di/configModule.test.js +1 -1
  22. package/lib/cjs/src/internal/config/di/configModule.test.js.map +2 -2
  23. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js +1 -1
  24. package/lib/cjs/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  25. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  26. package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  27. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
  28. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  29. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  30. package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  31. package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
  32. package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
  33. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
  34. package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  35. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js +1 -1
  36. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  37. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  38. package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  39. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
  40. package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  41. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  42. package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  43. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  44. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  45. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  46. package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  47. package/lib/cjs/src/internal/send/di/sendModule.js +1 -1
  48. package/lib/cjs/src/internal/send/di/sendModule.js.map +3 -3
  49. package/lib/cjs/src/internal/send/di/sendModule.test.js +1 -1
  50. package/lib/cjs/src/internal/send/di/sendModule.test.js.map +2 -2
  51. package/lib/cjs/src/internal/transport/di/transportModule.js +1 -1
  52. package/lib/cjs/src/internal/transport/di/transportModule.js.map +3 -3
  53. package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
  54. package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
  55. package/lib/esm/package.json +1 -2
  56. package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
  57. package/lib/esm/src/api/DeviceManagementKit.test.js.map +2 -2
  58. package/lib/esm/src/api/command/di/commandModule.js +1 -1
  59. package/lib/esm/src/api/command/di/commandModule.js.map +3 -3
  60. package/lib/esm/src/api/command/di/commandModule.test.js +1 -1
  61. package/lib/esm/src/api/command/di/commandModule.test.js.map +2 -2
  62. package/lib/esm/src/api/device-action/di/deviceActionModule.js +1 -1
  63. package/lib/esm/src/api/device-action/di/deviceActionModule.js.map +3 -3
  64. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js +1 -1
  65. package/lib/esm/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
  66. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js +1 -1
  67. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +3 -3
  68. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +1 -1
  69. package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +3 -3
  70. package/lib/esm/src/di.js +1 -1
  71. package/lib/esm/src/di.js.map +2 -2
  72. package/lib/esm/src/internal/config/di/configModule.js +1 -1
  73. package/lib/esm/src/internal/config/di/configModule.js.map +3 -3
  74. package/lib/esm/src/internal/config/di/configModule.test.js +1 -1
  75. package/lib/esm/src/internal/config/di/configModule.test.js.map +2 -2
  76. package/lib/esm/src/internal/device-model/di/deviceModelModule.js +1 -1
  77. package/lib/esm/src/internal/device-model/di/deviceModelModule.js.map +3 -3
  78. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js +1 -1
  79. package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
  80. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
  81. package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
  82. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
  83. package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
  84. package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
  85. package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
  86. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
  87. package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
  88. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js +1 -1
  89. package/lib/esm/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
  90. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
  91. package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js.map +2 -2
  92. package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
  93. package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
  94. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
  95. package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
  96. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js +1 -1
  97. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
  98. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
  99. package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
  100. package/lib/esm/src/internal/send/di/sendModule.js +1 -1
  101. package/lib/esm/src/internal/send/di/sendModule.js.map +3 -3
  102. package/lib/esm/src/internal/send/di/sendModule.test.js +1 -1
  103. package/lib/esm/src/internal/send/di/sendModule.test.js.map +2 -2
  104. package/lib/esm/src/internal/transport/di/transportModule.js +1 -1
  105. package/lib/esm/src/internal/transport/di/transportModule.js.map +3 -3
  106. package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
  107. package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
  108. package/lib/types/src/api/apdu/utils/ApduBuilder.d.ts.map +1 -1
  109. package/lib/types/src/api/apdu/utils/ApduParser.d.ts.map +1 -1
  110. package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts.map +1 -1
  111. package/lib/types/src/api/command/di/commandModule.d.ts.map +1 -1
  112. package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
  113. package/lib/types/src/api/command/utils/CommandErrors.d.ts.map +1 -1
  114. package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
  115. package/lib/types/src/api/device-action/di/deviceActionModule.d.ts.map +1 -1
  116. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +2 -2
  117. package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -1
  118. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts +2 -2
  119. package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -1
  120. package/lib/types/src/api/device-session/service/DefaultApduReceiverService.stub.d.ts.map +1 -1
  121. package/lib/types/src/api/device-session/service/DefaultApduSenderService.stub.d.ts.map +1 -1
  122. package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
  123. package/lib/types/src/di.d.ts.map +1 -1
  124. package/lib/types/src/internal/config/di/configModule.d.ts.map +1 -1
  125. package/lib/types/src/internal/device-model/di/deviceModelModule.d.ts.map +1 -1
  126. package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
  127. package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
  128. package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts.map +1 -1
  129. package/lib/types/src/internal/discovery/di/discoveryModule.d.ts.map +1 -1
  130. package/lib/types/src/internal/logger-publisher/di/loggerModule.d.ts.map +1 -1
  131. package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
  132. package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -1
  133. package/lib/types/src/internal/send/di/sendModule.d.ts.map +1 -1
  134. package/lib/types/src/internal/transport/di/transportModule.d.ts.map +1 -1
  135. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  136. package/package.json +2 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/transport/di/transportModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { TransportMock } from \"@api/transport/model/__mocks__/TransportMock\";\nimport { deviceModelModuleFactory } from \"@internal/device-model/di/deviceModelModule\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\n\nimport { transportDiTypes } from \"./transportDiTypes\";\nimport { transportModuleFactory } from \"./transportModule\";\n\ndescribe(\"transportModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof transportModuleFactory>;\n beforeEach(() => {\n mod = transportModuleFactory();\n container = new Container();\n container.load(mod);\n });\n\n it(\"should create the transport module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should not bind the TransportService when transports is empty\", () => {\n try {\n container.get(transportDiTypes.TransportService);\n } catch (error) {\n expect(error).toBeDefined();\n }\n });\n });\n\n describe(\"With transports\", () => {\n let container: Container;\n let mod: ReturnType<typeof transportModuleFactory>;\n let transport: TransportMock;\n beforeEach(() => {\n transport = new TransportMock();\n vi.spyOn(transport, \"getIdentifier\").mockReturnValue(\"MOCK\");\n const logger = loggerModuleFactory();\n const deviceModel = deviceModelModuleFactory({ stub: true });\n const deviceSession = deviceSessionModuleFactory({ stub: true });\n mod = transportModuleFactory({\n transports: [() => transport],\n config: {\n managerApiUrl: \"http://fake.url/api\",\n mockUrl: \"http://fake.url\",\n webSocketUrl: \"ws://fake.websocket.url\",\n firmwareDistributionSalt: \"salt\",\n } as DmkConfig,\n });\n container = new Container();\n container.load(logger, deviceModel, deviceSession, mod);\n });\n\n it(\"should bind the TransportService\", () => {\n expect(container.get(transportDiTypes.TransportService)).toBeDefined();\n });\n });\n\n describe(\"With stub\", () => {\n let container: Container;\n let mod: ReturnType<typeof transportModuleFactory>;\n let transport: TransportMock;\n beforeEach(() => {\n transport = new TransportMock();\n vi.spyOn(transport, \"getIdentifier\").mockReturnValue(\"MOCK\");\n mod = transportModuleFactory({\n stub: true,\n transports: [() => transport],\n });\n container = new Container();\n container.load(mod);\n });\n\n it(\"should create the transport module\", () => {\n expect(mod).toBeDefined();\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA0B,qBAG1BC,EAA8B,wDAC9BC,EAAyC,uDACzCC,EAA2C,2DAC3CC,EAAoC,sDAEpCC,EAAiC,8BACjCC,EAAuC,6BAEvC,SAAS,yBAA0B,IAAM,CACvC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,0BAAuB,EAC7BD,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,qCAAsC,IAAM,CAC7C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,gEAAiE,IAAM,CACxE,GAAI,CACFD,EAAU,IAAI,mBAAiB,gBAAgB,CACjD,OAASE,EAAO,CACd,OAAOA,CAAK,EAAE,YAAY,CAC5B,CACF,CAAC,CACH,CAAC,EAED,SAAS,kBAAmB,IAAM,CAChC,IAAIF,EACAC,EACAE,EACJ,WAAW,IAAM,CACfA,EAAY,IAAI,gBAChB,GAAG,MAAMA,EAAW,eAAe,EAAE,gBAAgB,MAAM,EAC3D,MAAMC,KAAS,uBAAoB,EAC7BC,KAAc,4BAAyB,CAAE,KAAM,EAAK,CAAC,EACrDC,KAAgB,8BAA2B,CAAE,KAAM,EAAK,CAAC,EAC/DL,KAAM,0BAAuB,CAC3B,WAAY,CAAC,IAAME,CAAS,EAC5B,OAAQ,CACN,cAAe,sBACf,QAAS,kBACT,aAAc,0BACd,yBAA0B,MAC5B,CACF,CAAC,EACDH,EAAY,IAAI,YAChBA,EAAU,KAAKI,EAAQC,EAAaC,EAAeL,CAAG,CACxD,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,OAAOD,EAAU,IAAI,mBAAiB,gBAAgB,CAAC,EAAE,YAAY,CACvE,CAAC,CACH,CAAC,EAED,SAAS,YAAa,IAAM,CAC1B,IAAIA,EACAC,EACAE,EACJ,WAAW,IAAM,CACfA,EAAY,IAAI,gBAChB,GAAG,MAAMA,EAAW,eAAe,EAAE,gBAAgB,MAAM,EAC3DF,KAAM,0BAAuB,CAC3B,KAAM,GACN,WAAY,CAAC,IAAME,CAAS,CAC9B,CAAC,EACDH,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,qCAAsC,IAAM,CAC7C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { TransportMock } from \"@api/transport/model/__mocks__/TransportMock\";\nimport { deviceModelModuleFactory } from \"@internal/device-model/di/deviceModelModule\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\n\nimport { transportDiTypes } from \"./transportDiTypes\";\nimport { transportModuleFactory } from \"./transportModule\";\n\ndescribe(\"transportModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof transportModuleFactory>;\n beforeEach(() => {\n mod = transportModuleFactory();\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should create the transport module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should not bind the TransportService when transports is empty\", () => {\n try {\n container.get(transportDiTypes.TransportService);\n } catch (error) {\n expect(error).toBeDefined();\n }\n });\n });\n\n describe(\"With transports\", () => {\n let container: Container;\n let mod: ReturnType<typeof transportModuleFactory>;\n let transport: TransportMock;\n beforeEach(() => {\n transport = new TransportMock();\n vi.spyOn(transport, \"getIdentifier\").mockReturnValue(\"MOCK\");\n const logger = loggerModuleFactory();\n const deviceModel = deviceModelModuleFactory({ stub: true });\n const deviceSession = deviceSessionModuleFactory({ stub: true });\n mod = transportModuleFactory({\n transports: [() => transport],\n config: {\n managerApiUrl: \"http://fake.url/api\",\n mockUrl: \"http://fake.url\",\n webSocketUrl: \"ws://fake.websocket.url\",\n firmwareDistributionSalt: \"salt\",\n } as DmkConfig,\n });\n container = new Container();\n container.loadSync(logger, deviceModel, deviceSession, mod);\n });\n\n it(\"should bind the TransportService\", () => {\n expect(container.get(transportDiTypes.TransportService)).toBeDefined();\n });\n });\n\n describe(\"With stub\", () => {\n let container: Container;\n let mod: ReturnType<typeof transportModuleFactory>;\n let transport: TransportMock;\n beforeEach(() => {\n transport = new TransportMock();\n vi.spyOn(transport, \"getIdentifier\").mockReturnValue(\"MOCK\");\n mod = transportModuleFactory({\n stub: true,\n transports: [() => transport],\n });\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should create the transport module\", () => {\n expect(mod).toBeDefined();\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA0B,qBAG1BC,EAA8B,wDAC9BC,EAAyC,uDACzCC,EAA2C,2DAC3CC,EAAoC,sDAEpCC,EAAiC,8BACjCC,EAAuC,6BAEvC,SAAS,yBAA0B,IAAM,CACvC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,0BAAuB,EAC7BD,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,qCAAsC,IAAM,CAC7C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,gEAAiE,IAAM,CACxE,GAAI,CACFD,EAAU,IAAI,mBAAiB,gBAAgB,CACjD,OAASE,EAAO,CACd,OAAOA,CAAK,EAAE,YAAY,CAC5B,CACF,CAAC,CACH,CAAC,EAED,SAAS,kBAAmB,IAAM,CAChC,IAAIF,EACAC,EACAE,EACJ,WAAW,IAAM,CACfA,EAAY,IAAI,gBAChB,GAAG,MAAMA,EAAW,eAAe,EAAE,gBAAgB,MAAM,EAC3D,MAAMC,KAAS,uBAAoB,EAC7BC,KAAc,4BAAyB,CAAE,KAAM,EAAK,CAAC,EACrDC,KAAgB,8BAA2B,CAAE,KAAM,EAAK,CAAC,EAC/DL,KAAM,0BAAuB,CAC3B,WAAY,CAAC,IAAME,CAAS,EAC5B,OAAQ,CACN,cAAe,sBACf,QAAS,kBACT,aAAc,0BACd,yBAA0B,MAC5B,CACF,CAAC,EACDH,EAAY,IAAI,YAChBA,EAAU,SAASI,EAAQC,EAAaC,EAAeL,CAAG,CAC5D,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,OAAOD,EAAU,IAAI,mBAAiB,gBAAgB,CAAC,EAAE,YAAY,CACvE,CAAC,CACH,CAAC,EAED,SAAS,YAAa,IAAM,CAC1B,IAAIA,EACAC,EACAE,EACJ,WAAW,IAAM,CACfA,EAAY,IAAI,gBAChB,GAAG,MAAMA,EAAW,eAAe,EAAE,gBAAgB,MAAM,EAC3DF,KAAM,0BAAuB,CAC3B,KAAM,GACN,WAAY,CAAC,IAAME,CAAS,CAC9B,CAAC,EACDH,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,qCAAsC,IAAM,CAC7C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_inversify", "import_TransportMock", "import_deviceModelModule", "import_deviceSessionModule", "import_loggerModule", "import_transportDiTypes", "import_transportModule", "container", "mod", "error", "transport", "logger", "deviceModel", "deviceSession"]
7
7
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/device-management-kit",
3
- "version": "0.6.5",
3
+ "version": "0.7.0",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
@@ -35,7 +35,6 @@
35
35
  "@sentry/minimal": "catalog:",
36
36
  "axios": "catalog:",
37
37
  "inversify": "catalog:",
38
- "inversify-logger-middleware": "catalog:",
39
38
  "isomorphic-ws": "catalog:",
40
39
  "purify-ts": "catalog:",
41
40
  "reflect-metadata": "catalog:",
@@ -1,2 +1,2 @@
1
- import{StubLocalConfigDataSource as c}from"../internal/config/data/LocalConfigDataSource.stub";import{configTypes as r}from"../internal/config/di/configTypes";import{deviceSessionTypes as a}from"../internal/device-session/di/deviceSessionTypes";import{discoveryTypes as t}from"../internal/discovery/di/discoveryTypes";import{managerApiTypes as d}from"../internal/manager-api/di/managerApiTypes";import{sendTypes as m}from"../internal/send/di/sendTypes";import p from"../../package.json";import{StubUseCase as f}from"../../src/di.stub";import{commandTypes as l}from"./command/di/commandTypes";import{ConsoleLogger as u}from"./logger-subscriber/service/ConsoleLogger";import{DeviceManagementKit as o}from"./DeviceManagementKit";vi.mock("./logger-subscriber/service/ConsoleLogger");let e,i;describe("DeviceManagementKit",()=>{describe("clean",()=>{beforeEach(()=>{i=new u,e=new o({stub:!1,loggers:[i],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url",firmwareDistributionSalt:"salt"}})}),it("should create an instance",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(o)}),it("should return a clean `version`",async()=>{expect(await e.getVersion()).toBe(p.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 o({stub:!0,loggers:[],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url",firmwareDistributionSalt:"salt"}})}),it("should create a stubbed dmk",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(o)}),it("should return a stubbed config",()=>{expect(e.container.get(r.LocalConfigDataSource)).toBeInstanceOf(c)}),it("should return a stubbed version",async()=>{expect(await e.getVersion()).toBe("0.0.0-stub.1")}),it.each([[t.StartDiscoveringUseCase],[t.StopDiscoveringUseCase],[t.ConnectUseCase],[m.SendApduUseCase],[l.SendCommandUseCase],[t.GetConnectedDeviceUseCase],[t.DisconnectUseCase],[a.GetDeviceSessionStateUseCase],[t.ListConnectedDevicesUseCase],[t.ListenToConnectedDeviceUseCase],[d.SetProviderUseCase]])("should have %s use case",n=>{const s=e.container.get(n);expect(s).toBeInstanceOf(f),expect(s.execute()).toBe("stub")})})});
1
+ import{StubLocalConfigDataSource as r}from"../internal/config/data/LocalConfigDataSource.stub";import{configTypes as c}from"../internal/config/di/configTypes";import{deviceSessionTypes as a}from"../internal/device-session/di/deviceSessionTypes";import{discoveryTypes as t}from"../internal/discovery/di/discoveryTypes";import{managerApiTypes as d}from"../internal/manager-api/di/managerApiTypes";import{sendTypes as m}from"../internal/send/di/sendTypes";import p from"../../package.json";import{StubUseCase as f}from"../../src/di.stub";import{commandTypes as l}from"./command/di/commandTypes";import{ConsoleLogger as u}from"./logger-subscriber/service/ConsoleLogger";import{DeviceManagementKit as o}from"./DeviceManagementKit";vi.mock("./logger-subscriber/service/ConsoleLogger");let e,i;describe("DeviceManagementKit",()=>{describe("clean",()=>{beforeEach(()=>{i=new u,e=new o({stub:!1,loggers:[i],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url",firmwareDistributionSalt:"salt"}})}),it("should create an instance",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(o)}),it("should return a clean `version`",async()=>{expect(await e.getVersion()).toBe(p.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 o({stub:!0,loggers:[],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url",firmwareDistributionSalt:"salt"}})}),it("should create a stubbed dmk",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(o)}),it("should return a stubbed config",()=>{expect(e.container.get(c.LocalConfigDataSource)).toBeInstanceOf(r)}),it("should return a stubbed version",async()=>{expect(await e.getVersion()).toBe("0.0.0-stub.1")}),it.each([[t.StartDiscoveringUseCase],[t.StopDiscoveringUseCase],[t.ConnectUseCase],[m.SendApduUseCase],[l.SendCommandUseCase],[t.GetConnectedDeviceUseCase],[t.DisconnectUseCase],[a.GetDeviceSessionStateUseCase],[t.ListConnectedDevicesUseCase],[t.ListenToConnectedDeviceUseCase],[d.SetProviderUseCase]])("should have %s use case",n=>{const s=e.container.get(n);expect(s).toBeInstanceOf(f),expect(s.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 { 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 firmwareDistributionSalt: \"salt\",\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 firmwareDistributionSalt: \"salt\",\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": "AAGA,OAAS,6BAAAA,MAAiC,mDAC1C,OAAS,eAAAC,MAAmB,kCAC5B,OAAS,sBAAAC,MAA0B,iDACnC,OAAS,kBAAAC,MAAsB,wCAC/B,OAAS,mBAAAC,MAAuB,2CAChC,OAAS,aAAAC,MAAiB,8BAC1B,OAAOC,MAAS,qBAChB,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,gBAAAC,MAAoB,4BAC7B,OAAS,iBAAAC,MAAqB,4CAC9B,OAAS,uBAAAC,MAA2B,wBAGpC,GAAG,KAAK,2CAA2C,EAEnD,IAAIC,EACAC,EACJ,SAAS,sBAAuB,IAAM,CACpC,SAAS,QAAS,IAAM,CACtB,WAAW,IAAM,CACfA,EAAS,IAAIH,EACbE,EAAM,IAAID,EAAoB,CAC5B,KAAM,GACN,QAAS,CAACE,CAAM,EAChB,OAAQ,CACN,cAAe,kBACf,QAAS,uBACT,aAAc,4BACd,yBAA0B,MAC5B,CACF,CAAC,CACH,CAAC,EAED,GAAG,4BAA6B,IAAM,CACpC,OAAOD,CAAG,EAAE,YAAY,EACxB,OAAOA,CAAG,EAAE,eAAeD,CAAmB,CAChD,CAAC,EAED,GAAG,kCAAmC,SAAY,CAChD,OAAO,MAAMC,EAAI,WAAW,CAAC,EAAE,KAAKL,EAAI,OAAO,CACjD,CAAC,EAED,GAAG,oCAAqC,IAAM,CAC5C,OAAOK,EAAI,gBAAgB,EAAE,YAAY,CAC3C,CAAC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uB,EACvC,CAACA,EAAe,sBAAsB,EACtC,CAACA,EAAe,cAAc,EAC9B,CAACE,EAAU,eAAe,EAC1B,CAACG,EAAa,kBAAkB,EAChC,CAACL,EAAe,yBAAyB,EACzC,CAACA,EAAe,iBAAiB,EACjC,CAACD,EAAmB,4BAA4B,EAChD,CAACC,EAAe,2BAA2B,EAC3C,CAACA,EAAe,8BAA8B,EAC9C,CAACC,EAAgB,kBAAkB,CACrC,CAAC,EACC,0BACCS,GAAwD,CACvD,MAAMC,EAAKH,EAAI,UAAU,IAAiBE,CAAQ,EAClD,OAAOC,CAAE,EAAE,eAAeP,CAAW,EACrC,OAAOO,EAAG,QAAQ,CAAC,EAAE,KAAK,MAAM,CAClC,CACF,CACF,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { type ServiceIdentifier } 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 firmwareDistributionSalt: \"salt\",\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 firmwareDistributionSalt: \"salt\",\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: 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": "AAGA,OAAS,6BAAAA,MAAiC,mDAC1C,OAAS,eAAAC,MAAmB,kCAC5B,OAAS,sBAAAC,MAA0B,iDACnC,OAAS,kBAAAC,MAAsB,wCAC/B,OAAS,mBAAAC,MAAuB,2CAChC,OAAS,aAAAC,MAAiB,8BAC1B,OAAOC,MAAS,qBAChB,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,gBAAAC,MAAoB,4BAC7B,OAAS,iBAAAC,MAAqB,4CAC9B,OAAS,uBAAAC,MAA2B,wBAGpC,GAAG,KAAK,2CAA2C,EAEnD,IAAIC,EACAC,EACJ,SAAS,sBAAuB,IAAM,CACpC,SAAS,QAAS,IAAM,CACtB,WAAW,IAAM,CACfA,EAAS,IAAIH,EACbE,EAAM,IAAID,EAAoB,CAC5B,KAAM,GACN,QAAS,CAACE,CAAM,EAChB,OAAQ,CACN,cAAe,kBACf,QAAS,uBACT,aAAc,4BACd,yBAA0B,MAC5B,CACF,CAAC,CACH,CAAC,EAED,GAAG,4BAA6B,IAAM,CACpC,OAA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B,CAChD,CAAC,EAED,GAAG,iCAAkC,IAAM,CACzC,OACEC,EAAI,UAAU,IACZV,EAAY,qBACd,CACF,EAAE,eAAeD,CAAyB,CAC5C,CAAC,EAED,GAAG,kCAAmC,SAAY,CAChD,OAAO,MAAMW,EAAI,WAAW,CAAC,EAAE,KAAK,cAAc,CACpD,CAAC,EAED,GAAG,KAAK,CACN,CAACR,EAAe,uBAAuB,EACvC,CAACA,EAAe,sBAAsB,EACtC,CAACA,EAAe,cAAc,EAC9B,CAACE,EAAU,eAAe,EAC1B,CAACG,EAAa,kBAAkB,EAChC,CAACL,EAAe,yBAAyB,EACzC,CAACA,EAAe,iBAAiB,EACjC,CAACD,EAAmB,4BAA4B,EAChD,CAACC,EAAe,2BAA2B,EAC3C,CAACA,EAAe,8BAA8B,EAC9C,CAACC,EAAgB,kBAAkB,CACrC,CAAC,EACC,0BACCS,GAA6C,CAC5C,MAAMC,EAAKH,EAAI,UAAU,IAAiBE,CAAQ,EAClD,OAAOC,CAAE,EAAE,eAAeP,CAAW,EACrC,OAAOO,EAAG,QAAQ,CAAC,EAAE,KAAK,MAAM,CAClC,CACF,CACF,CAAC,CACH,CAAC",
6
6
  "names": ["StubLocalConfigDataSource", "configTypes", "deviceSessionTypes", "discoveryTypes", "managerApiTypes", "sendTypes", "pkg", "StubUseCase", "commandTypes", "ConsoleLogger", "DeviceManagementKit", "dmk", "logger", "diSymbol", "uc"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ContainerModule as a}from"inversify";import{SendCommandUseCase as d}from"../../command/use-case/SendCommandUseCase";import{StubUseCase as t}from"../../../../src/di.stub";import{commandTypes as o}from"./commandTypes";const b=({stub:n=!1}={})=>new a((e,s,r,m,i,C,u)=>{e(o.SendCommandUseCase).to(d),n&&m(o.SendCommandUseCase).to(t)});export{b as commandModuleFactory};
1
+ import{ContainerModule as n}from"inversify";import{SendCommandUseCase as d}from"../../command/use-case/SendCommandUseCase";import{StubUseCase as r}from"../../../../src/di.stub";import{commandTypes as o}from"./commandTypes";const i=({stub:e=!1}={})=>new n(({bind:m,rebindSync:a})=>{m(o.SendCommandUseCase).to(d),e&&a(o.SendCommandUseCase).to(r)});export{i as commandModuleFactory};
2
2
  //# sourceMappingURL=commandModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/command/di/commandModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { SendCommandUseCase } from \"@api/command/use-case/SendCommandUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandTypes } from \"./commandTypes\";\n\ntype CommandModuleArgs = Partial<{\n readonly stub: boolean;\n}>;\n\nexport const commandModuleFactory = ({\n stub = false,\n}: CommandModuleArgs = {}) =>\n new ContainerModule(\n (\n bind,\n _unbind,\n _isBound,\n rebind,\n _unbindAsync,\n _onActivation,\n _onDeactivation,\n ) => {\n bind(commandTypes.SendCommandUseCase).to(SendCommandUseCase);\n if (stub) {\n rebind(commandTypes.SendCommandUseCase).to(StubUseCase);\n }\n },\n );\n"],
5
- "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,sBAAAC,MAA0B,2CACnC,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,gBAAAC,MAAoB,iBAMtB,MAAMC,EAAuB,CAAC,CACnC,KAAAC,EAAO,EACT,EAAuB,CAAC,IACtB,IAAIL,EACF,CACEM,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,IACG,CACHN,EAAKH,EAAa,kBAAkB,EAAE,GAAGF,CAAkB,EACvDI,GACFI,EAAON,EAAa,kBAAkB,EAAE,GAAGD,CAAW,CAE1D,CACF",
6
- "names": ["ContainerModule", "SendCommandUseCase", "StubUseCase", "commandTypes", "commandModuleFactory", "stub", "bind", "_unbind", "_isBound", "rebind", "_unbindAsync", "_onActivation", "_onDeactivation"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { SendCommandUseCase } from \"@api/command/use-case/SendCommandUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandTypes } from \"./commandTypes\";\n\ntype CommandModuleArgs = Partial<{\n readonly stub: boolean;\n}>;\n\nexport const commandModuleFactory = ({\n stub = false,\n}: CommandModuleArgs = {}) =>\n new ContainerModule(({ bind, rebindSync }) => {\n bind(commandTypes.SendCommandUseCase).to(SendCommandUseCase);\n if (stub) {\n rebindSync(commandTypes.SendCommandUseCase).to(StubUseCase);\n }\n });\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,sBAAAC,MAA0B,2CACnC,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,gBAAAC,MAAoB,iBAMtB,MAAMC,EAAuB,CAAC,CACnC,KAAAC,EAAO,EACT,EAAuB,CAAC,IACtB,IAAIL,EAAgB,CAAC,CAAE,KAAAM,EAAM,WAAAC,CAAW,IAAM,CAC5CD,EAAKH,EAAa,kBAAkB,EAAE,GAAGF,CAAkB,EACvDI,GACFE,EAAWJ,EAAa,kBAAkB,EAAE,GAAGD,CAAW,CAE9D,CAAC",
6
+ "names": ["ContainerModule", "SendCommandUseCase", "StubUseCase", "commandTypes", "commandModuleFactory", "stub", "bind", "rebindSync"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Container as n}from"inversify";import{SendCommandUseCase as r}from"../../command/use-case/SendCommandUseCase";import{deviceSessionModuleFactory as a}from"../../../internal/device-session/di/deviceSessionModule";import{loggerModuleFactory as s}from"../../../internal/logger-publisher/di/loggerModule";import{StubUseCase as c}from"../../../../src/di.stub";import{commandModuleFactory as d}from"./commandModule";import{commandTypes as m}from"./commandTypes";describe("commandModuleFactory",()=>{describe("Default",()=>{let e,o;beforeEach(()=>{o=d(),e=new n,e.load(o,a(),s())}),it("should return the config module",()=>{expect(o).toBeDefined()}),it("should return non-stubbed sendCommand usecase",()=>{const t=e.get(m.SendCommandUseCase);expect(t).toBeInstanceOf(r)})}),describe("Stubbed",()=>{let e,o;beforeEach(()=>{o=d({stub:!0}),e=new n,e.load(o)}),it("should return the config module",()=>{expect(o).toBeDefined()}),it("should return stubbed sendCommand usecase",()=>{const t=e.get(m.SendCommandUseCase);expect(t).toBeInstanceOf(c)})})});
1
+ import{Container as n}from"inversify";import{SendCommandUseCase as r}from"../../command/use-case/SendCommandUseCase";import{deviceSessionModuleFactory as a}from"../../../internal/device-session/di/deviceSessionModule";import{loggerModuleFactory as s}from"../../../internal/logger-publisher/di/loggerModule";import{StubUseCase as c}from"../../../../src/di.stub";import{commandModuleFactory as d}from"./commandModule";import{commandTypes as m}from"./commandTypes";describe("commandModuleFactory",()=>{describe("Default",()=>{let e,o;beforeEach(()=>{o=d(),e=new n,e.loadSync(o,a(),s())}),it("should return the config module",()=>{expect(o).toBeDefined()}),it("should return non-stubbed sendCommand usecase",()=>{const t=e.get(m.SendCommandUseCase);expect(t).toBeInstanceOf(r)})}),describe("Stubbed",()=>{let e,o;beforeEach(()=>{o=d({stub:!0}),e=new n,e.loadSync(o)}),it("should return the config module",()=>{expect(o).toBeDefined()}),it("should return stubbed sendCommand usecase",()=>{const t=e.get(m.SendCommandUseCase);expect(t).toBeInstanceOf(c)})})});
2
2
  //# sourceMappingURL=commandModule.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/command/di/commandModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { SendCommandUseCase } from \"@api/command/use-case/SendCommandUseCase\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandModuleFactory } from \"./commandModule\";\nimport { commandTypes } from \"./commandTypes\";\n\ndescribe(\"commandModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof commandModuleFactory>;\n beforeEach(() => {\n mod = commandModuleFactory();\n container = new Container();\n container.load(mod, deviceSessionModuleFactory(), loggerModuleFactory());\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return non-stubbed sendCommand usecase\", () => {\n const sendCommandUseCase = container.get<SendCommandUseCase>(\n commandTypes.SendCommandUseCase,\n );\n expect(sendCommandUseCase).toBeInstanceOf(SendCommandUseCase);\n });\n });\n\n describe(\"Stubbed\", () => {\n let container: Container;\n let mod: ReturnType<typeof commandModuleFactory>;\n beforeEach(() => {\n mod = commandModuleFactory({ stub: true });\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return stubbed sendCommand usecase\", () => {\n const sendCommandUseCase = container.get(commandTypes.SendCommandUseCase);\n expect(sendCommandUseCase).toBeInstanceOf(StubUseCase);\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,aAAAA,MAAiB,YAE1B,OAAS,sBAAAC,MAA0B,2CACnC,OAAS,8BAAAC,MAAkC,kDAC3C,OAAS,uBAAAC,MAA2B,6CACpC,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,wBAAAC,MAA4B,kBACrC,OAAS,gBAAAC,MAAoB,iBAE7B,SAAS,uBAAwB,IAAM,CACrC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,EAAMH,EAAqB,EAC3BE,EAAY,IAAIP,EAChBO,EAAU,KAAKC,EAAKN,EAA2B,EAAGC,EAAoB,CAAC,CACzE,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOK,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,gDAAiD,IAAM,CACxD,MAAMC,EAAqBF,EAAU,IACnCD,EAAa,kBACf,EACA,OAAOG,CAAkB,EAAE,eAAeR,CAAkB,CAC9D,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,IAAIM,EACAC,EACJ,WAAW,IAAM,CACfA,EAAMH,EAAqB,CAAE,KAAM,EAAK,CAAC,EACzCE,EAAY,IAAIP,EAChBO,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,4CAA6C,IAAM,CACpD,MAAMC,EAAqBF,EAAU,IAAID,EAAa,kBAAkB,EACxE,OAAOG,CAAkB,EAAE,eAAeL,CAAW,CACvD,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { SendCommandUseCase } from \"@api/command/use-case/SendCommandUseCase\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandModuleFactory } from \"./commandModule\";\nimport { commandTypes } from \"./commandTypes\";\n\ndescribe(\"commandModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof commandModuleFactory>;\n beforeEach(() => {\n mod = commandModuleFactory();\n container = new Container();\n container.loadSync(\n mod,\n deviceSessionModuleFactory(),\n loggerModuleFactory(),\n );\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return non-stubbed sendCommand usecase\", () => {\n const sendCommandUseCase = container.get<SendCommandUseCase>(\n commandTypes.SendCommandUseCase,\n );\n expect(sendCommandUseCase).toBeInstanceOf(SendCommandUseCase);\n });\n });\n\n describe(\"Stubbed\", () => {\n let container: Container;\n let mod: ReturnType<typeof commandModuleFactory>;\n beforeEach(() => {\n mod = commandModuleFactory({ stub: true });\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return stubbed sendCommand usecase\", () => {\n const sendCommandUseCase = container.get(commandTypes.SendCommandUseCase);\n expect(sendCommandUseCase).toBeInstanceOf(StubUseCase);\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,aAAAA,MAAiB,YAE1B,OAAS,sBAAAC,MAA0B,2CACnC,OAAS,8BAAAC,MAAkC,kDAC3C,OAAS,uBAAAC,MAA2B,6CACpC,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,wBAAAC,MAA4B,kBACrC,OAAS,gBAAAC,MAAoB,iBAE7B,SAAS,uBAAwB,IAAM,CACrC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,EAAMH,EAAqB,EAC3BE,EAAY,IAAIP,EAChBO,EAAU,SACRC,EACAN,EAA2B,EAC3BC,EAAoB,CACtB,CACF,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOK,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,gDAAiD,IAAM,CACxD,MAAMC,EAAqBF,EAAU,IACnCD,EAAa,kBACf,EACA,OAAOG,CAAkB,EAAE,eAAeR,CAAkB,CAC9D,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,IAAIM,EACAC,EACJ,WAAW,IAAM,CACfA,EAAMH,EAAqB,CAAE,KAAM,EAAK,CAAC,EACzCE,EAAY,IAAIP,EAChBO,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,4CAA6C,IAAM,CACpD,MAAMC,EAAqBF,EAAU,IAAID,EAAa,kBAAkB,EACxE,OAAOG,CAAkB,EAAE,eAAeL,CAAW,CACvD,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["Container", "SendCommandUseCase", "deviceSessionModuleFactory", "loggerModuleFactory", "StubUseCase", "commandModuleFactory", "commandTypes", "container", "mod", "sendCommandUseCase"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ContainerModule as n}from"inversify";import{ExecuteDeviceActionUseCase as c}from"../../device-action/use-case/ExecuteDeviceActionUseCase";import{StubUseCase as s}from"../../../../src/di.stub";import{deviceActionTypes as e}from"./deviceActionTypes";const f=({stub:o=!1}={})=>new n((i,r,a,t,u,A,d)=>{i(e.ExecuteDeviceActionUseCase).to(c),o&&t(e.ExecuteDeviceActionUseCase).to(s)});export{f as deviceActionModuleFactory};
1
+ import{ContainerModule as c}from"inversify";import{ExecuteDeviceActionUseCase as r}from"../../device-action/use-case/ExecuteDeviceActionUseCase";import{StubUseCase as s}from"../../../../src/di.stub";import{deviceActionTypes as e}from"./deviceActionTypes";const l=({stub:o=!1}={})=>new c(({bind:t,rebindSync:i})=>{t(e.ExecuteDeviceActionUseCase).to(r),o&&i(e.ExecuteDeviceActionUseCase).to(s)});export{l as deviceActionModuleFactory};
2
2
  //# sourceMappingURL=deviceActionModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/di/deviceActionModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { ExecuteDeviceActionUseCase } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { deviceActionTypes } from \"./deviceActionTypes\";\n\ntype DeviceActionModuleArgs = Partial<{\n readonly stub: boolean;\n}>;\n\nexport const deviceActionModuleFactory = ({\n stub = false,\n}: DeviceActionModuleArgs = {}) =>\n new ContainerModule(\n (\n bind,\n _unbind,\n _isBound,\n rebind,\n _unbindAsync,\n _onActivation,\n _onDeactivation,\n ) => {\n bind(deviceActionTypes.ExecuteDeviceActionUseCase).to(\n ExecuteDeviceActionUseCase,\n );\n if (stub) {\n rebind(deviceActionTypes.ExecuteDeviceActionUseCase).to(StubUseCase);\n }\n },\n );\n"],
5
- "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,8BAAAC,MAAkC,yDAC3C,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,qBAAAC,MAAyB,sBAM3B,MAAMC,EAA4B,CAAC,CACxC,KAAAC,EAAO,EACT,EAA4B,CAAC,IAC3B,IAAIL,EACF,CACEM,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,IACG,CACHN,EAAKH,EAAkB,0BAA0B,EAAE,GACjDF,CACF,EACII,GACFI,EAAON,EAAkB,0BAA0B,EAAE,GAAGD,CAAW,CAEvE,CACF",
6
- "names": ["ContainerModule", "ExecuteDeviceActionUseCase", "StubUseCase", "deviceActionTypes", "deviceActionModuleFactory", "stub", "bind", "_unbind", "_isBound", "rebind", "_unbindAsync", "_onActivation", "_onDeactivation"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { ExecuteDeviceActionUseCase } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { deviceActionTypes } from \"./deviceActionTypes\";\n\ntype DeviceActionModuleArgs = Partial<{\n readonly stub: boolean;\n}>;\n\nexport const deviceActionModuleFactory = ({\n stub = false,\n}: DeviceActionModuleArgs = {}) =>\n new ContainerModule(({ bind, rebindSync }) => {\n bind(deviceActionTypes.ExecuteDeviceActionUseCase).to(\n ExecuteDeviceActionUseCase,\n );\n if (stub) {\n rebindSync(deviceActionTypes.ExecuteDeviceActionUseCase).to(StubUseCase);\n }\n });\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,8BAAAC,MAAkC,yDAC3C,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,qBAAAC,MAAyB,sBAM3B,MAAMC,EAA4B,CAAC,CACxC,KAAAC,EAAO,EACT,EAA4B,CAAC,IAC3B,IAAIL,EAAgB,CAAC,CAAE,KAAAM,EAAM,WAAAC,CAAW,IAAM,CAC5CD,EAAKH,EAAkB,0BAA0B,EAAE,GACjDF,CACF,EACII,GACFE,EAAWJ,EAAkB,0BAA0B,EAAE,GAAGD,CAAW,CAE3E,CAAC",
6
+ "names": ["ContainerModule", "ExecuteDeviceActionUseCase", "StubUseCase", "deviceActionTypes", "deviceActionModuleFactory", "stub", "bind", "rebindSync"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Container as c}from"inversify";import{ExecuteDeviceActionUseCase as r}from"../../device-action/use-case/ExecuteDeviceActionUseCase";import{deviceSessionModuleFactory as s}from"../../../internal/device-session/di/deviceSessionModule";import{loggerModuleFactory as u}from"../../../internal/logger-publisher/di/loggerModule";import{StubUseCase as d}from"../../../../src/di.stub";import{deviceActionModuleFactory as i}from"./deviceActionModule";import{deviceActionTypes as n}from"./deviceActionTypes";describe("deviceActionModule",()=>{describe("Default",()=>{let e,t;beforeEach(()=>{t=i(),e=new c,e.load(t,s(),u())}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return non-stubbed executeDeviceAction usecase",()=>{const o=e.get(n.ExecuteDeviceActionUseCase);expect(o).toBeInstanceOf(r)})}),describe("Stubbed",()=>{let e,t;beforeEach(()=>{t=i({stub:!0}),e=new c,e.load(t)}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return stubbed executeDeviceAction usecase",()=>{const o=e.get(n.ExecuteDeviceActionUseCase);expect(o).toBeInstanceOf(d)})})});
1
+ import{Container as c}from"inversify";import{ExecuteDeviceActionUseCase as r}from"../../device-action/use-case/ExecuteDeviceActionUseCase";import{deviceSessionModuleFactory as s}from"../../../internal/device-session/di/deviceSessionModule";import{loggerModuleFactory as u}from"../../../internal/logger-publisher/di/loggerModule";import{StubUseCase as d}from"../../../../src/di.stub";import{deviceActionModuleFactory as i}from"./deviceActionModule";import{deviceActionTypes as n}from"./deviceActionTypes";describe("deviceActionModule",()=>{describe("Default",()=>{let e,t;beforeEach(()=>{t=i(),e=new c,e.loadSync(t,s(),u())}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return non-stubbed executeDeviceAction usecase",()=>{const o=e.get(n.ExecuteDeviceActionUseCase);expect(o).toBeInstanceOf(r)})}),describe("Stubbed",()=>{let e,t;beforeEach(()=>{t=i({stub:!0}),e=new c,e.loadSync(t)}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return stubbed executeDeviceAction usecase",()=>{const o=e.get(n.ExecuteDeviceActionUseCase);expect(o).toBeInstanceOf(d)})})});
2
2
  //# sourceMappingURL=deviceActionModule.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/di/deviceActionModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { ExecuteDeviceActionUseCase } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { deviceActionModuleFactory } from \"./deviceActionModule\";\nimport { deviceActionTypes } from \"./deviceActionTypes\";\n\ndescribe(\"deviceActionModule\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof deviceActionModuleFactory>;\n beforeEach(() => {\n mod = deviceActionModuleFactory();\n container = new Container();\n container.load(mod, deviceSessionModuleFactory(), loggerModuleFactory());\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return non-stubbed executeDeviceAction usecase\", () => {\n const executeDeviceActionUseCase =\n container.get<ExecuteDeviceActionUseCase>(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n );\n expect(executeDeviceActionUseCase).toBeInstanceOf(\n ExecuteDeviceActionUseCase,\n );\n });\n });\n\n describe(\"Stubbed\", () => {\n let container: Container;\n let mod: ReturnType<typeof deviceActionModuleFactory>;\n beforeEach(() => {\n mod = deviceActionModuleFactory({ stub: true });\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return stubbed executeDeviceAction usecase\", () => {\n const executeDeviceActionUseCase = container.get(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n );\n expect(executeDeviceActionUseCase).toBeInstanceOf(StubUseCase);\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,aAAAA,MAAiB,YAE1B,OAAS,8BAAAC,MAAkC,yDAC3C,OAAS,8BAAAC,MAAkC,kDAC3C,OAAS,uBAAAC,MAA2B,6CACpC,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,6BAAAC,MAAiC,uBAC1C,OAAS,qBAAAC,MAAyB,sBAElC,SAAS,qBAAsB,IAAM,CACnC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,EAAMH,EAA0B,EAChCE,EAAY,IAAIP,EAChBO,EAAU,KAAKC,EAAKN,EAA2B,EAAGC,EAAoB,CAAC,CACzE,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOK,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,wDAAyD,IAAM,CAChE,MAAMC,EACJF,EAAU,IACRD,EAAkB,0BACpB,EACF,OAAOG,CAA0B,EAAE,eACjCR,CACF,CACF,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,IAAIM,EACAC,EACJ,WAAW,IAAM,CACfA,EAAMH,EAA0B,CAAE,KAAM,EAAK,CAAC,EAC9CE,EAAY,IAAIP,EAChBO,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,oDAAqD,IAAM,CAC5D,MAAMC,EAA6BF,EAAU,IAC3CD,EAAkB,0BACpB,EACA,OAAOG,CAA0B,EAAE,eAAeL,CAAW,CAC/D,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { ExecuteDeviceActionUseCase } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { deviceActionModuleFactory } from \"./deviceActionModule\";\nimport { deviceActionTypes } from \"./deviceActionTypes\";\n\ndescribe(\"deviceActionModule\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof deviceActionModuleFactory>;\n beforeEach(() => {\n mod = deviceActionModuleFactory();\n container = new Container();\n container.loadSync(\n mod,\n deviceSessionModuleFactory(),\n loggerModuleFactory(),\n );\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return non-stubbed executeDeviceAction usecase\", () => {\n const executeDeviceActionUseCase =\n container.get<ExecuteDeviceActionUseCase>(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n );\n expect(executeDeviceActionUseCase).toBeInstanceOf(\n ExecuteDeviceActionUseCase,\n );\n });\n });\n\n describe(\"Stubbed\", () => {\n let container: Container;\n let mod: ReturnType<typeof deviceActionModuleFactory>;\n beforeEach(() => {\n mod = deviceActionModuleFactory({ stub: true });\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return stubbed executeDeviceAction usecase\", () => {\n const executeDeviceActionUseCase = container.get(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n );\n expect(executeDeviceActionUseCase).toBeInstanceOf(StubUseCase);\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,aAAAA,MAAiB,YAE1B,OAAS,8BAAAC,MAAkC,yDAC3C,OAAS,8BAAAC,MAAkC,kDAC3C,OAAS,uBAAAC,MAA2B,6CACpC,OAAS,eAAAC,MAAmB,oBAE5B,OAAS,6BAAAC,MAAiC,uBAC1C,OAAS,qBAAAC,MAAyB,sBAElC,SAAS,qBAAsB,IAAM,CACnC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,EAAMH,EAA0B,EAChCE,EAAY,IAAIP,EAChBO,EAAU,SACRC,EACAN,EAA2B,EAC3BC,EAAoB,CACtB,CACF,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOK,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,wDAAyD,IAAM,CAChE,MAAMC,EACJF,EAAU,IACRD,EAAkB,0BACpB,EACF,OAAOG,CAA0B,EAAE,eACjCR,CACF,CACF,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,IAAIM,EACAC,EACJ,WAAW,IAAM,CACfA,EAAMH,EAA0B,CAAE,KAAM,EAAK,CAAC,EAC9CE,EAAY,IAAIP,EAChBO,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,oDAAqD,IAAM,CAC5D,MAAMC,EAA6BF,EAAU,IAC3CD,EAAkB,0BACpB,EACA,OAAOG,CAA0B,EAAE,eAAeL,CAAW,CAC/D,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["Container", "ExecuteDeviceActionUseCase", "deviceSessionModuleFactory", "loggerModuleFactory", "StubUseCase", "deviceActionModuleFactory", "deviceActionTypes", "container", "mod", "executeDeviceActionUseCase"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{gte as d}from"semver";import{UnknownDAError as p}from"../../device-action/os/Errors";import{DeviceSessionStateType as f}from"../../device-session/DeviceSessionState";class y{constructor(e,n){this.api=e;this.args=n;const a=e.getDeviceModel();this.deviceModelId=a.id}deviceModelId;run(){const e=this.api.getDeviceSessionState();if(e.sessionStateType===f.Connected)return{error:new p("Invalid device state")};if(e.catalog===void 0)return{error:new p("Device apps metadata not fetched")};let n=[],a=[],t=[];for(const i of this.args.applications){const o=e.catalog.applications.find(s=>s.versionName===i.name),l=e.installedApps.find(s=>s.versionName===i.name);if(l!==void 0&&this.validateConstraint(l,o,i.constraints)){a=[...a,i.name];continue}if(o!==void 0)n=[...n,o];else if(this.args.allowMissingApplication)t=[...t,i.name];else return{error:new p(`Application ${i.name} not found in the catalog`)}}return n=[...n.reduce((i,o)=>{const l=o.parentName;if(l){const s=e.catalog.applications.find(r=>r.versionName===l),c=e.installedApps.find(r=>r.versionName===l);if(s&&!c)return[...i,s]}return i},[]),...n],{installPlan:n.filter((i,o)=>n.findIndex(l=>l.versionName===i.versionName)===o),missingApplications:t,alreadyInstalled:a}}validateConstraint(e,n,a){if(a===void 0)return!0;for(const t of a)if(!(t.exemptModels!==void 0&&t.exemptModels.includes(this.deviceModelId))&&!(t.applicableModels!==void 0&&!t.applicableModels.includes(this.deviceModelId)))return t.minVersion==="latest"?!n||d(e.version,n.version):d(e.version,t.minVersion);return!0}}export{y as BuildAppsInstallPlanTask};
1
+ import{gte as d}from"semver";import{UnknownDAError as p,UnsupportedFirmwareDAError as f}from"../../device-action/os/Errors";import{DeviceSessionStateType as u}from"../../device-session/DeviceSessionState";class M{constructor(n,i){this.api=n;this.args=i;const o=n.getDeviceModel();this.deviceModelId=o.id}deviceModelId;run(){const n=this.api.getDeviceSessionState();if(n.sessionStateType===u.Connected)return{error:new p("Invalid device state")};if(n.catalog===void 0)return{error:new p("Device apps metadata not fetched")};let i=[],o=[],t=[];for(const e of this.args.applications){const a=n.catalog.applications.find(l=>l.versionName===e.name),r=n.installedApps.find(l=>l.versionName===e.name);if(r!==void 0&&this.validateConstraint(r,a,e.constraints)){o=[...o,e.name];continue}if(a!==void 0&&this.validateConstraint(a,void 0,e.constraints))i=[...i,a];else if(this.args.allowMissingApplication)t=[...t,e.name];else return a!==void 0?{error:new f(`Application ${e.name} not found in the catalog`)}:{error:new p(`Application ${e.name} not found in the catalog`)}}return i=[...i.reduce((e,a)=>{const r=a.parentName;if(r){const l=n.catalog.applications.find(s=>s.versionName===r),c=n.installedApps.find(s=>s.versionName===r);if(l&&!c)return[...e,l]}return e},[]),...i],{installPlan:i.filter((e,a)=>i.findIndex(r=>r.versionName===e.versionName)===a),missingApplications:t,alreadyInstalled:o}}validateConstraint(n,i,o){if(o===void 0)return!0;for(const t of o)if(!(t.exemptModels!==void 0&&t.exemptModels.includes(this.deviceModelId))&&!(t.applicableModels!==void 0&&!t.applicableModels.includes(this.deviceModelId)))return t.minVersion==="latest"?!i||d(n.version,i.version):d(n.version,t.minVersion);return!0}}export{M as BuildAppsInstallPlanTask};
2
2
  //# sourceMappingURL=BuildAppsInstallPlanTask.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/task/BuildAppsInstallPlanTask.ts"],
4
- "sourcesContent": ["import { gte } from \"semver\";\n\nimport type { DeviceModelId } from \"@api/device/DeviceModel\";\nimport type { InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport type {\n ApplicationConstraint,\n ApplicationDependency,\n} from \"@api/device-action/os/InstallOrUpdateApps/types\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport type { Application } from \"@internal/manager-api/model/Application\";\n\nexport type BuildAppsInstallPlanTaskArgs = {\n /**\n * List of applications to install or update\n */\n readonly applications: ApplicationDependency[];\n\n /**\n * Indicates if the device action should fail if an application is missing from the app store.\n */\n readonly allowMissingApplication: boolean;\n};\n\nexport type BuildAppsInstallPlanTaskResult =\n | {\n installPlan: Application[];\n alreadyInstalled: string[];\n missingApplications: string[];\n }\n | {\n error: UnknownDAError;\n };\n\nexport class BuildAppsInstallPlanTask {\n private readonly deviceModelId: DeviceModelId;\n\n constructor(\n private readonly api: InternalApi,\n private readonly args: BuildAppsInstallPlanTaskArgs,\n ) {\n const deviceModel = api.getDeviceModel();\n this.deviceModelId = deviceModel.id;\n }\n\n run(): BuildAppsInstallPlanTaskResult {\n // Get device session state.\n const deviceState = this.api.getDeviceSessionState();\n if (deviceState.sessionStateType === DeviceSessionStateType.Connected) {\n return { error: new UnknownDAError(\"Invalid device state\") };\n }\n\n // Ensure the device metadata were correctly fetched.\n if (deviceState.catalog === undefined) {\n return { error: new UnknownDAError(\"Device apps metadata not fetched\") };\n }\n\n // Build the install plan\n let installPlan: Application[] = [];\n let alreadyInstalled: string[] = [];\n let missingApplications: string[] = [];\n for (const app of this.args.applications) {\n // Get app entry from catalog and from installed apps\n const catalogApp = deviceState.catalog.applications.find(\n (a) => a.versionName === app.name,\n );\n const installedApp = deviceState.installedApps.find(\n (a) => a.versionName === app.name,\n );\n\n // If app is already installed, with validated constraints, continue the iteration\n if (\n installedApp !== undefined &&\n this.validateConstraint(installedApp, catalogApp, app.constraints)\n ) {\n alreadyInstalled = [...alreadyInstalled, app.name];\n continue;\n }\n\n // Handle the catalog application\n if (catalogApp !== undefined) {\n // Add the catalog application to the install plan\n installPlan = [...installPlan, catalogApp];\n } else if (this.args.allowMissingApplication) {\n missingApplications = [...missingApplications, app.name];\n } else {\n // Fail immediately if missing application is not allowed\n return {\n error: new UnknownDAError(\n `Application ${app.name} not found in the catalog`,\n ),\n };\n }\n }\n\n // Find installPlan dependencies\n const dependencies = installPlan.reduce((apps, app) => {\n const dependency = app.parentName;\n if (dependency) {\n const catalogApp = deviceState.catalog!.applications.find(\n (a) => a.versionName === dependency,\n );\n const installedApp = deviceState.installedApps.find(\n (a) => a.versionName === dependency,\n );\n if (catalogApp && !installedApp) {\n return [...apps, catalogApp];\n }\n }\n return apps;\n }, [] as Application[]);\n\n // Reorder and deduplicate the install plan with its dependencies first\n installPlan = [...dependencies, ...installPlan];\n const reorderedInstallPlan = installPlan.filter(\n (app, index) =>\n installPlan.findIndex((a) => a.versionName === app.versionName) ===\n index,\n );\n\n return {\n installPlan: reorderedInstallPlan,\n missingApplications,\n alreadyInstalled,\n };\n }\n\n private validateConstraint(\n app: Application,\n catalogApp?: Application,\n constraints?: ApplicationConstraint[],\n ): boolean {\n if (constraints === undefined) {\n // No constraint\n return true;\n }\n\n // Validate the constraint\n for (const constraint of constraints) {\n // Is current device exempt from the constraint?\n if (\n constraint.exemptModels !== undefined &&\n constraint.exemptModels.includes(this.deviceModelId)\n ) {\n continue;\n }\n\n // Is current device not applicable for the constraint?\n if (\n constraint.applicableModels !== undefined &&\n !constraint.applicableModels.includes(this.deviceModelId)\n ) {\n continue;\n }\n\n // Validate the min version\n if (constraint.minVersion === \"latest\") {\n return !catalogApp || gte(app.version, catalogApp.version);\n } else {\n return gte(app.version, constraint.minVersion);\n }\n }\n\n // No constraint for the device\n return true;\n }\n}\n"],
5
- "mappings": "AAAA,OAAS,OAAAA,MAAW,SAIpB,OAAS,kBAAAC,MAAsB,+BAK/B,OAAS,0BAAAC,MAA8B,yCAyBhC,MAAMC,CAAyB,CAGpC,YACmBC,EACAC,EACjB,CAFiB,SAAAD,EACA,UAAAC,EAEjB,MAAMC,EAAcF,EAAI,eAAe,EACvC,KAAK,cAAgBE,EAAY,EACnC,CARiB,cAUjB,KAAsC,CAEpC,MAAMC,EAAc,KAAK,IAAI,sBAAsB,EACnD,GAAIA,EAAY,mBAAqBL,EAAuB,UAC1D,MAAO,CAAE,MAAO,IAAID,EAAe,sBAAsB,CAAE,EAI7D,GAAIM,EAAY,UAAY,OAC1B,MAAO,CAAE,MAAO,IAAIN,EAAe,kCAAkC,CAAE,EAIzE,IAAIO,EAA6B,CAAC,EAC9BC,EAA6B,CAAC,EAC9BC,EAAgC,CAAC,EACrC,UAAWC,KAAO,KAAK,KAAK,aAAc,CAExC,MAAMC,EAAaL,EAAY,QAAQ,aAAa,KACjDM,GAAMA,EAAE,cAAgBF,EAAI,IAC/B,EACMG,EAAeP,EAAY,cAAc,KAC5CM,GAAMA,EAAE,cAAgBF,EAAI,IAC/B,EAGA,GACEG,IAAiB,QACjB,KAAK,mBAAmBA,EAAcF,EAAYD,EAAI,WAAW,EACjE,CACAF,EAAmB,CAAC,GAAGA,EAAkBE,EAAI,IAAI,EACjD,QACF,CAGA,GAAIC,IAAe,OAEjBJ,EAAc,CAAC,GAAGA,EAAaI,CAAU,UAChC,KAAK,KAAK,wBACnBF,EAAsB,CAAC,GAAGA,EAAqBC,EAAI,IAAI,MAGvD,OAAO,CACL,MAAO,IAAIV,EACT,eAAeU,EAAI,IAAI,2BACzB,CACF,CAEJ,CAoBA,OAAAH,EAAc,CAAC,GAjBMA,EAAY,OAAO,CAACO,EAAMJ,IAAQ,CACrD,MAAMK,EAAaL,EAAI,WACvB,GAAIK,EAAY,CACd,MAAMJ,EAAaL,EAAY,QAAS,aAAa,KAClDM,GAAMA,EAAE,cAAgBG,CAC3B,EACMF,EAAeP,EAAY,cAAc,KAC5CM,GAAMA,EAAE,cAAgBG,CAC3B,EACA,GAAIJ,GAAc,CAACE,EACjB,MAAO,CAAC,GAAGC,EAAMH,CAAU,CAE/B,CACA,OAAOG,CACT,EAAG,CAAC,CAAkB,EAGU,GAAGP,CAAW,EAOvC,CACL,YAP2BA,EAAY,OACvC,CAACG,EAAKM,IACJT,EAAY,UAAWK,GAAMA,EAAE,cAAgBF,EAAI,WAAW,IAC9DM,CACJ,EAIE,oBAAAP,EACA,iBAAAD,CACF,CACF,CAEQ,mBACNE,EACAC,EACAM,EACS,CACT,GAAIA,IAAgB,OAElB,MAAO,GAIT,UAAWC,KAAcD,EAEvB,GACE,EAAAC,EAAW,eAAiB,QAC5BA,EAAW,aAAa,SAAS,KAAK,aAAa,IAOnD,EAAAA,EAAW,mBAAqB,QAChC,CAACA,EAAW,iBAAiB,SAAS,KAAK,aAAa,GAM1D,OAAIA,EAAW,aAAe,SACrB,CAACP,GAAcZ,EAAIW,EAAI,QAASC,EAAW,OAAO,EAElDZ,EAAIW,EAAI,QAASQ,EAAW,UAAU,EAKjD,MAAO,EACT,CACF",
6
- "names": ["gte", "UnknownDAError", "DeviceSessionStateType", "BuildAppsInstallPlanTask", "api", "args", "deviceModel", "deviceState", "installPlan", "alreadyInstalled", "missingApplications", "app", "catalogApp", "a", "installedApp", "apps", "dependency", "index", "constraints", "constraint"]
4
+ "sourcesContent": ["import { gte } from \"semver\";\n\nimport type { DeviceModelId } from \"@api/device/DeviceModel\";\nimport type { InternalApi } from \"@api/device-action/DeviceAction\";\nimport {\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nimport type {\n ApplicationConstraint,\n ApplicationDependency,\n} from \"@api/device-action/os/InstallOrUpdateApps/types\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport type { Application } from \"@internal/manager-api/model/Application\";\n\nexport type BuildAppsInstallPlanTaskArgs = {\n /**\n * List of applications to install or update\n */\n readonly applications: ApplicationDependency[];\n\n /**\n * Indicates if the device action should fail if an application is missing from the app store.\n */\n readonly allowMissingApplication: boolean;\n};\n\nexport type BuildAppsInstallPlanTaskResult =\n | {\n installPlan: Application[];\n alreadyInstalled: string[];\n missingApplications: string[];\n }\n | {\n error: UnknownDAError | UnsupportedFirmwareDAError;\n };\n\nexport class BuildAppsInstallPlanTask {\n private readonly deviceModelId: DeviceModelId;\n\n constructor(\n private readonly api: InternalApi,\n private readonly args: BuildAppsInstallPlanTaskArgs,\n ) {\n const deviceModel = api.getDeviceModel();\n this.deviceModelId = deviceModel.id;\n }\n\n run(): BuildAppsInstallPlanTaskResult {\n // Get device session state.\n const deviceState = this.api.getDeviceSessionState();\n if (deviceState.sessionStateType === DeviceSessionStateType.Connected) {\n return { error: new UnknownDAError(\"Invalid device state\") };\n }\n\n // Ensure the device metadata were correctly fetched.\n if (deviceState.catalog === undefined) {\n return { error: new UnknownDAError(\"Device apps metadata not fetched\") };\n }\n\n // Build the install plan\n let installPlan: Application[] = [];\n let alreadyInstalled: string[] = [];\n let missingApplications: string[] = [];\n for (const app of this.args.applications) {\n // Get app entry from catalog and from installed apps\n const catalogApp = deviceState.catalog.applications.find(\n (a) => a.versionName === app.name,\n );\n const installedApp = deviceState.installedApps.find(\n (a) => a.versionName === app.name,\n );\n\n // If app is already installed, with validated constraints, continue the iteration\n if (\n installedApp !== undefined &&\n this.validateConstraint(installedApp, catalogApp, app.constraints)\n ) {\n alreadyInstalled = [...alreadyInstalled, app.name];\n continue;\n }\n\n // Handle the catalog application\n if (\n catalogApp !== undefined &&\n this.validateConstraint(catalogApp, undefined, app.constraints)\n ) {\n // Add the catalog application to the install plan\n installPlan = [...installPlan, catalogApp];\n } else if (this.args.allowMissingApplication) {\n missingApplications = [...missingApplications, app.name];\n } else {\n // Fail immediately if missing application is not allowed\n if (catalogApp !== undefined) {\n // Is application is found in the catalog in an old version,\n // it usually means the firmware is also outdated.\n return {\n error: new UnsupportedFirmwareDAError(\n `Application ${app.name} not found in the catalog`,\n ),\n };\n } else {\n return {\n error: new UnknownDAError(\n `Application ${app.name} not found in the catalog`,\n ),\n };\n }\n }\n }\n\n // Find installPlan dependencies\n const dependencies = installPlan.reduce((apps, app) => {\n const dependency = app.parentName;\n if (dependency) {\n const catalogApp = deviceState.catalog!.applications.find(\n (a) => a.versionName === dependency,\n );\n const installedApp = deviceState.installedApps.find(\n (a) => a.versionName === dependency,\n );\n if (catalogApp && !installedApp) {\n return [...apps, catalogApp];\n }\n }\n return apps;\n }, [] as Application[]);\n\n // Reorder and deduplicate the install plan with its dependencies first\n installPlan = [...dependencies, ...installPlan];\n const reorderedInstallPlan = installPlan.filter(\n (app, index) =>\n installPlan.findIndex((a) => a.versionName === app.versionName) ===\n index,\n );\n\n return {\n installPlan: reorderedInstallPlan,\n missingApplications,\n alreadyInstalled,\n };\n }\n\n private validateConstraint(\n app: Application,\n catalogApp?: Application,\n constraints?: ApplicationConstraint[],\n ): boolean {\n if (constraints === undefined) {\n // No constraint\n return true;\n }\n\n // Validate the constraint\n for (const constraint of constraints) {\n // Is current device exempt from the constraint?\n if (\n constraint.exemptModels !== undefined &&\n constraint.exemptModels.includes(this.deviceModelId)\n ) {\n continue;\n }\n\n // Is current device not applicable for the constraint?\n if (\n constraint.applicableModels !== undefined &&\n !constraint.applicableModels.includes(this.deviceModelId)\n ) {\n continue;\n }\n\n // Validate the min version\n if (constraint.minVersion === \"latest\") {\n return !catalogApp || gte(app.version, catalogApp.version);\n } else {\n return gte(app.version, constraint.minVersion);\n }\n }\n\n // No constraint for the device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,GAjBMA,EAAY,OAAO,CAACO,EAAMJ,IAAQ,CACrD,MAAMK,EAAaL,EAAI,WACvB,GAAIK,EAAY,CACd,MAAMJ,EAAaL,EAAY,QAAS,aAAa,KAClDM,GAAMA,EAAE,cAAgBG,CAC3B,EACMF,EAAeP,EAAY,cAAc,KAC5CM,GAAMA,EAAE,cAAgBG,CAC3B,EACA,GAAIJ,GAAc,CAACE,EACjB,MAAO,CAAC,GAAGC,EAAMH,CAAU,CAE/B,CACA,OAAOG,CACT,EAAG,CAAC,CAAkB,EAGU,GAAGP,CAAW,EAOvC,CACL,YAP2BA,EAAY,OACvC,CAACG,EAAKM,IACJT,EAAY,UAAWK,GAAMA,EAAE,cAAgBF,EAAI,WAAW,IAC9DM,CACJ,EAIE,oBAAAP,EACA,iBAAAD,CACF,CACF,CAEQ,mBACNE,EACAC,EACAM,EACS,CACT,GAAIA,IAAgB,OAElB,MAAO,GAIT,UAAWC,KAAcD,EAEvB,GACE,EAAAC,EAAW,eAAiB,QAC5BA,EAAW,aAAa,SAAS,KAAK,aAAa,IAOnD,EAAAA,EAAW,mBAAqB,QAChC,CAACA,EAAW,iBAAiB,SAAS,KAAK,aAAa,GAM1D,OAAIA,EAAW,aAAe,SACrB,CAACP,GAAcb,EAAIY,EAAI,QAASC,EAAW,OAAO,EAElDb,EAAIY,EAAI,QAASQ,EAAW,UAAU,EAKjD,MAAO,EACT,CACF",
6
+ "names": ["gte", "UnknownDAError", "UnsupportedFirmwareDAError", "DeviceSessionStateType", "BuildAppsInstallPlanTask", "api", "args", "deviceModel", "deviceState", "installPlan", "alreadyInstalled", "missingApplications", "app", "catalogApp", "a", "installedApp", "apps", "dependency", "index", "constraints", "constraint"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{DeviceModelId as o}from"../../device/DeviceModel";import{DeviceStatus as a}from"../../device/DeviceStatus";import{makeDeviceActionInternalApiMock as r}from"../../device-action/__test-utils__/makeInternalApi";import{UnknownDAError as t}from"../../device-action/os/Errors";import{DeviceSessionStateType as i}from"../../device-session/DeviceSessionState";import{BuildAppsInstallPlanTask as s}from"./BuildAppsInstallPlanTask";describe("BuildAppsInstallPlanTask",()=>{const e=r();beforeEach(()=>{vi.clearAllMocks(),e.getDeviceModel.mockReturnValue({id:o.NANO_X})}),it("Success with no changes needed",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"}],catalog:{applications:[],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum"},{name:"Bitcoin"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[],alreadyInstalled:["Ethereum","Bitcoin"],missingApplications:[]})}),it("Success with no constraints",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"MyShitCoin",version:"0.0.1"},{versionName:"Cardano",version:"1.1.0"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum"},{name:"Solana"},{name:"Cardano"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Solana",version:"1.2.0"},{versionName:"Cardano",version:"1.1.0"}],alreadyInstalled:["Ethereum"],missingApplications:[]})}),it("Success with applicable constraints",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.2.0"},{versionName:"Solana",version:"1.1.0"},{versionName:"Cardano",version:"1.1.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"MyShitCoin",version:"0.0.1"},{versionName:"Cardano",version:"1.2.0"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"1.6.0",applicableModels:[o.NANO_X]}]},{name:"Bitcoin",constraints:[{minVersion:"1.2.1",exemptModels:[o.NANO_S]}]},{name:"Solana",constraints:[{minVersion:"1.2.0"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"}],alreadyInstalled:[],missingApplications:[]})}),it("Success with non-applicable constraints",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.2.0"},{versionName:"Solana",version:"1.1.0"},{versionName:"Cardano",version:"1.1.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"MyShitCoin",version:"0.0.1"},{versionName:"Cardano",version:"1.2.0"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"1.6.0",exemptModels:[o.NANO_X]}]},{name:"Bitcoin",constraints:[{minVersion:"1.2.1",applicableModels:[o.NANO_S]}]},{name:"Cardano",constraints:[{minVersion:"1.1.0"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[],alreadyInstalled:["Ethereum","Bitcoin","Cardano"],missingApplications:[]})}),it("Success with applicable constraints latest version",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.1.0"},{versionName:"MyShitCoin",version:"0.0.1"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"Cardano",version:"1.2.0"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"latest"}]},{name:"Bitcoin",constraints:[{minVersion:"latest"}]},{name:"MyShitCoin",constraints:[{minVersion:"latest"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Ethereum",version:"1.6.0"}],alreadyInstalled:["Bitcoin","MyShitCoin"],missingApplications:[]})}),it("Success with dependencies",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"AlreadyInstalledDep",version:"1.2.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0",parentName:void 0},{versionName:"Solana",version:"1.2.0",parentName:void 0},{versionName:"MyEthShitCoin",version:"0.0.1",parentName:"Ethereum"},{versionName:"MySolShitCoin",version:"0.0.1",parentName:"Solana"},{versionName:"MyPumpFunShitCoin",version:"0.0.1",parentName:"Solana"},{versionName:"Cardano",version:"1.2.0",parentName:void 0},{versionName:"AlreadyInstalledDep",version:"1.2.0",parentName:"Cardano"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"MyEthShitCoin"},{name:"MySolShitCoin"},{name:"Solana"},{name:"MyPumpFunShitCoin"},{name:"AlreadyInstalledDep"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Ethereum",version:"1.6.0",parentName:void 0},{versionName:"Solana",version:"1.2.0",parentName:void 0},{versionName:"MyEthShitCoin",version:"0.0.1",parentName:"Ethereum"},{versionName:"MySolShitCoin",version:"0.0.1",parentName:"Solana"},{versionName:"MyPumpFunShitCoin",version:"0.0.1",parentName:"Solana"}],alreadyInstalled:["AlreadyInstalledDep"],missingApplications:[]})}),it("Success with allowed missing applications",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum"},{name:"Solana"},{name:"Cardano"}],allowMissingApplication:!0}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Solana",version:"1.2.0"}],alreadyInstalled:["Ethereum"],missingApplications:["Cardano"]})}),it("Error when device is in incorrect state",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.Connected,deviceStatus:a.CONNECTED});const n=new s(e,{applications:[{name:"Ethereum"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new t("Invalid device state")})}),it("Error when device session was not populated",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[]});const n=new s(e,{applications:[{name:"Ethereum"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new t("Device apps metadata not fetched")})}),it("Error when an app is not found in the catalog",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[],catalog:{applications:[],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum"},{name:"Bitcoin"},{name:"Solana"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new t("Application Ethereum not found in the catalog")})})});
1
+ import{DeviceModelId as t}from"../../device/DeviceModel";import{DeviceStatus as a}from"../../device/DeviceStatus";import{makeDeviceActionInternalApiMock as r}from"../../device-action/__test-utils__/makeInternalApi";import{UnknownDAError as o,UnsupportedFirmwareDAError as l}from"../../device-action/os/Errors";import{DeviceSessionStateType as i}from"../../device-session/DeviceSessionState";import{BuildAppsInstallPlanTask as s}from"./BuildAppsInstallPlanTask";describe("BuildAppsInstallPlanTask",()=>{const e=r();beforeEach(()=>{vi.clearAllMocks(),e.getDeviceModel.mockReturnValue({id:t.NANO_X})}),it("Success with no changes needed",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"}],catalog:{applications:[],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum"},{name:"Bitcoin"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[],alreadyInstalled:["Ethereum","Bitcoin"],missingApplications:[]})}),it("Success with no constraints",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"MyShitCoin",version:"0.0.1"},{versionName:"Cardano",version:"1.1.0"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum"},{name:"Solana"},{name:"Cardano"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Solana",version:"1.2.0"},{versionName:"Cardano",version:"1.1.0"}],alreadyInstalled:["Ethereum"],missingApplications:[]})}),it("Success with applicable constraints",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.2.0"},{versionName:"Solana",version:"1.1.0"},{versionName:"Cardano",version:"1.1.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"MyShitCoin",version:"0.0.1"},{versionName:"Cardano",version:"1.2.0"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"1.6.0",applicableModels:[t.NANO_X]}]},{name:"Bitcoin",constraints:[{minVersion:"1.2.1",exemptModels:[t.NANO_S]}]},{name:"Solana",constraints:[{minVersion:"1.2.0"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"}],alreadyInstalled:[],missingApplications:[]})}),it("Success with non-applicable constraints",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.2.0"},{versionName:"Solana",version:"1.1.0"},{versionName:"Cardano",version:"1.1.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"MyShitCoin",version:"0.0.1"},{versionName:"Cardano",version:"1.2.0"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"1.6.0",exemptModels:[t.NANO_X]}]},{name:"Bitcoin",constraints:[{minVersion:"1.2.1",applicableModels:[t.NANO_S]}]},{name:"Cardano",constraints:[{minVersion:"1.1.0"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[],alreadyInstalled:["Ethereum","Bitcoin","Cardano"],missingApplications:[]})}),it("Success with applicable constraints latest version",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.1.0"},{versionName:"MyShitCoin",version:"0.0.1"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"},{versionName:"Cardano",version:"1.2.0"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"latest"}]},{name:"Bitcoin",constraints:[{minVersion:"latest"}]},{name:"MyShitCoin",constraints:[{minVersion:"latest"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Ethereum",version:"1.6.0"}],alreadyInstalled:["Bitcoin","MyShitCoin"],missingApplications:[]})}),it("Success with dependencies",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"AlreadyInstalledDep",version:"1.2.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0",parentName:void 0},{versionName:"Solana",version:"1.2.0",parentName:void 0},{versionName:"MyEthShitCoin",version:"0.0.1",parentName:"Ethereum"},{versionName:"MySolShitCoin",version:"0.0.1",parentName:"Solana"},{versionName:"MyPumpFunShitCoin",version:"0.0.1",parentName:"Solana"},{versionName:"Cardano",version:"1.2.0",parentName:void 0},{versionName:"AlreadyInstalledDep",version:"1.2.0",parentName:"Cardano"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"MyEthShitCoin"},{name:"MySolShitCoin"},{name:"Solana"},{name:"MyPumpFunShitCoin"},{name:"AlreadyInstalledDep"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Ethereum",version:"1.6.0",parentName:void 0},{versionName:"Solana",version:"1.2.0",parentName:void 0},{versionName:"MyEthShitCoin",version:"0.0.1",parentName:"Ethereum"},{versionName:"MySolShitCoin",version:"0.0.1",parentName:"Solana"},{versionName:"MyPumpFunShitCoin",version:"0.0.1",parentName:"Solana"}],alreadyInstalled:["AlreadyInstalledDep"],missingApplications:[]})}),it("Success with allowed missing applications",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[{versionName:"Ethereum",version:"1.5.0"},{versionName:"Bitcoin",version:"1.3.0"}],catalog:{applications:[{versionName:"Ethereum",version:"1.6.0"},{versionName:"Bitcoin",version:"1.3.0"},{versionName:"Solana",version:"1.2.0"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum"},{name:"Solana"},{name:"Cardano"}],allowMissingApplication:!0}).run();expect(n).toStrictEqual({installPlan:[{versionName:"Solana",version:"1.2.0"}],alreadyInstalled:["Ethereum"],missingApplications:["Cardano"]})}),it("Error when device is in incorrect state",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.Connected,deviceStatus:a.CONNECTED});const n=new s(e,{applications:[{name:"Ethereum"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new o("Invalid device state")})}),it("Error when device session was not populated",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[]});const n=new s(e,{applications:[{name:"Ethereum"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new o("Device apps metadata not fetched")})}),it("Error when an app is not found in the catalog",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[],catalog:{applications:[],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum"},{name:"Bitcoin"},{name:"Solana"}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new o("Application Ethereum not found in the catalog")})}),it("Error when an app version is not found in the catalog",()=>{e.getDeviceSessionState.mockReturnValueOnce({sessionStateType:i.ReadyWithoutSecureChannel,deviceStatus:a.CONNECTED,installedApps:[],catalog:{applications:[{versionName:"Ethereum",version:"1.5.0"}],languagePackages:[]}});const n=new s(e,{applications:[{name:"Ethereum",constraints:[{minVersion:"1.6.0"}]}],allowMissingApplication:!1}).run();expect(n).toStrictEqual({error:new l("Application Ethereum not found in the catalog")})})});
2
2
  //# sourceMappingURL=BuildAppsInstallPlanTask.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/task/BuildAppsInstallPlanTask.test.ts"],
4
- "sourcesContent": ["import { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport type { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nimport type { DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport type { Application } from \"@internal/manager-api/model/Application\";\n\nimport { BuildAppsInstallPlanTask } from \"./BuildAppsInstallPlanTask\";\n\ndescribe(\"BuildAppsInstallPlanTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n vi.clearAllMocks();\n apiMock.getDeviceModel.mockReturnValue({\n id: DeviceModelId.NANO_X,\n } as unknown as TransportDeviceModel);\n });\n\n it(\"Success with no changes needed\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }, { name: \"Bitcoin\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [],\n alreadyInstalled: [\"Ethereum\", \"Bitcoin\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with no constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Solana\" },\n { name: \"Cardano\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ],\n alreadyInstalled: [\"Ethereum\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with applicable constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.2.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [\n { minVersion: \"1.6.0\", applicableModels: [DeviceModelId.NANO_X] },\n ],\n },\n {\n name: \"Bitcoin\",\n constraints: [\n { minVersion: \"1.2.1\", exemptModels: [DeviceModelId.NANO_S] },\n ],\n },\n { name: \"Solana\", constraints: [{ minVersion: \"1.2.0\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n ],\n alreadyInstalled: [],\n missingApplications: [],\n });\n });\n\n it(\"Success with non-applicable constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.2.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [\n { minVersion: \"1.6.0\", exemptModels: [DeviceModelId.NANO_X] },\n ],\n },\n {\n name: \"Bitcoin\",\n constraints: [\n { minVersion: \"1.2.1\", applicableModels: [DeviceModelId.NANO_S] },\n ],\n },\n { name: \"Cardano\", constraints: [{ minVersion: \"1.1.0\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [],\n alreadyInstalled: [\"Ethereum\", \"Bitcoin\", \"Cardano\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with applicable constraints latest version\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\", constraints: [{ minVersion: \"latest\" }] },\n { name: \"Bitcoin\", constraints: [{ minVersion: \"latest\" }] },\n { name: \"MyShitCoin\", constraints: [{ minVersion: \"latest\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [{ versionName: \"Ethereum\", version: \"1.6.0\" }],\n alreadyInstalled: [\"Bitcoin\", \"MyShitCoin\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with dependencies\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"AlreadyInstalledDep\", version: \"1.2.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\", parentName: undefined },\n { versionName: \"Solana\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"MyEthShitCoin\",\n version: \"0.0.1\",\n parentName: \"Ethereum\",\n },\n {\n versionName: \"MySolShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n {\n versionName: \"MyPumpFunShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n { versionName: \"Cardano\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"AlreadyInstalledDep\",\n version: \"1.2.0\",\n parentName: \"Cardano\",\n },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"MyEthShitCoin\" },\n { name: \"MySolShitCoin\" },\n { name: \"Solana\" },\n { name: \"MyPumpFunShitCoin\" },\n { name: \"AlreadyInstalledDep\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Ethereum\", version: \"1.6.0\", parentName: undefined },\n { versionName: \"Solana\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"MyEthShitCoin\",\n version: \"0.0.1\",\n parentName: \"Ethereum\",\n },\n {\n versionName: \"MySolShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n {\n versionName: \"MyPumpFunShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n ],\n alreadyInstalled: [\"AlreadyInstalledDep\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with allowed missing applications\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Solana\" },\n { name: \"Cardano\" },\n ],\n allowMissingApplication: true,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [{ versionName: \"Solana\", version: \"1.2.0\" }],\n alreadyInstalled: [\"Ethereum\"],\n missingApplications: [\"Cardano\"],\n });\n });\n\n it(\"Error when device is in incorrect state\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n } as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Invalid device state\"),\n });\n });\n\n it(\"Error when device session was not populated\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Device apps metadata not fetched\"),\n });\n });\n\n it(\"Error when an app is not found in the catalog\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [] as unknown as Application[],\n catalog: {\n applications: [] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Bitcoin\" },\n { name: \"Solana\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\n \"Application Ethereum not found in the catalog\",\n ),\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,iBAAAA,MAAqB,0BAC9B,OAAS,gBAAAC,MAAoB,2BAC7B,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,kBAAAC,MAAsB,+BAG/B,OAAS,0BAAAC,MAA8B,yCAGvC,OAAS,4BAAAC,MAAgC,6BAEzC,SAAS,2BAA4B,IAAM,CACzC,MAAMC,EAAUJ,EAAgC,EAEhD,WAAW,IAAM,CACf,GAAG,cAAc,EACjBI,EAAQ,eAAe,gBAAgB,CACrC,GAAIN,EAAc,MACpB,CAAoC,CACtC,CAAC,EAED,GAAG,iCAAkC,IAAM,CAEzCM,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkBF,EAAuB,0BACzC,aAAcH,EAAa,UAC3B,cAAe,CACb,CAAE,YAAa,WAAY,QAAS,OAAQ,EAC5C,CAAE,YAAa,UAAW,QAAS,OAAQ,CAC7C,EACA,QAAS,CACP,aAAc,CAAC,EACf,iBAAkB,CAAC,CACrB,CACF,CAAkC,EAGlC,MAAMM,EAAS,IAAIF,EAAyBC,EAAS,CACnD,aAAc,CAAC,CAAE,KAAM,UAAW,EAAG,CAAE,KAAM,SAAU,CAAC,EACxD,wBAAyB,EAC3B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,YAAa,CAAC,EACd,iBAAkB,CAAC,WAAY,SAAS,EACxC,oBAAqB,CAAC,CACxB,CAAC,CACH,CAAC,EAED,GAAG,8BAA+B,IAAM,CAEtCD,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkBF,E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aAAc,CAAC,CAAE,KAAM,UAAW,CAAC,EACnC,wBAAyB,EAC3B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,MAAO,IAAIJ,EAAe,kCAAkC,CAC9D,CAAC,CACH,CAAC,EAED,GAAG,gDAAiD,IAAM,CAExDG,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkBF,EAAuB,0BACzC,aAAcH,EAAa,UAC3B,cAAe,CAAC,EAChB,QAAS,CACP,aAAc,CAAC,EACf,iBAAkB,CAAC,CACrB,CACF,CAAkC,EAGlC,MAAMM,EAAS,IAAIF,EAAyBC,EAAS,CACnD,aAAc,CACZ,CAAE,KAAM,UAAW,EACnB,CAAE,KAAM,SAAU,EAClB,CAAE,KAAM,QAAS,CACnB,EACA,wBAAyB,EAC3B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,MAAO,IAAIJ,EACT,+CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["DeviceModelId", "DeviceStatus", "makeDeviceActionInternalApiMock", "UnknownDAError", "DeviceSessionStateType", "BuildAppsInstallPlanTask", "apiMock", "result"]
4
+ "sourcesContent": ["import { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { DeviceStatus } from \"@api/device/DeviceStatus\";\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport {\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nimport type { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nimport type { DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { DeviceSessionStateType } from \"@api/device-session/DeviceSessionState\";\nimport type { Application } from \"@internal/manager-api/model/Application\";\n\nimport { BuildAppsInstallPlanTask } from \"./BuildAppsInstallPlanTask\";\n\ndescribe(\"BuildAppsInstallPlanTask\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n vi.clearAllMocks();\n apiMock.getDeviceModel.mockReturnValue({\n id: DeviceModelId.NANO_X,\n } as unknown as TransportDeviceModel);\n });\n\n it(\"Success with no changes needed\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }, { name: \"Bitcoin\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [],\n alreadyInstalled: [\"Ethereum\", \"Bitcoin\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with no constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Solana\" },\n { name: \"Cardano\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ],\n alreadyInstalled: [\"Ethereum\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with applicable constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.2.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [\n { minVersion: \"1.6.0\", applicableModels: [DeviceModelId.NANO_X] },\n ],\n },\n {\n name: \"Bitcoin\",\n constraints: [\n { minVersion: \"1.2.1\", exemptModels: [DeviceModelId.NANO_S] },\n ],\n },\n { name: \"Solana\", constraints: [{ minVersion: \"1.2.0\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n ],\n alreadyInstalled: [],\n missingApplications: [],\n });\n });\n\n it(\"Success with non-applicable constraints\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.2.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"Cardano\", version: \"1.1.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [\n { minVersion: \"1.6.0\", exemptModels: [DeviceModelId.NANO_X] },\n ],\n },\n {\n name: \"Bitcoin\",\n constraints: [\n { minVersion: \"1.2.1\", applicableModels: [DeviceModelId.NANO_S] },\n ],\n },\n { name: \"Cardano\", constraints: [{ minVersion: \"1.1.0\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [],\n alreadyInstalled: [\"Ethereum\", \"Bitcoin\", \"Cardano\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with applicable constraints latest version\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.1.0\" },\n { versionName: \"MyShitCoin\", version: \"0.0.1\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n { versionName: \"Cardano\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\", constraints: [{ minVersion: \"latest\" }] },\n { name: \"Bitcoin\", constraints: [{ minVersion: \"latest\" }] },\n { name: \"MyShitCoin\", constraints: [{ minVersion: \"latest\" }] },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [{ versionName: \"Ethereum\", version: \"1.6.0\" }],\n alreadyInstalled: [\"Bitcoin\", \"MyShitCoin\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with dependencies\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"AlreadyInstalledDep\", version: \"1.2.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\", parentName: undefined },\n { versionName: \"Solana\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"MyEthShitCoin\",\n version: \"0.0.1\",\n parentName: \"Ethereum\",\n },\n {\n versionName: \"MySolShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n {\n versionName: \"MyPumpFunShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n { versionName: \"Cardano\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"AlreadyInstalledDep\",\n version: \"1.2.0\",\n parentName: \"Cardano\",\n },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"MyEthShitCoin\" },\n { name: \"MySolShitCoin\" },\n { name: \"Solana\" },\n { name: \"MyPumpFunShitCoin\" },\n { name: \"AlreadyInstalledDep\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [\n { versionName: \"Ethereum\", version: \"1.6.0\", parentName: undefined },\n { versionName: \"Solana\", version: \"1.2.0\", parentName: undefined },\n {\n versionName: \"MyEthShitCoin\",\n version: \"0.0.1\",\n parentName: \"Ethereum\",\n },\n {\n versionName: \"MySolShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n {\n versionName: \"MyPumpFunShitCoin\",\n version: \"0.0.1\",\n parentName: \"Solana\",\n },\n ],\n alreadyInstalled: [\"AlreadyInstalledDep\"],\n missingApplications: [],\n });\n });\n\n it(\"Success with allowed missing applications\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n ] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.6.0\" },\n { versionName: \"Bitcoin\", version: \"1.3.0\" },\n { versionName: \"Solana\", version: \"1.2.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Solana\" },\n { name: \"Cardano\" },\n ],\n allowMissingApplication: true,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n installPlan: [{ versionName: \"Solana\", version: \"1.2.0\" }],\n alreadyInstalled: [\"Ethereum\"],\n missingApplications: [\"Cardano\"],\n });\n });\n\n it(\"Error when device is in incorrect state\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.Connected,\n deviceStatus: DeviceStatus.CONNECTED,\n } as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Invalid device state\"),\n });\n });\n\n it(\"Error when device session was not populated\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [],\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [{ name: \"Ethereum\" }],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\"Device apps metadata not fetched\"),\n });\n });\n\n it(\"Error when an app is not found in the catalog\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [] as unknown as Application[],\n catalog: {\n applications: [] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n { name: \"Ethereum\" },\n { name: \"Bitcoin\" },\n { name: \"Solana\" },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnknownDAError(\n \"Application Ethereum not found in the catalog\",\n ),\n });\n });\n\n it(\"Error when an app version is not found in the catalog\", () => {\n // GIVEN\n apiMock.getDeviceSessionState.mockReturnValueOnce({\n sessionStateType: DeviceSessionStateType.ReadyWithoutSecureChannel,\n deviceStatus: DeviceStatus.CONNECTED,\n installedApps: [] as unknown as Application[],\n catalog: {\n applications: [\n { versionName: \"Ethereum\", version: \"1.5.0\" },\n ] as unknown as Application[],\n languagePackages: [],\n },\n } as unknown as DeviceSessionState);\n\n // WHEN\n const result = new BuildAppsInstallPlanTask(apiMock, {\n applications: [\n {\n name: \"Ethereum\",\n constraints: [{ minVersion: \"1.6.0\" }],\n },\n ],\n allowMissingApplication: false,\n }).run();\n\n // THEN\n expect(result).toStrictEqual({\n error: new UnsupportedFirmwareDAError(\n \"Application Ethereum not found in the catalog\",\n ),\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,iBAAAA,MAAqB,0BAC9B,OAAS,gBAAAC,MAAoB,2BAC7B,OAAS,mCAAAC,MAAuC,oDAChD,OACE,kBAAAC,EACA,8BAAAC,MACK,+BAGP,OAAS,0BAAAC,MAA8B,yCAGvC,OAAS,4BAAAC,MAAgC,6BAEzC,SAAS,2BAA4B,IAAM,CACzC,MAAMC,EAAUL,EAAgC,EAEhD,WAAW,IAAM,CACf,GAAG,cAAc,EACjBK,EAAQ,eAAe,gBAAgB,CACrC,GAAIP,EAAc,MACpB,CAAoC,CACtC,CAAC,EAED,GAAG,iCAAkC,IAAM,CAEzCO,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkBF,EAAuB,0BACzC,aAAcJ,EAAa,UAC3B,cAAe,CACb,CAAE,YAAa,WAAY,QAAS,OAAQ,EAC5C,CAAE,YAAa,UAAW,QAAS,OAAQ,CAC7C,EACA,QAAS,CACP,aAAc,CAAC,EACf,iBAAkB,CAAC,CACrB,CACF,CAAkC,EAGlC,MAAMO,EAAS,IAAIF,EAAyBC,EAAS,CACnD,aAAc,CAAC,CAAE,KAAM,UAAW,EAAG,CAAE,KAAM,SAAU,CAAC,EACxD,wBAAyB,EAC3B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,YAAa,CAAC,EACd,iBAAkB,CAAC,WAAY,SAAS,EACxC,oBAAqB,CAAC,CACxB,CAAC,CACH,CAAC,EAED,GAAG,8BAA+B,IAAM,CAEtCD,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkBF,EAAuB,0BACzC,aAAcJ,EAAa,UAC3B,cAAe,CACb,CAAE,YAAa,WAAY,QAAS,OAAQ,EAC5C,CAAE,YAAa,UAAW,QAA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EAAE,cAAc,CAC3B,MAAO,IAAIL,EAAe,kCAAkC,CAC9D,CAAC,CACH,CAAC,EAED,GAAG,gDAAiD,IAAM,CAExDI,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkBF,EAAuB,0BACzC,aAAcJ,EAAa,UAC3B,cAAe,CAAC,EAChB,QAAS,CACP,aAAc,CAAC,EACf,iBAAkB,CAAC,CACrB,CACF,CAAkC,EAGlC,MAAMO,EAAS,IAAIF,EAAyBC,EAAS,CACnD,aAAc,CACZ,CAAE,KAAM,UAAW,EACnB,CAAE,KAAM,SAAU,EAClB,CAAE,KAAM,QAAS,CACnB,EACA,wBAAyB,EAC3B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,MAAO,IAAIL,EACT,+CACF,CACF,CAAC,CACH,CAAC,EAED,GAAG,wDAAyD,IAAM,CAEhEI,EAAQ,sBAAsB,oBAAoB,CAChD,iBAAkBF,EAAuB,0BACzC,aAAcJ,EAAa,UAC3B,cAAe,CAAC,EAChB,QAAS,CACP,aAAc,CACZ,CAAE,YAAa,WAAY,QAAS,OAAQ,CAC9C,EACA,iBAAkB,CAAC,CACrB,CACF,CAAkC,EAGlC,MAAMO,EAAS,IAAIF,EAAyBC,EAAS,CACnD,aAAc,CACZ,CACE,KAAM,WACN,YAAa,CAAC,CAAE,WAAY,OAAQ,CAAC,CACvC,CACF,EACA,wBAAyB,EAC3B,CAAC,EAAE,IAAI,EAGP,OAAOC,CAAM,EAAE,cAAc,CAC3B,MAAO,IAAIJ,EACT,+CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["DeviceModelId", "DeviceStatus", "makeDeviceActionInternalApiMock", "UnknownDAError", "UnsupportedFirmwareDAError", "DeviceSessionStateType", "BuildAppsInstallPlanTask", "apiMock", "result"]
7
7
  }
package/lib/esm/src/di.js CHANGED
@@ -1,2 +1,2 @@
1
- import{Container as m}from"inversify";import{commandModuleFactory as a}from"./api/command/di/commandModule";import{deviceActionModuleFactory as p}from"./api/device-action/di/deviceActionModule";import{configModuleFactory as c}from"./internal/config/di/configModule";import{deviceModelModuleFactory as n}from"./internal/device-model/di/deviceModelModule";import{deviceSessionModuleFactory as l}from"./internal/device-session/di/deviceSessionModule";import{discoveryModuleFactory as f}from"./internal/discovery/di/discoveryModule";import{loggerModuleFactory as d}from"./internal/logger-publisher/di/loggerModule";import{managerApiModuleFactory as F}from"./internal/manager-api/di/managerApiModule";import{DEFAULT_FIRMWARE_DISTRIBUTION_SALT as y,DEFAULT_MANAGER_API_BASE_URL as M,DEFAULT_MOCK_SERVER_BASE_URL as A,DEFAULT_PROVIDER as _}from"./internal/manager-api/model/Const";import{secureChannelModuleFactory as E}from"./internal/secure-channel/di/secureChannelModule";import{DEFAULT_WEB_SOCKET_BASE_URL as s}from"./internal/secure-channel/model/Const";import{sendModuleFactory as S}from"./internal/send/di/sendModule";import{transportModuleFactory as g}from"./internal/transport/di/transportModule";const x=({stub:o=!1,transports:t=[],loggers:i=[],config:r={mockUrl:A,managerApiUrl:M,webSocketUrl:s,provider:_,firmwareDistributionSalt:y}})=>{const e=new m;return e.load(c({stub:o}),n({stub:o}),g({stub:o,transports:t,config:r}),F({stub:o,config:r}),E({stub:o,config:r}),f({stub:o}),d({subscribers:i}),l({stub:o}),S({stub:o}),a({stub:o}),p({stub:o})),e};export{x as makeContainer};
1
+ import{Container as m}from"inversify";import{commandModuleFactory as a}from"./api/command/di/commandModule";import{deviceActionModuleFactory as p}from"./api/device-action/di/deviceActionModule";import{configModuleFactory as c}from"./internal/config/di/configModule";import{deviceModelModuleFactory as n}from"./internal/device-model/di/deviceModelModule";import{deviceSessionModuleFactory as l}from"./internal/device-session/di/deviceSessionModule";import{discoveryModuleFactory as f}from"./internal/discovery/di/discoveryModule";import{loggerModuleFactory as d}from"./internal/logger-publisher/di/loggerModule";import{managerApiModuleFactory as y}from"./internal/manager-api/di/managerApiModule";import{DEFAULT_FIRMWARE_DISTRIBUTION_SALT as F,DEFAULT_MANAGER_API_BASE_URL as M,DEFAULT_MOCK_SERVER_BASE_URL as A,DEFAULT_PROVIDER as _}from"./internal/manager-api/model/Const";import{secureChannelModuleFactory as E}from"./internal/secure-channel/di/secureChannelModule";import{DEFAULT_WEB_SOCKET_BASE_URL as S}from"./internal/secure-channel/model/Const";import{sendModuleFactory as s}from"./internal/send/di/sendModule";import{transportModuleFactory as g}from"./internal/transport/di/transportModule";const x=({stub:o=!1,transports:t=[],loggers:i=[],config:r={mockUrl:A,managerApiUrl:M,webSocketUrl:S,provider:_,firmwareDistributionSalt:F}})=>{const e=new m;return e.loadSync(c({stub:o}),n({stub:o}),g({stub:o,transports:t,config:r}),y({stub:o,config:r}),E({stub:o,config:r}),f({stub:o}),d({subscribers:i}),l({stub:o}),s({stub:o}),a({stub:o}),p({stub:o})),e};export{x as makeContainer};
2
2
  //# sourceMappingURL=di.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/di.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\n// Uncomment this line to enable the logger middleware\n// import { makeLoggerMiddleware } from \"inversify-logger-middleware\";\nimport { commandModuleFactory } from \"@api/command/di/commandModule\";\nimport { deviceActionModuleFactory } from \"@api/device-action/di/deviceActionModule\";\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerSubscriberService } from \"@api/logger-subscriber/service/LoggerSubscriberService\";\nimport { type TransportFactory } from \"@api/transport/model/Transport\";\nimport { configModuleFactory } from \"@internal/config/di/configModule\";\nimport { deviceModelModuleFactory } from \"@internal/device-model/di/deviceModelModule\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { discoveryModuleFactory } from \"@internal/discovery/di/discoveryModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { managerApiModuleFactory } from \"@internal/manager-api/di/managerApiModule\";\nimport {\n DEFAULT_FIRMWARE_DISTRIBUTION_SALT,\n DEFAULT_MANAGER_API_BASE_URL,\n DEFAULT_MOCK_SERVER_BASE_URL,\n DEFAULT_PROVIDER,\n} from \"@internal/manager-api/model/Const\";\nimport { secureChannelModuleFactory } from \"@internal/secure-channel/di/secureChannelModule\";\nimport { DEFAULT_WEB_SOCKET_BASE_URL } from \"@internal/secure-channel/model/Const\";\nimport { sendModuleFactory } from \"@internal/send/di/sendModule\";\nimport { transportModuleFactory } from \"@internal/transport//di/transportModule\";\n\n// Uncomment this line to enable the logger middleware\n// const logger = makeLoggerMiddleware();\n\nexport type MakeContainerProps = {\n stub: boolean;\n transports: TransportFactory[];\n loggers: LoggerSubscriberService[];\n config: DmkConfig;\n};\n\nexport const makeContainer = ({\n stub = false,\n transports = [],\n loggers = [],\n config = {\n mockUrl: DEFAULT_MOCK_SERVER_BASE_URL,\n managerApiUrl: DEFAULT_MANAGER_API_BASE_URL,\n webSocketUrl: DEFAULT_WEB_SOCKET_BASE_URL,\n provider: DEFAULT_PROVIDER,\n firmwareDistributionSalt: DEFAULT_FIRMWARE_DISTRIBUTION_SALT,\n },\n}: Partial<MakeContainerProps>) => {\n const container = new Container();\n\n // Uncomment this line to enable the logger middleware\n // container.applyMiddleware(logger);\n\n container.load(\n configModuleFactory({ stub }),\n deviceModelModuleFactory({ stub }),\n transportModuleFactory({ stub, transports, config }),\n managerApiModuleFactory({ stub, config }),\n secureChannelModuleFactory({ stub, config }),\n discoveryModuleFactory({ stub }),\n loggerModuleFactory({ subscribers: loggers }),\n deviceSessionModuleFactory({ stub }),\n sendModuleFactory({ stub }),\n commandModuleFactory({ stub }),\n deviceActionModuleFactory({ stub }),\n // modules go here\n );\n\n return container;\n};\n"],
5
- "mappings": "AAAA,OAAS,aAAAA,MAAiB,YAI1B,OAAS,wBAAAC,MAA4B,gCACrC,OAAS,6BAAAC,MAAiC,2CAI1C,OAAS,uBAAAC,MAA2B,mCACpC,OAAS,4BAAAC,MAAgC,8CACzC,OAAS,8BAAAC,MAAkC,kDAC3C,OAAS,0BAAAC,MAA8B,yCACvC,OAAS,uBAAAC,MAA2B,6CACpC,OAAS,2BAAAC,MAA+B,4CACxC,OACE,sCAAAC,EACA,gCAAAC,EACA,gCAAAC,EACA,oBAAAC,MACK,oCACP,OAAS,8BAAAC,MAAkC,kDAC3C,OAAS,+BAAAC,MAAmC,uCAC5C,OAAS,qBAAAC,MAAyB,+BAClC,OAAS,0BAAAC,MAA8B,0CAYhC,MAAMC,EAAgB,CAAC,CAC5B,KAAAC,EAAO,GACP,WAAAC,EAAa,CAAC,EACd,QAAAC,EAAU,CAAC,EACX,OAAAC,EAAS,CACP,QAASV,EACT,cAAeD,EACf,aAAcI,EACd,SAAUF,EACV,yBAA0BH,CAC5B,CACF,IAAmC,CACjC,MAAMa,EAAY,IAAItB,EAKtB,OAAAsB,EAAU,KACRnB,EAAoB,CAAE,KAAAe,CAAK,CAAC,EAC5Bd,EAAyB,CAAE,KAAAc,CAAK,CAAC,EACjCF,EAAuB,CAAE,KAAAE,EAAM,WAAAC,EAAY,OAAAE,CAAO,CAAC,EACnDb,EAAwB,CAAE,KAAAU,EAAM,OAAAG,CAAO,CAAC,EACxCR,EAA2B,CAAE,KAAAK,EAAM,OAAAG,CAAO,CAAC,EAC3Cf,EAAuB,CAAE,KAAAY,CAAK,CAAC,EAC/BX,EAAoB,CAAE,YAAaa,CAAQ,CAAC,EAC5Cf,EAA2B,CAAE,KAAAa,CAAK,CAAC,EACnCH,EAAkB,CAAE,KAAAG,CAAK,CAAC,EAC1BjB,EAAqB,CAAE,KAAAiB,CAAK,CAAC,EAC7BhB,EAA0B,CAAE,KAAAgB,CAAK,CAAC,CAEpC,EAEOI,CACT",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { commandModuleFactory } from \"@api/command/di/commandModule\";\nimport { deviceActionModuleFactory } from \"@api/device-action/di/deviceActionModule\";\nimport { type DmkConfig } from \"@api/DmkConfig\";\nimport { type LoggerSubscriberService } from \"@api/logger-subscriber/service/LoggerSubscriberService\";\nimport { type TransportFactory } from \"@api/transport/model/Transport\";\nimport { configModuleFactory } from \"@internal/config/di/configModule\";\nimport { deviceModelModuleFactory } from \"@internal/device-model/di/deviceModelModule\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { discoveryModuleFactory } from \"@internal/discovery/di/discoveryModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { managerApiModuleFactory } from \"@internal/manager-api/di/managerApiModule\";\nimport {\n DEFAULT_FIRMWARE_DISTRIBUTION_SALT,\n DEFAULT_MANAGER_API_BASE_URL,\n DEFAULT_MOCK_SERVER_BASE_URL,\n DEFAULT_PROVIDER,\n} from \"@internal/manager-api/model/Const\";\nimport { secureChannelModuleFactory } from \"@internal/secure-channel/di/secureChannelModule\";\nimport { DEFAULT_WEB_SOCKET_BASE_URL } from \"@internal/secure-channel/model/Const\";\nimport { sendModuleFactory } from \"@internal/send/di/sendModule\";\nimport { transportModuleFactory } from \"@internal/transport//di/transportModule\";\n\nexport type MakeContainerProps = {\n stub: boolean;\n transports: TransportFactory[];\n loggers: LoggerSubscriberService[];\n config: DmkConfig;\n};\n\nexport const makeContainer = ({\n stub = false,\n transports = [],\n loggers = [],\n config = {\n mockUrl: DEFAULT_MOCK_SERVER_BASE_URL,\n managerApiUrl: DEFAULT_MANAGER_API_BASE_URL,\n webSocketUrl: DEFAULT_WEB_SOCKET_BASE_URL,\n provider: DEFAULT_PROVIDER,\n firmwareDistributionSalt: DEFAULT_FIRMWARE_DISTRIBUTION_SALT,\n },\n}: Partial<MakeContainerProps>) => {\n const container = new Container();\n\n container.loadSync(\n configModuleFactory({ stub }),\n deviceModelModuleFactory({ stub }),\n transportModuleFactory({ stub, transports, config }),\n managerApiModuleFactory({ stub, config }),\n secureChannelModuleFactory({ stub, config }),\n discoveryModuleFactory({ stub }),\n loggerModuleFactory({ subscribers: loggers }),\n deviceSessionModuleFactory({ stub }),\n sendModuleFactory({ stub }),\n commandModuleFactory({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B,CAAE,KAAAgB,CAAK,CAAC,CAEpC,EAEOI,CACT",
6
6
  "names": ["Container", "commandModuleFactory", "deviceActionModuleFactory", "configModuleFactory", "deviceModelModuleFactory", "deviceSessionModuleFactory", "discoveryModuleFactory", "loggerModuleFactory", "managerApiModuleFactory", "DEFAULT_FIRMWARE_DISTRIBUTION_SALT", "DEFAULT_MANAGER_API_BASE_URL", "DEFAULT_MOCK_SERVER_BASE_URL", "DEFAULT_PROVIDER", "secureChannelModuleFactory", "DEFAULT_WEB_SOCKET_BASE_URL", "sendModuleFactory", "transportModuleFactory", "makeContainer", "stub", "transports", "loggers", "config", "container"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ContainerModule as a}from"inversify";import{FileLocalConfigDataSource as i}from"../../config/data/LocalConfigDataSource";import{StubLocalConfigDataSource as f}from"../../config/data/LocalConfigDataSource.stub";import{RestRemoteConfigDataSource as m}from"../../config/data/RemoteConfigDataSource";import{StubRemoteConfigDataSource as c}from"../../config/data/RemoteConfigDataSource.stub";import{DefaultConfigService as n}from"../../config/service/DefaultConfigService";import{GetDmkVersionUseCase as u}from"../../config/use-case/GetDmkVersionUseCase";import{configTypes as o}from"./configTypes";const L=({stub:r})=>new a((t,p,s,e)=>{t(o.LocalConfigDataSource).to(i),t(o.RemoteConfigDataSource).to(m),t(o.GetDmkVersionUseCase).to(u),t(o.ConfigService).to(n),r&&(e(o.LocalConfigDataSource).to(f),e(o.RemoteConfigDataSource).to(c))});export{L as configModuleFactory};
1
+ import{ContainerModule as a}from"inversify";import{FileLocalConfigDataSource as i}from"../../config/data/LocalConfigDataSource";import{StubLocalConfigDataSource as f}from"../../config/data/LocalConfigDataSource.stub";import{RestRemoteConfigDataSource as m}from"../../config/data/RemoteConfigDataSource";import{StubRemoteConfigDataSource as c}from"../../config/data/RemoteConfigDataSource.stub";import{DefaultConfigService as n}from"../../config/service/DefaultConfigService";import{GetDmkVersionUseCase as u}from"../../config/use-case/GetDmkVersionUseCase";import{configTypes as o}from"./configTypes";const y=({stub:r})=>new a(({bind:t,rebindSync:e})=>{t(o.LocalConfigDataSource).to(i),t(o.RemoteConfigDataSource).to(m),t(o.GetDmkVersionUseCase).to(u),t(o.ConfigService).to(n),r&&(e(o.LocalConfigDataSource).to(f),e(o.RemoteConfigDataSource).to(c))});export{y as configModuleFactory};
2
2
  //# sourceMappingURL=configModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/config/di/configModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { FileLocalConfigDataSource } from \"@internal/config/data/LocalConfigDataSource\";\nimport { StubLocalConfigDataSource } from \"@internal/config/data/LocalConfigDataSource.stub\";\nimport { RestRemoteConfigDataSource } from \"@internal/config/data/RemoteConfigDataSource\";\nimport { StubRemoteConfigDataSource } from \"@internal/config/data/RemoteConfigDataSource.stub\";\nimport { DefaultConfigService } from \"@internal/config/service/DefaultConfigService\";\nimport { GetDmkVersionUseCase } from \"@internal/config/use-case/GetDmkVersionUseCase\";\n\nimport { configTypes } from \"./configTypes\";\n\n// This module is used to configure the dependency injection container\n// This is where we will bind our interfaces to their implementations (or mocks...)\ntype FactoryProps = {\n stub: boolean;\n};\n\nexport const configModuleFactory = ({ stub }: FactoryProps) =>\n new ContainerModule((bind, _unbind, _isBound, rebind) => {\n bind(configTypes.LocalConfigDataSource).to(FileLocalConfigDataSource);\n bind(configTypes.RemoteConfigDataSource).to(RestRemoteConfigDataSource);\n bind(configTypes.GetDmkVersionUseCase).to(GetDmkVersionUseCase);\n bind(configTypes.ConfigService).to(DefaultConfigService);\n\n if (stub) {\n // We can rebind our interfaces to their mock implementations\n rebind(configTypes.LocalConfigDataSource).to(StubLocalConfigDataSource);\n rebind(configTypes.RemoteConfigDataSource).to(StubRemoteConfigDataSource);\n }\n });\n"],
5
- "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,6BAAAC,MAAiC,8CAC1C,OAAS,6BAAAC,MAAiC,mDAC1C,OAAS,8BAAAC,MAAkC,+CAC3C,OAAS,8BAAAC,MAAkC,oDAC3C,OAAS,wBAAAC,MAA4B,gDACrC,OAAS,wBAAAC,MAA4B,iDAErC,OAAS,eAAAC,MAAmB,gBAQrB,MAAMC,EAAsB,CAAC,CAAE,KAAAC,CAAK,IACzC,IAAIT,EAAgB,CAACU,EAAMC,EAASC,EAAUC,IAAW,CACvDH,EAAKH,EAAY,qBAAqB,EAAE,GAAGN,CAAyB,EACpES,EAAKH,EAAY,sBAAsB,EAAE,GAAGJ,CAA0B,EACtEO,EAAKH,EAAY,oBAAoB,EAAE,GAAGD,CAAoB,EAC9DI,EAAKH,EAAY,aAAa,EAAE,GAAGF,CAAoB,EAEnDI,IAEFI,EAAON,EAAY,qBAAqB,EAAE,GAAGL,CAAyB,EACtEW,EAAON,EAAY,sBAAsB,EAAE,GAAGH,CAA0B,EAE5E,CAAC",
6
- "names": ["ContainerModule", "FileLocalConfigDataSource", "StubLocalConfigDataSource", "RestRemoteConfigDataSource", "StubRemoteConfigDataSource", "DefaultConfigService", "GetDmkVersionUseCase", "configTypes", "configModuleFactory", "stub", "bind", "_unbind", "_isBound", "rebind"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { FileLocalConfigDataSource } from \"@internal/config/data/LocalConfigDataSource\";\nimport { StubLocalConfigDataSource } from \"@internal/config/data/LocalConfigDataSource.stub\";\nimport { RestRemoteConfigDataSource } from \"@internal/config/data/RemoteConfigDataSource\";\nimport { StubRemoteConfigDataSource } from \"@internal/config/data/RemoteConfigDataSource.stub\";\nimport { DefaultConfigService } from \"@internal/config/service/DefaultConfigService\";\nimport { GetDmkVersionUseCase } from \"@internal/config/use-case/GetDmkVersionUseCase\";\n\nimport { configTypes } from \"./configTypes\";\n\n// This module is used to configure the dependency injection container\n// This is where we will bind our interfaces to their implementations (or mocks...)\ntype FactoryProps = {\n stub: boolean;\n};\n\nexport const configModuleFactory = ({ stub }: FactoryProps) =>\n new ContainerModule(({ bind, rebindSync }) => {\n bind(configTypes.LocalConfigDataSource).to(FileLocalConfigDataSource);\n bind(configTypes.RemoteConfigDataSource).to(RestRemoteConfigDataSource);\n bind(configTypes.GetDmkVersionUseCase).to(GetDmkVersionUseCase);\n bind(configTypes.ConfigService).to(DefaultConfigService);\n\n if (stub) {\n // We can rebind our interfaces to their mock implementations\n rebindSync(configTypes.LocalConfigDataSource).to(\n StubLocalConfigDataSource,\n );\n rebindSync(configTypes.RemoteConfigDataSource).to(\n StubRemoteConfigDataSource,\n );\n }\n });\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,6BAAAC,MAAiC,8CAC1C,OAAS,6BAAAC,MAAiC,mDAC1C,OAAS,8BAAAC,MAAkC,+CAC3C,OAAS,8BAAAC,MAAkC,oDAC3C,OAAS,wBAAAC,MAA4B,gDACrC,OAAS,wBAAAC,MAA4B,iDAErC,OAAS,eAAAC,MAAmB,gBAQrB,MAAMC,EAAsB,CAAC,CAAE,KAAAC,CAAK,IACzC,IAAIT,EAAgB,CAAC,CAAE,KAAAU,EAAM,WAAAC,CAAW,IAAM,CAC5CD,EAAKH,EAAY,qBAAqB,EAAE,GAAGN,CAAyB,EACpES,EAAKH,EAAY,sBAAsB,EAAE,GAAGJ,CAA0B,EACtEO,EAAKH,EAAY,oBAAoB,EAAE,GAAGD,CAAoB,EAC9DI,EAAKH,EAAY,aAAa,EAAE,GAAGF,CAAoB,EAEnDI,IAEFE,EAAWJ,EAAY,qBAAqB,EAAE,GAC5CL,CACF,EACAS,EAAWJ,EAAY,sBAAsB,EAAE,GAC7CH,CACF,EAEJ,CAAC",
6
+ "names": ["ContainerModule", "FileLocalConfigDataSource", "StubLocalConfigDataSource", "RestRemoteConfigDataSource", "StubRemoteConfigDataSource", "DefaultConfigService", "GetDmkVersionUseCase", "configTypes", "configModuleFactory", "stub", "bind", "rebindSync"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Container as a}from"inversify";import{FileLocalConfigDataSource as i}from"../../config/data/LocalConfigDataSource";import{StubLocalConfigDataSource as u}from"../../config/data/LocalConfigDataSource.stub";import{RestRemoteConfigDataSource as f}from"../../config/data/RemoteConfigDataSource";import{StubRemoteConfigDataSource as l}from"../../config/data/RemoteConfigDataSource.stub";import{configModuleFactory as n}from"./configModule";import{configTypes as t}from"./configTypes";describe("configModuleFactory",()=>{describe("Default",()=>{let e,o;beforeEach(()=>{o=n({stub:!1}),e=new a,e.load(o)}),it("should return the config module",()=>{expect(o).toBeDefined()}),it("should return none mocked data sources",()=>{const c=e.get(t.LocalConfigDataSource),r=e.get(t.RemoteConfigDataSource);expect(c).toBeInstanceOf(i),expect(r).toBeInstanceOf(f)})}),describe("Mocked",()=>{let e,o;beforeEach(()=>{o=n({stub:!0}),e=new a,e.load(o)}),it("should return the config module",()=>{expect(o).toBeDefined()}),it("should return mocked data sources",()=>{const c=e.get(t.LocalConfigDataSource),r=e.get(t.RemoteConfigDataSource);expect(c).toBeInstanceOf(u),expect(r).toBeInstanceOf(l)})})});
1
+ import{Container as a}from"inversify";import{FileLocalConfigDataSource as i}from"../../config/data/LocalConfigDataSource";import{StubLocalConfigDataSource as u}from"../../config/data/LocalConfigDataSource.stub";import{RestRemoteConfigDataSource as f}from"../../config/data/RemoteConfigDataSource";import{StubRemoteConfigDataSource as l}from"../../config/data/RemoteConfigDataSource.stub";import{configModuleFactory as n}from"./configModule";import{configTypes as t}from"./configTypes";describe("configModuleFactory",()=>{describe("Default",()=>{let e,o;beforeEach(()=>{o=n({stub:!1}),e=new a,e.loadSync(o)}),it("should return the config module",()=>{expect(o).toBeDefined()}),it("should return none mocked data sources",()=>{const c=e.get(t.LocalConfigDataSource),r=e.get(t.RemoteConfigDataSource);expect(c).toBeInstanceOf(i),expect(r).toBeInstanceOf(f)})}),describe("Mocked",()=>{let e,o;beforeEach(()=>{o=n({stub:!0}),e=new a,e.loadSync(o)}),it("should return the config module",()=>{expect(o).toBeDefined()}),it("should return mocked data sources",()=>{const c=e.get(t.LocalConfigDataSource),r=e.get(t.RemoteConfigDataSource);expect(c).toBeInstanceOf(u),expect(r).toBeInstanceOf(l)})})});
2
2
  //# sourceMappingURL=configModule.test.js.map