@ledgerhq/dmk-ledger-wallet 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/lib/cjs/api/device-action/OsUpdate/Backup/BackupDeviceAction.js +2 -0
  2. package/lib/cjs/api/device-action/OsUpdate/Backup/BackupDeviceAction.js.map +7 -0
  3. package/lib/cjs/api/device-action/OsUpdate/Backup/BackupDeviceAction.test.js +2 -0
  4. package/lib/cjs/api/device-action/OsUpdate/Backup/BackupDeviceAction.test.js.map +7 -0
  5. package/lib/cjs/api/device-action/OsUpdate/Backup/BackupDeviceActionErrors.js +2 -0
  6. package/lib/cjs/api/device-action/OsUpdate/Backup/BackupDeviceActionErrors.js.map +7 -0
  7. package/lib/cjs/api/device-action/OsUpdate/Backup/Storage/BackSerializerErrors.js +2 -0
  8. package/lib/cjs/api/device-action/OsUpdate/Backup/Storage/BackSerializerErrors.js.map +7 -0
  9. package/lib/cjs/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.js +2 -0
  10. package/lib/cjs/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.js.map +7 -0
  11. package/lib/cjs/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.test.js +2 -0
  12. package/lib/cjs/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.test.js.map +7 -0
  13. package/lib/cjs/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.js +2 -0
  14. package/lib/cjs/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.js.map +7 -0
  15. package/lib/cjs/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.test.js +2 -0
  16. package/lib/cjs/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.test.js.map +7 -0
  17. package/lib/cjs/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorageErrors.js +2 -0
  18. package/lib/cjs/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorageErrors.js.map +7 -0
  19. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.js +2 -0
  20. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.js.map +7 -0
  21. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.test.js +2 -0
  22. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.test.js.map +7 -0
  23. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.js +2 -0
  24. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.js.map +7 -0
  25. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.test.js +2 -0
  26. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.test.js.map +7 -0
  27. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.js +2 -0
  28. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.js.map +7 -0
  29. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.test.js +2 -0
  30. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.test.js.map +7 -0
  31. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps.js +2 -0
  32. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps.js.map +7 -0
  33. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps.test.js +2 -0
  34. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps.test.js.map +7 -0
  35. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/LookForBackup.js +2 -0
  36. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/LookForBackup.js.map +7 -0
  37. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/LookForBackup.test.js +2 -0
  38. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/LookForBackup.test.js.map +7 -0
  39. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.js +2 -0
  40. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.js.map +7 -0
  41. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.test.js +2 -0
  42. package/lib/cjs/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.test.js.map +7 -0
  43. package/lib/cjs/api/device-action/OsUpdate/Backup/types.js +2 -0
  44. package/lib/cjs/api/device-action/OsUpdate/Backup/types.js.map +7 -0
  45. package/lib/cjs/index.js +1 -1
  46. package/lib/cjs/index.js.map +3 -3
  47. package/lib/cjs/package.json +2 -2
  48. package/lib/esm/api/device-action/OsUpdate/Backup/BackupDeviceAction.js +2 -0
  49. package/lib/esm/api/device-action/OsUpdate/Backup/BackupDeviceAction.js.map +7 -0
  50. package/lib/esm/api/device-action/OsUpdate/Backup/BackupDeviceAction.test.js +2 -0
  51. package/lib/esm/api/device-action/OsUpdate/Backup/BackupDeviceAction.test.js.map +7 -0
  52. package/lib/esm/api/device-action/OsUpdate/Backup/BackupDeviceActionErrors.js +2 -0
  53. package/lib/esm/api/device-action/OsUpdate/Backup/BackupDeviceActionErrors.js.map +7 -0
  54. package/lib/esm/api/device-action/OsUpdate/Backup/Storage/BackSerializerErrors.js +2 -0
  55. package/lib/esm/api/device-action/OsUpdate/Backup/Storage/BackSerializerErrors.js.map +7 -0
  56. package/lib/esm/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.js +2 -0
  57. package/lib/esm/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.js.map +7 -0
  58. package/lib/esm/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.test.js +2 -0
  59. package/lib/esm/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.test.js.map +7 -0
  60. package/lib/esm/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.js +2 -0
  61. package/lib/esm/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.js.map +7 -0
  62. package/lib/esm/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.test.js +2 -0
  63. package/lib/esm/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.test.js.map +7 -0
  64. package/lib/esm/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorageErrors.js +2 -0
  65. package/lib/esm/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorageErrors.js.map +7 -0
  66. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.js +2 -0
  67. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.js.map +7 -0
  68. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.test.js +2 -0
  69. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.test.js.map +7 -0
  70. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.js +2 -0
  71. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.js.map +7 -0
  72. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.test.js +2 -0
  73. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.test.js.map +7 -0
  74. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.js +2 -0
  75. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.js.map +7 -0
  76. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.test.js +2 -0
  77. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.test.js.map +7 -0
  78. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps.js +2 -0
  79. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps.js.map +7 -0
  80. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps.test.js +2 -0
  81. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps.test.js.map +7 -0
  82. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/LookForBackup.js +2 -0
  83. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/LookForBackup.js.map +7 -0
  84. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/LookForBackup.test.js +2 -0
  85. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/LookForBackup.test.js.map +7 -0
  86. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.js +2 -0
  87. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.js.map +7 -0
  88. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.test.js +2 -0
  89. package/lib/esm/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.test.js.map +7 -0
  90. package/lib/esm/api/device-action/OsUpdate/Backup/types.js +2 -0
  91. package/lib/esm/api/device-action/OsUpdate/Backup/types.js.map +7 -0
  92. package/lib/esm/index.js +1 -1
  93. package/lib/esm/index.js.map +3 -3
  94. package/lib/esm/package.json +2 -2
  95. package/lib/types/api/command/BackgroundImageCommandErrors.d.ts +3 -3
  96. package/lib/types/api/command/DeleteBackgroundImageCommand.d.ts +1 -1
  97. package/lib/types/api/command/FetchBackgroundImageChunkCommand.d.ts +1 -1
  98. package/lib/types/api/command/GetBackgroundImageHashCommand.d.ts +1 -1
  99. package/lib/types/api/device-action/OsUpdate/Backup/BackupDeviceAction.d.ts +6 -0
  100. package/lib/types/api/device-action/OsUpdate/Backup/BackupDeviceAction.d.ts.map +1 -0
  101. package/lib/types/api/device-action/OsUpdate/Backup/BackupDeviceAction.test.d.ts +2 -0
  102. package/lib/types/api/device-action/OsUpdate/Backup/BackupDeviceAction.test.d.ts.map +1 -0
  103. package/lib/types/api/device-action/OsUpdate/Backup/BackupDeviceActionErrors.d.ts +23 -0
  104. package/lib/types/api/device-action/OsUpdate/Backup/BackupDeviceActionErrors.d.ts.map +1 -0
  105. package/lib/types/api/device-action/OsUpdate/Backup/Storage/BackSerializerErrors.d.ts +12 -0
  106. package/lib/types/api/device-action/OsUpdate/Backup/Storage/BackSerializerErrors.d.ts.map +1 -0
  107. package/lib/types/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.d.ts +6 -0
  108. package/lib/types/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.d.ts.map +1 -0
  109. package/lib/types/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.test.d.ts +2 -0
  110. package/lib/types/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.test.d.ts.map +1 -0
  111. package/lib/types/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.d.ts +11 -0
  112. package/lib/types/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.d.ts.map +1 -0
  113. package/lib/types/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.test.d.ts +2 -0
  114. package/lib/types/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.test.d.ts.map +1 -0
  115. package/lib/types/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorageErrors.d.ts +12 -0
  116. package/lib/types/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorageErrors.d.ts.map +1 -0
  117. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.d.ts +14 -0
  118. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.d.ts.map +1 -0
  119. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.test.d.ts +2 -0
  120. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.test.d.ts.map +1 -0
  121. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.d.ts +6 -0
  122. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.d.ts.map +1 -0
  123. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.test.d.ts +2 -0
  124. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.test.d.ts.map +1 -0
  125. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.d.ts +8 -0
  126. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.d.ts.map +1 -0
  127. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.test.d.ts +2 -0
  128. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.test.d.ts.map +1 -0
  129. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps.d.ts +5 -0
  130. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps.d.ts.map +1 -0
  131. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps.test.d.ts +2 -0
  132. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps.test.d.ts.map +1 -0
  133. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/LookForBackup.d.ts +13 -0
  134. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/LookForBackup.d.ts.map +1 -0
  135. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/LookForBackup.test.d.ts +2 -0
  136. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/LookForBackup.test.d.ts.map +1 -0
  137. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.d.ts +15 -0
  138. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.d.ts.map +1 -0
  139. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.test.d.ts +2 -0
  140. package/lib/types/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.test.d.ts.map +1 -0
  141. package/lib/types/api/device-action/OsUpdate/Backup/types.d.ts +43 -0
  142. package/lib/types/api/device-action/OsUpdate/Backup/types.d.ts.map +1 -0
  143. package/lib/types/index.d.ts +2 -0
  144. package/lib/types/index.d.ts.map +1 -1
  145. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  146. package/package.json +5 -5
@@ -0,0 +1,2 @@
1
+ "use strict";var s=require("../../../../device-action/OsUpdate/Backup/BackupDeviceActionErrors"),p=require("../../../../device-action/OsUpdate/Backup/Storage/DeviceBackupStorage"),c=require("../../../../device-action/OsUpdate/Backup/Substeps/SaveBackup");describe("SaveBackup",()=>{const r={getItem:vi.fn(),setItem:vi.fn(),removeItem:vi.fn()},e=vi.mocked(r.setItem),o=new p.DeviceBackupStorage(r),t={languageId:1,installedApps:[{appName:"app1",data:"deadbeef"}],clsHexImage:void 0,createdAt:new Date};beforeEach(()=>{vi.resetAllMocks()}),describe("Success",()=>{it("Should have saved backup",async()=>{e.mockResolvedValueOnce(void 0);const a=await(0,c.saveBackup)(o)({input:{deviceId:"12345",backup:t}});expect(a.isRight()).toBe(!0),expect(e).toHaveBeenCalledWith("dmk-device-backup-12345",JSON.stringify(t))})}),describe("Error",()=>{it("Should return SaveBackupError",async()=>{const a=new Error("data storage failed");e.mockRejectedValueOnce(a);const i=await(0,c.saveBackup)(o)({input:{deviceId:"12345",backup:t}});expect(i.isLeft()).toBe(!0),i.mapLeft(n=>{expect(n).toBeInstanceOf(s.SaveBackupError)})})})});
2
+ //# sourceMappingURL=SaveBackup.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Substeps/SaveBackup.test.ts"],
4
+ "sourcesContent": ["import { type KeyValueStorage } from \"@ledgerhq/device-management-kit\";\n\nimport { SaveBackupError } from \"@api/device-action/OsUpdate/Backup/BackupDeviceActionErrors\";\nimport { DeviceBackupStorage } from \"@api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage\";\nimport { saveBackup } from \"@api/device-action/OsUpdate/Backup/Substeps/SaveBackup\";\nimport { type Backup } from \"@api/device-action/OsUpdate/Backup/types\";\n\ndescribe(\"SaveBackup\", () => {\n const storage: KeyValueStorage = {\n getItem: vi.fn(),\n setItem: vi.fn(),\n removeItem: vi.fn(),\n };\n const setItemMock = vi.mocked(storage.setItem);\n\n const deviceBackupStorage: DeviceBackupStorage = new DeviceBackupStorage(\n storage,\n );\n\n const backup: Backup = {\n languageId: 1,\n installedApps: [{ appName: \"app1\", data: \"deadbeef\" }],\n clsHexImage: undefined,\n createdAt: new Date(),\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"Success\", () => {\n it(\"Should have saved backup\", async () => {\n setItemMock.mockResolvedValueOnce(undefined);\n\n const result = await saveBackup(deviceBackupStorage)({\n input: { deviceId: \"12345\", backup },\n });\n\n expect(result.isRight()).toBe(true);\n expect(setItemMock).toHaveBeenCalledWith(\n \"dmk-device-backup-12345\",\n JSON.stringify(backup),\n );\n });\n });\n describe(\"Error\", () => {\n it(\"Should return SaveBackupError\", async () => {\n const error = new Error(\"data storage failed\");\n setItemMock.mockRejectedValueOnce(error);\n\n const result = await saveBackup(deviceBackupStorage)({\n input: { deviceId: \"12345\", backup },\n });\n\n expect(result.isLeft()).toBe(true);\n result.mapLeft((e) => {\n expect(e).toBeInstanceOf(SaveBackupError);\n });\n });\n });\n});\n"],
5
+ "mappings": "aAEA,IAAAA,EAAgC,uEAChCC,EAAoC,0EACpCC,EAA2B,kEAG3B,SAAS,aAAc,IAAM,CAC3B,MAAMC,EAA2B,CAC/B,QAAS,GAAG,GAAG,EACf,QAAS,GAAG,GAAG,EACf,WAAY,GAAG,GAAG,CACpB,EACMC,EAAc,GAAG,OAAOD,EAAQ,OAAO,EAEvCE,EAA2C,IAAI,sBACnDF,CACF,EAEMG,EAAiB,CACrB,WAAY,EACZ,cAAe,CAAC,CAAE,QAAS,OAAQ,KAAM,UAAW,CAAC,EACrD,YAAa,OACb,UAAW,IAAI,IACjB,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,2BAA4B,SAAY,CACzCF,EAAY,sBAAsB,MAAS,EAE3C,MAAMG,EAAS,QAAM,cAAWF,CAAmB,EAAE,CACnD,MAAO,CAAE,SAAU,QAAS,OAAAC,CAAO,CACrC,CAAC,EAED,OAAOC,EAAO,QAAQ,CAAC,EAAE,KAAK,EAAI,EAClC,OAAOH,CAAW,EAAE,qBAClB,0BACA,KAAK,UAAUE,CAAM,CACvB,CACF,CAAC,CACH,CAAC,EACD,SAAS,QAAS,IAAM,CACtB,GAAG,gCAAiC,SAAY,CAC9C,MAAME,EAAQ,IAAI,MAAM,qBAAqB,EAC7CJ,EAAY,sBAAsBI,CAAK,EAEvC,MAAMD,EAAS,QAAM,cAAWF,CAAmB,EAAE,CACnD,MAAO,CAAE,SAAU,QAAS,OAAAC,CAAO,CACrC,CAAC,EAED,OAAOC,EAAO,OAAO,CAAC,EAAE,KAAK,EAAI,EACjCA,EAAO,QAASE,GAAM,CACpB,OAAOA,CAAC,EAAE,eAAe,iBAAe,CAC1C,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_BackupDeviceActionErrors", "import_DeviceBackupStorage", "import_SaveBackup", "storage", "setItemMock", "deviceBackupStorage", "backup", "result", "error", "e"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var p in e)n(t,p,{get:e[p],enumerable:!0})},s=(t,e,p,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of d(e))!c.call(t,a)&&a!==p&&n(t,a,{get:()=>e[a],enumerable:!(o=i(e,a))||o.enumerable});return t};var A=t=>s(n({},"__esModule",{value:!0}),t);var D={};l(D,{BackupSteps:()=>u});module.exports=A(D);var u=(r=>(r.Idle="idle",r.GetLanguage="getLanguage",r.ListInstalledApps="listInstalledApps",r.BackupAppsStorage="backupAppsStorage",r.DownloadCustomLockScreen="downloadCustomLockScreen",r.SaveBackup="saveBackup",r))(u||{});0&&(module.exports={BackupSteps});
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/device-action/OsUpdate/Backup/types.ts"],
4
+ "sourcesContent": ["import {\n type DeviceActionState,\n type InstalledApp,\n type KeyValueStorage,\n type ListInstalledAppsDAError,\n type ListInstalledAppsDAIntermediateValue,\n type ListInstalledAppsDARequiredInteraction,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n type DownloadCustomLockScreenDAError,\n type DownloadCustomLockScreenDAIntermediateValue,\n type DownloadCustomLockScreenDARequiredInteraction,\n} from \"@api/device-action/DownloadCustomLockScreen/types\";\nimport { type BackupDeviceActionErrors } from \"@api/device-action/OsUpdate/Backup/BackupDeviceActionErrors\";\n\nexport type BackupDAInput = {\n isDeviceOnboarded: boolean;\n deviceId: string;\n storage: KeyValueStorage;\n unlockTimeout: number;\n};\n\nexport type BackupDAOutput = void;\n\nexport type BackupDAError =\n | ListInstalledAppsDAError\n | DownloadCustomLockScreenDAError\n | BackupDeviceActionErrors;\n\nexport type BackupDAIntermediateValue = (\n | ListInstalledAppsDAIntermediateValue\n | DownloadCustomLockScreenDAIntermediateValue\n) & {\n step: BackupSteps;\n};\n\nexport type BackupDARequiredInteraction =\n | ListInstalledAppsDARequiredInteraction\n | DownloadCustomLockScreenDARequiredInteraction\n | UserInteractionRequired.None;\n\nexport type BackupDAInternalState = {\n error: BackupDAError | null;\n languageId: number | undefined;\n installedApps: InstalledApp[];\n backupApps: BackupApp[];\n clsHexImage: string | undefined;\n backupAlreadyExist: boolean;\n};\n\nexport type BackupDAState = DeviceActionState<\n BackupDAOutput,\n BackupDAError,\n BackupDAIntermediateValue\n>;\n\nexport enum BackupSteps {\n Idle = \"idle\",\n GetLanguage = \"getLanguage\",\n ListInstalledApps = \"listInstalledApps\",\n BackupAppsStorage = \"backupAppsStorage\",\n DownloadCustomLockScreen = \"downloadCustomLockScreen\",\n SaveBackup = \"saveBackup\",\n}\n\nexport type BackupApp = {\n appName: string;\n data: string | undefined;\n};\n\nexport type Backup = {\n languageId: number | undefined;\n installedApps: BackupApp[];\n clsHexImage: string | undefined;\n createdAt: Date;\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GA0DO,IAAKE,OACVA,EAAA,KAAO,OACPA,EAAA,YAAc,cACdA,EAAA,kBAAoB,oBACpBA,EAAA,kBAAoB,oBACpBA,EAAA,yBAA2B,2BAC3BA,EAAA,WAAa,aANHA,OAAA",
6
+ "names": ["types_exports", "__export", "BackupSteps", "__toCommonJS"]
7
+ }
package/lib/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var f=(r,o)=>{for(var m in o)a(r,m,{get:o[m],enumerable:!0})},g=(r,o,m,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of A(o))!v.call(r,n)&&n!==m&&a(r,n,{get:()=>o[n],enumerable:!(s=k(o,n))||s.enumerable});return r};var x=r=>g(a({},"__esModule",{value:!0}),r);var R={};f(R,{CustomLockScreenDeviceInternalErrorDAError:()=>e.CustomLockScreenDeviceInternalErrorDAError,DeviceInRecoveryModeDAError:()=>e.DeviceInRecoveryModeDAError,DownloadCustomLockScreenDeviceAction:()=>C.DownloadCustomLockScreenDeviceAction,GetCustomLockScreenInfoDeviceAction:()=>I.GetCustomLockScreenInfoDeviceAction,ImageCropError:()=>c.ImageCropError,ImageResizeError:()=>c.ImageResizeError,ImageSizeLoadingError:()=>c.ImageSizeLoadingError,InvalidCustomLockScreenImageDataDAError:()=>e.InvalidCustomLockScreenImageDataDAError,InvalidCustomLockScreenStateDAError:()=>e.InvalidCustomLockScreenStateDAError,NoCustomLockScreenImageDAError:()=>e.NoCustomLockScreenImageDAError,RemoveCustomLockScreenDeviceAction:()=>L.RemoveCustomLockScreenDeviceAction,UploadCustomLockScreenDeviceAction:()=>l.UploadCustomLockScreenDeviceAction,centerCropResizeImage:()=>D.centerCropResizeImage,decodeImageFromDevice:()=>p.decodeImageFromDevice,encodeImageForDevice:()=>i.encodeImageForDevice,getScreenSpecs:()=>t.getScreenSpecs,getScreenVisibleAreaDimensions:()=>t.getScreenVisibleAreaDimensions,isCustomLockScreenSupported:()=>t.isCustomLockScreenSupported,loadImageFromFile:()=>u.loadImageFromFile,processImage:()=>d.convertToGrayscale,renderPixelDataToImage:()=>S.renderPixelDataToImage});module.exports=x(R);var p=require("./api/customLockScreenUtils/codec/decodeImageFromDevice"),i=require("./api/customLockScreenUtils/codec/encodeImageForDevice"),u=require("./api/customLockScreenUtils/fit/canvasUtils"),D=require("./api/customLockScreenUtils/fit/imageFit"),d=require("./api/customLockScreenUtils/grayscale/grayscaleDithering"),S=require("./api/customLockScreenUtils/grayscale/pixelDataRenderer"),t=require("./api/customLockScreenUtils/screenSpecs"),c=require("./api/customLockScreenUtils/types"),e=require("./api/device-action/customLockScreenDeviceActionErrors"),C=require("./api/device-action/DownloadCustomLockScreen/DownloadCustomLockScreenDeviceAction"),I=require("./api/device-action/GetCustomLockScreenInfo/GetCustomLockScreenInfoDeviceAction"),L=require("./api/device-action/RemoveCustomLockScreen/RemoveCustomLockScreenDeviceAction"),l=require("./api/device-action/UploadCustomLockScreen/UploadCustomLockScreenDeviceAction");0&&(module.exports={CustomLockScreenDeviceInternalErrorDAError,DeviceInRecoveryModeDAError,DownloadCustomLockScreenDeviceAction,GetCustomLockScreenInfoDeviceAction,ImageCropError,ImageResizeError,ImageSizeLoadingError,InvalidCustomLockScreenImageDataDAError,InvalidCustomLockScreenStateDAError,NoCustomLockScreenImageDAError,RemoveCustomLockScreenDeviceAction,UploadCustomLockScreenDeviceAction,centerCropResizeImage,decodeImageFromDevice,encodeImageForDevice,getScreenSpecs,getScreenVisibleAreaDimensions,isCustomLockScreenSupported,loadImageFromFile,processImage,renderPixelDataToImage});
1
+ "use strict";var a=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(r,o)=>{for(var m in o)a(r,m,{get:o[m],enumerable:!0})},x=(r,o,m,p)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of v(o))!f.call(r,n)&&n!==m&&a(r,n,{get:()=>o[n],enumerable:!(p=L(o,n))||p.enumerable});return r};var R=r=>x(a({},"__esModule",{value:!0}),r);var y={};g(y,{BackupDeviceAction:()=>I.BackupDeviceAction,CustomLockScreenDeviceInternalErrorDAError:()=>e.CustomLockScreenDeviceInternalErrorDAError,DeviceInRecoveryModeDAError:()=>e.DeviceInRecoveryModeDAError,DownloadCustomLockScreenDeviceAction:()=>k.DownloadCustomLockScreenDeviceAction,GetCustomLockScreenInfoDeviceAction:()=>A.GetCustomLockScreenInfoDeviceAction,ImageCropError:()=>c.ImageCropError,ImageResizeError:()=>c.ImageResizeError,ImageSizeLoadingError:()=>c.ImageSizeLoadingError,InvalidCustomLockScreenImageDataDAError:()=>e.InvalidCustomLockScreenImageDataDAError,InvalidCustomLockScreenStateDAError:()=>e.InvalidCustomLockScreenStateDAError,NoCustomLockScreenImageDAError:()=>e.NoCustomLockScreenImageDAError,RemoveCustomLockScreenDeviceAction:()=>C.RemoveCustomLockScreenDeviceAction,UploadCustomLockScreenDeviceAction:()=>l.UploadCustomLockScreenDeviceAction,centerCropResizeImage:()=>D.centerCropResizeImage,decodeImageFromDevice:()=>s.decodeImageFromDevice,encodeImageForDevice:()=>u.encodeImageForDevice,getScreenSpecs:()=>t.getScreenSpecs,getScreenVisibleAreaDimensions:()=>t.getScreenVisibleAreaDimensions,isCustomLockScreenSupported:()=>t.isCustomLockScreenSupported,loadImageFromFile:()=>i.loadImageFromFile,processImage:()=>d.convertToGrayscale,renderPixelDataToImage:()=>S.renderPixelDataToImage});module.exports=R(y);var s=require("./api/customLockScreenUtils/codec/decodeImageFromDevice"),u=require("./api/customLockScreenUtils/codec/encodeImageForDevice"),i=require("./api/customLockScreenUtils/fit/canvasUtils"),D=require("./api/customLockScreenUtils/fit/imageFit"),d=require("./api/customLockScreenUtils/grayscale/grayscaleDithering"),S=require("./api/customLockScreenUtils/grayscale/pixelDataRenderer"),t=require("./api/customLockScreenUtils/screenSpecs"),c=require("./api/customLockScreenUtils/types"),e=require("./api/device-action/customLockScreenDeviceActionErrors"),k=require("./api/device-action/DownloadCustomLockScreen/DownloadCustomLockScreenDeviceAction"),A=require("./api/device-action/GetCustomLockScreenInfo/GetCustomLockScreenInfoDeviceAction"),I=require("./api/device-action/OsUpdate/Backup/BackupDeviceAction"),C=require("./api/device-action/RemoveCustomLockScreen/RemoveCustomLockScreenDeviceAction"),l=require("./api/device-action/UploadCustomLockScreen/UploadCustomLockScreenDeviceAction");0&&(module.exports={BackupDeviceAction,CustomLockScreenDeviceInternalErrorDAError,DeviceInRecoveryModeDAError,DownloadCustomLockScreenDeviceAction,GetCustomLockScreenInfoDeviceAction,ImageCropError,ImageResizeError,ImageSizeLoadingError,InvalidCustomLockScreenImageDataDAError,InvalidCustomLockScreenStateDAError,NoCustomLockScreenImageDAError,RemoveCustomLockScreenDeviceAction,UploadCustomLockScreenDeviceAction,centerCropResizeImage,decodeImageFromDevice,encodeImageForDevice,getScreenSpecs,getScreenVisibleAreaDimensions,isCustomLockScreenSupported,loadImageFromFile,processImage,renderPixelDataToImage});
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["// Custom Lock Screen Utilities - Codec (device binary format)\nexport type { DecodeImageFromDeviceResult } from \"./api/customLockScreenUtils/codec/decodeImageFromDevice\";\nexport { decodeImageFromDevice } from \"./api/customLockScreenUtils/codec/decodeImageFromDevice\";\nexport type { EncodeImageForDeviceArgs } from \"./api/customLockScreenUtils/codec/encodeImageForDevice\";\nexport { encodeImageForDevice } from \"./api/customLockScreenUtils/codec/encodeImageForDevice\";\n\n// Custom Lock Screen Utilities - Fit (resize/crop to screen)\n// Note: These functions require a Web runtime environment (browser)\nexport { loadImageFromFile } from \"./api/customLockScreenUtils/fit/canvasUtils\";\nexport { centerCropResizeImage } from \"./api/customLockScreenUtils/fit/imageFit\";\n\n// Custom Lock Screen Utilities - Grayscale (color conversion & dithering)\n// Note: These functions require a Web runtime environment (browser)\nexport { convertToGrayscale as processImage } from \"./api/customLockScreenUtils/grayscale/grayscaleDithering\";\nexport { renderPixelDataToImage } from \"./api/customLockScreenUtils/grayscale/pixelDataRenderer\";\n\n// Custom Lock Screen Utilities - Screen Specs\nexport type {\n CLSSupportedDeviceModelId,\n ScreenSpecs,\n} from \"./api/customLockScreenUtils/screenSpecs\";\nexport {\n getScreenSpecs,\n getScreenVisibleAreaDimensions,\n isCustomLockScreenSupported,\n} from \"./api/customLockScreenUtils/screenSpecs\";\n\n// Custom Lock Screen Utilities - Types\nexport type {\n CenteredResult,\n DitheringAlgorithm,\n ImageDimensions,\n ProcessImageArgs,\n ProcessorResult,\n RenderPixelDataToImageArgs,\n RenderPixelDataToImageResult,\n} from \"./api/customLockScreenUtils/types\";\nexport {\n ImageCropError,\n ImageResizeError,\n ImageSizeLoadingError,\n} from \"./api/customLockScreenUtils/types\";\nexport {\n CustomLockScreenDeviceInternalErrorDAError,\n DeviceInRecoveryModeDAError,\n type DownloadCommandsDAError,\n InvalidCustomLockScreenImageDataDAError,\n InvalidCustomLockScreenStateDAError,\n NoCustomLockScreenImageDAError,\n type RemoveCommandDAError,\n type UploadCommandsDAError,\n} from \"./api/device-action/customLockScreenDeviceActionErrors\";\n\n// Device Actions\nexport { DownloadCustomLockScreenDeviceAction } from \"./api/device-action/DownloadCustomLockScreen/DownloadCustomLockScreenDeviceAction\";\nexport type {\n DownloadCustomLockScreenDAError,\n DownloadCustomLockScreenDAInput,\n DownloadCustomLockScreenDAIntermediateValue,\n DownloadCustomLockScreenDAOutput,\n DownloadCustomLockScreenDARequiredInteraction,\n DownloadCustomLockScreenDAState,\n} from \"./api/device-action/DownloadCustomLockScreen/types\";\nexport { GetCustomLockScreenInfoDeviceAction } from \"./api/device-action/GetCustomLockScreenInfo/GetCustomLockScreenInfoDeviceAction\";\nexport type {\n GetCustomLockScreenInfoDAError,\n GetCustomLockScreenInfoDAInput,\n GetCustomLockScreenInfoDAIntermediateValue,\n GetCustomLockScreenInfoDAOutput,\n GetCustomLockScreenInfoDARequiredInteraction,\n GetCustomLockScreenInfoDAState,\n} from \"./api/device-action/GetCustomLockScreenInfo/types\";\nexport { RemoveCustomLockScreenDeviceAction } from \"./api/device-action/RemoveCustomLockScreen/RemoveCustomLockScreenDeviceAction\";\nexport type {\n RemoveCustomLockScreenDAError,\n RemoveCustomLockScreenDAInput,\n RemoveCustomLockScreenDAIntermediateValue,\n RemoveCustomLockScreenDAOutput,\n RemoveCustomLockScreenDARequiredInteraction,\n RemoveCustomLockScreenDAState,\n} from \"./api/device-action/RemoveCustomLockScreen/types\";\nexport type {\n UploadCustomLockScreenDAError,\n UploadCustomLockScreenDAInput,\n UploadCustomLockScreenDAIntermediateValue,\n UploadCustomLockScreenDAOutput,\n UploadCustomLockScreenDARequiredInteraction,\n UploadCustomLockScreenDAState,\n} from \"./api/device-action/UploadCustomLockScreen/types\";\nexport { UploadCustomLockScreenDeviceAction } from \"./api/device-action/UploadCustomLockScreen/UploadCustomLockScreenDeviceAction\";\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,swCAAAE,EAAAF,GAEA,IAAAG,EAAsC,mEAEtCC,EAAqC,kEAIrCC,EAAkC,uDAClCC,EAAsC,oDAItCC,EAAmD,oEACnDC,EAAuC,mEAOvCC,EAIO,mDAYPC,EAIO,6CACPC,EASO,kEAGPC,EAAqD,6FASrDC,EAAoD,2FASpDC,EAAmD,yFAiBnDC,EAAmD",
6
- "names": ["index_exports", "__export", "__toCommonJS", "import_decodeImageFromDevice", "import_encodeImageForDevice", "import_canvasUtils", "import_imageFit", "import_grayscaleDithering", "import_pixelDataRenderer", "import_screenSpecs", "import_types", "import_customLockScreenDeviceActionErrors", "import_DownloadCustomLockScreenDeviceAction", "import_GetCustomLockScreenInfoDeviceAction", "import_RemoveCustomLockScreenDeviceAction", "import_UploadCustomLockScreenDeviceAction"]
4
+ "sourcesContent": ["// Custom Lock Screen Utilities - Codec (device binary format)\nexport type { DecodeImageFromDeviceResult } from \"./api/customLockScreenUtils/codec/decodeImageFromDevice\";\nexport { decodeImageFromDevice } from \"./api/customLockScreenUtils/codec/decodeImageFromDevice\";\nexport type { EncodeImageForDeviceArgs } from \"./api/customLockScreenUtils/codec/encodeImageForDevice\";\nexport { encodeImageForDevice } from \"./api/customLockScreenUtils/codec/encodeImageForDevice\";\n\n// Custom Lock Screen Utilities - Fit (resize/crop to screen)\n// Note: These functions require a Web runtime environment (browser)\nexport { loadImageFromFile } from \"./api/customLockScreenUtils/fit/canvasUtils\";\nexport { centerCropResizeImage } from \"./api/customLockScreenUtils/fit/imageFit\";\n\n// Custom Lock Screen Utilities - Grayscale (color conversion & dithering)\n// Note: These functions require a Web runtime environment (browser)\nexport { convertToGrayscale as processImage } from \"./api/customLockScreenUtils/grayscale/grayscaleDithering\";\nexport { renderPixelDataToImage } from \"./api/customLockScreenUtils/grayscale/pixelDataRenderer\";\n\n// Custom Lock Screen Utilities - Screen Specs\nexport type {\n CLSSupportedDeviceModelId,\n ScreenSpecs,\n} from \"./api/customLockScreenUtils/screenSpecs\";\nexport {\n getScreenSpecs,\n getScreenVisibleAreaDimensions,\n isCustomLockScreenSupported,\n} from \"./api/customLockScreenUtils/screenSpecs\";\n\n// Custom Lock Screen Utilities - Types\nexport type {\n CenteredResult,\n DitheringAlgorithm,\n ImageDimensions,\n ProcessImageArgs,\n ProcessorResult,\n RenderPixelDataToImageArgs,\n RenderPixelDataToImageResult,\n} from \"./api/customLockScreenUtils/types\";\nexport {\n ImageCropError,\n ImageResizeError,\n ImageSizeLoadingError,\n} from \"./api/customLockScreenUtils/types\";\nexport {\n CustomLockScreenDeviceInternalErrorDAError,\n DeviceInRecoveryModeDAError,\n type DownloadCommandsDAError,\n InvalidCustomLockScreenImageDataDAError,\n InvalidCustomLockScreenStateDAError,\n NoCustomLockScreenImageDAError,\n type RemoveCommandDAError,\n type UploadCommandsDAError,\n} from \"./api/device-action/customLockScreenDeviceActionErrors\";\n\n// Device Actions\nexport { DownloadCustomLockScreenDeviceAction } from \"./api/device-action/DownloadCustomLockScreen/DownloadCustomLockScreenDeviceAction\";\nexport type {\n DownloadCustomLockScreenDAError,\n DownloadCustomLockScreenDAInput,\n DownloadCustomLockScreenDAIntermediateValue,\n DownloadCustomLockScreenDAOutput,\n DownloadCustomLockScreenDARequiredInteraction,\n DownloadCustomLockScreenDAState,\n} from \"./api/device-action/DownloadCustomLockScreen/types\";\nexport { GetCustomLockScreenInfoDeviceAction } from \"./api/device-action/GetCustomLockScreenInfo/GetCustomLockScreenInfoDeviceAction\";\nexport type {\n GetCustomLockScreenInfoDAError,\n GetCustomLockScreenInfoDAInput,\n GetCustomLockScreenInfoDAIntermediateValue,\n GetCustomLockScreenInfoDAOutput,\n GetCustomLockScreenInfoDARequiredInteraction,\n GetCustomLockScreenInfoDAState,\n} from \"./api/device-action/GetCustomLockScreenInfo/types\";\nexport { BackupDeviceAction } from \"./api/device-action/OsUpdate/Backup/BackupDeviceAction\";\nexport type {\n BackupDAError,\n BackupDAInput,\n BackupDAIntermediateValue,\n BackupDAOutput,\n BackupDARequiredInteraction,\n BackupDAState,\n BackupSteps,\n} from \"./api/device-action/OsUpdate/Backup/types\";\nexport { RemoveCustomLockScreenDeviceAction } from \"./api/device-action/RemoveCustomLockScreen/RemoveCustomLockScreenDeviceAction\";\nexport type {\n RemoveCustomLockScreenDAError,\n RemoveCustomLockScreenDAInput,\n RemoveCustomLockScreenDAIntermediateValue,\n RemoveCustomLockScreenDAOutput,\n RemoveCustomLockScreenDARequiredInteraction,\n RemoveCustomLockScreenDAState,\n} from \"./api/device-action/RemoveCustomLockScreen/types\";\nexport type {\n UploadCustomLockScreenDAError,\n UploadCustomLockScreenDAInput,\n UploadCustomLockScreenDAIntermediateValue,\n UploadCustomLockScreenDAOutput,\n UploadCustomLockScreenDARequiredInteraction,\n UploadCustomLockScreenDAState,\n} from \"./api/device-action/UploadCustomLockScreen/types\";\nexport { UploadCustomLockScreenDeviceAction } from \"./api/device-action/UploadCustomLockScreen/UploadCustomLockScreenDeviceAction\";\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kzCAAAE,EAAAF,GAEA,IAAAG,EAAsC,mEAEtCC,EAAqC,kEAIrCC,EAAkC,uDAClCC,EAAsC,oDAItCC,EAAmD,oEACnDC,EAAuC,mEAOvCC,EAIO,mDAYPC,EAIO,6CACPC,EASO,kEAGPC,EAAqD,6FASrDC,EAAoD,2FASpDC,EAAmC,kEAUnCC,EAAmD,yFAiBnDC,EAAmD",
6
+ "names": ["index_exports", "__export", "__toCommonJS", "import_decodeImageFromDevice", "import_encodeImageForDevice", "import_canvasUtils", "import_imageFit", "import_grayscaleDithering", "import_pixelDataRenderer", "import_screenSpecs", "import_types", "import_customLockScreenDeviceActionErrors", "import_DownloadCustomLockScreenDeviceAction", "import_GetCustomLockScreenInfoDeviceAction", "import_BackupDeviceAction", "import_RemoveCustomLockScreenDeviceAction", "import_UploadCustomLockScreenDeviceAction"]
7
7
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@ledgerhq/signer-utils": "^1.1.2",
3
+ "@ledgerhq/signer-utils": "^1.2.0",
4
4
  "pako": "^2.1.0",
5
5
  "purify-ts": "catalog:",
6
6
  "xstate": "catalog:"
@@ -56,5 +56,5 @@
56
56
  "watch:builds": "pnpm ldmk-tool watch --entryPoints src/index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
57
57
  "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\""
58
58
  },
59
- "version": "0.2.0"
59
+ "version": "0.3.0"
60
60
  }
@@ -0,0 +1,2 @@
1
+ import{bufferToHexaString as s,DeviceModelId as i,UserInteractionRequired as l,XStateDeviceAction as d}from"@ledgerhq/device-management-kit";import{Left as k,Right as g}from"purify-ts";import{assign as a,fromPromise as o,setup as S}from"xstate";import{DeviceBackupStorage as m}from"../../../device-action/OsUpdate/Backup/Storage/DeviceBackupStorage";import{backupAppsStorage as v}from"../../../device-action/OsUpdate/Backup/Substeps/BackupAppsStorage";import{downloadCustomLockScreenDevice as D}from"../../../device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen";import{getLanguageId as A}from"../../../device-action/OsUpdate/Backup/Substeps/GetLanguageId";import{listInstalledApps as B}from"../../../device-action/OsUpdate/Backup/Substeps/ListInstalledApps";import{lookForBackup as E}from"../../../device-action/OsUpdate/Backup/Substeps/LookForBackup";import{saveBackup as I}from"../../../device-action/OsUpdate/Backup/Substeps/SaveBackup";import{BackupSteps as n}from"../../../device-action/OsUpdate/Backup/types";class T extends d{makeStateMachine(r){const{storage:u}=this.input,c=new m(u);return S({types:{input:{},output:{},context:{}},actors:{lookForBackup:o(E(c)),getLanguageId:o(A(r)),listInstalledApps:B(r,this.input.unlockTimeout),downloadCustomLockScreen:D(r,this.input.unlockTimeout,!0),backupAppsStorage:o(v(r,this.getLoggerFactory(r))),saveBackup:o(I(c))},guards:{hasBackup:({context:e})=>e._internalState.backupAlreadyExist===!0,isDeviceOnboarded:({context:e})=>e.input.isDeviceOnboarded,isCustomLockScreenFeatureSupported:()=>[i.APEX,i.FLEX,i.STAX].includes(r.getDeviceModel().id),hasError:({context:e})=>e._internalState.error!==null},actions:{assignErrorFromEvent:a({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"BackupDeviceAction",initial:"LookForBackup",context:({input:e})=>({input:{isDeviceOnboarded:e.isDeviceOnboarded,deviceId:e.deviceId,storage:e.storage,unlockTimeout:e.unlockTimeout},intermediateValue:{requiredUserInteraction:l.None,step:n.Idle},_internalState:{error:null,languageId:void 0,installedApps:[],backupApps:[],clsHexImage:void 0,backupAlreadyExist:!1}}),states:{LookForBackup:{invoke:{src:"lookForBackup",input:({context:e})=>({deviceId:e.input.deviceId}),onDone:{actions:a({_internalState:e=>e.event.output.caseOf({Left:t=>({...e.context._internalState,error:t}),Right:t=>({...e.context._internalState,backupAlreadyExist:t})})}),target:"CheckIfBackupExist"},onError:{actions:"assignErrorFromEvent",target:"Error"}}},CheckIfBackupExist:{always:[{guard:"hasError",target:"Error"},{guard:"hasBackup",target:"Success"},{target:"GetLanguage"}]},GetLanguage:{entry:a({intermediateValue:e=>({...e.context.intermediateValue,step:n.GetLanguage})}),invoke:{src:"getLanguageId",onDone:{actions:a({_internalState:e=>e.event.output.caseOf({Left:t=>({...e.context._internalState,error:t}),Right:t=>({...e.context._internalState,languageId:t})})}),target:"CheckIfDeviceIsOnboarded"},onError:{actions:"assignErrorFromEvent",target:"Error"}}},CheckIfDeviceIsOnboarded:{always:[{guard:"hasError",target:"Error"},{guard:"isDeviceOnboarded",target:"ListInstalledApps"},{target:"SaveBackup"}]},ListInstalledApps:{entry:a({intermediateValue:e=>({...e.context.intermediateValue,step:n.ListInstalledApps})}),invoke:{src:"listInstalledApps",input:({context:e})=>({unlockTimeout:e.input.unlockTimeout}),onSnapshot:{actions:a({intermediateValue:e=>({...e.event.snapshot.context.intermediateValue,step:e.context.intermediateValue.step})})},onDone:{actions:a({_internalState:e=>e.event.output.caseOf({Left:t=>({...e.context._internalState,error:t}),Right:t=>({...e.context._internalState,installedApps:t.installedApps.filter(p=>p.name!=="")})})}),target:"BackupAppsStorage"},onError:{actions:"assignErrorFromEvent",target:"Error"}}},BackupAppsStorage:{always:{guard:"hasError",target:"Error"},entry:a({intermediateValue:e=>({...e.context.intermediateValue,step:n.BackupAppsStorage})}),invoke:{src:"backupAppsStorage",input:({context:e})=>({installedApps:e._internalState.installedApps}),onDone:{actions:a({_internalState:e=>e.event.output.caseOf({Left:t=>({...e.context._internalState,error:t}),Right:t=>({...e.context._internalState,backupApps:t})})}),target:"CheckIfDeviceSupportCustomLockScreenFeature"},onError:{actions:"assignErrorFromEvent",target:"Error"}}},CheckIfDeviceSupportCustomLockScreenFeature:{always:[{guard:"hasError",target:"Error"},{guard:"isCustomLockScreenFeatureSupported",target:"DownloadCustomLockScreen"},{target:"SaveBackup"}]},DownloadCustomLockScreen:{entry:a({intermediateValue:e=>({...e.context.intermediateValue,step:n.DownloadCustomLockScreen})}),invoke:{src:"downloadCustomLockScreen",input:({context:e})=>({unlockTimeout:e.input.unlockTimeout,allowedEmpty:!0}),onSnapshot:{actions:a({intermediateValue:e=>({...e.event.snapshot.context.intermediateValue,step:e.context.intermediateValue.step})})},onDone:{actions:a({_internalState:e=>e.event.output.caseOf({Left:t=>({...e.context._internalState,error:t}),Right:t=>({...e.context._internalState,clsHexImage:"imageData"in t&&t.imageData.length>0?s(t.imageData,!0):void 0})})}),target:"SaveBackup"},onError:{actions:"assignErrorFromEvent",target:"Error"}}},SaveBackup:{always:{guard:"hasError",target:"Error"},entry:a({intermediateValue:e=>({...e.context.intermediateValue,step:n.SaveBackup})}),invoke:{src:"saveBackup",input:({context:e})=>({deviceId:e.input.deviceId,backup:{languageId:e._internalState.languageId,installedApps:e._internalState.backupApps,clsHexImage:e._internalState.clsHexImage,createdAt:new Date}}),onDone:{actions:a({_internalState:e=>e.event.output.caseOf({Left:t=>({...e.context._internalState,error:t}),Right:()=>({...e.context._internalState})})}),target:"CheckSaveBackup"},onError:{actions:"assignErrorFromEvent",target:"Error"}}},CheckSaveBackup:{always:[{guard:"hasError",target:"Error"},{target:"Success"}]},Success:{type:"final"},Error:{type:"final"}},output:({context:e})=>e._internalState.error!==null?k(e._internalState.error):g(void 0)})}}export{T as BackupDeviceAction};
2
+ //# sourceMappingURL=BackupDeviceAction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/device-action/OsUpdate/Backup/BackupDeviceAction.ts"],
4
+ "sourcesContent": ["import {\n bufferToHexaString,\n type DeviceActionStateMachine,\n DeviceModelId,\n type InternalApi,\n type StateMachineTypes,\n UserInteractionRequired,\n XStateDeviceAction,\n} from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport { DeviceBackupStorage } from \"@api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage\";\nimport { backupAppsStorage } from \"@api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage\";\nimport { downloadCustomLockScreenDevice } from \"@api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen\";\nimport { getLanguageId } from \"@api/device-action/OsUpdate/Backup/Substeps/GetLanguageId\";\nimport { listInstalledApps } from \"@api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps\";\nimport { lookForBackup } from \"@api/device-action/OsUpdate/Backup/Substeps/LookForBackup\";\nimport { saveBackup } from \"@api/device-action/OsUpdate/Backup/Substeps/SaveBackup\";\nimport {\n type BackupDAError,\n type BackupDAInput,\n type BackupDAIntermediateValue,\n type BackupDAInternalState,\n type BackupDAOutput,\n BackupSteps,\n} from \"@api/device-action/OsUpdate/Backup/types\";\n\nexport class BackupDeviceAction extends XStateDeviceAction<\n BackupDAOutput,\n BackupDAInput,\n BackupDAError,\n BackupDAIntermediateValue,\n BackupDAInternalState\n> {\n protected override makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n BackupDAOutput,\n BackupDAInput,\n BackupDAError,\n BackupDAIntermediateValue,\n BackupDAInternalState\n > {\n type types = StateMachineTypes<\n BackupDAOutput,\n BackupDAInput,\n BackupDAError,\n BackupDAIntermediateValue,\n BackupDAInternalState\n >;\n\n const { storage } = this.input;\n const deviceBackupStorage = new DeviceBackupStorage(storage);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n output: {} as types[\"output\"],\n context: {} as types[\"context\"],\n } as types,\n actors: {\n lookForBackup: fromPromise(lookForBackup(deviceBackupStorage)),\n getLanguageId: fromPromise(getLanguageId(internalAPI)),\n listInstalledApps: listInstalledApps(\n internalAPI,\n this.input.unlockTimeout,\n ),\n downloadCustomLockScreen: downloadCustomLockScreenDevice(\n internalAPI,\n this.input.unlockTimeout,\n true,\n ),\n backupAppsStorage: fromPromise(\n backupAppsStorage(internalAPI, this.getLoggerFactory(internalAPI)),\n ),\n saveBackup: fromPromise(saveBackup(deviceBackupStorage)),\n },\n guards: {\n hasBackup: ({ context }) =>\n context._internalState.backupAlreadyExist === true,\n isDeviceOnboarded: ({ context }) => context.input.isDeviceOnboarded,\n isCustomLockScreenFeatureSupported: () =>\n [DeviceModelId.APEX, DeviceModelId.FLEX, DeviceModelId.STAX].includes(\n internalAPI.getDeviceModel().id,\n ),\n hasError: ({ context }) => context._internalState.error !== null,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: should never happen\n }),\n }),\n },\n }).createMachine({\n id: \"BackupDeviceAction\",\n initial: \"LookForBackup\",\n context: ({ input }) => ({\n input: {\n isDeviceOnboarded: input.isDeviceOnboarded,\n deviceId: input.deviceId,\n storage: input.storage,\n unlockTimeout: input.unlockTimeout,\n },\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: BackupSteps.Idle,\n },\n _internalState: {\n error: null,\n languageId: undefined,\n installedApps: [],\n backupApps: [],\n clsHexImage: undefined,\n backupAlreadyExist: false,\n },\n }),\n states: {\n LookForBackup: {\n invoke: {\n src: \"lookForBackup\",\n input: ({ context }) => ({\n deviceId: context.input.deviceId,\n }),\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<BackupDAInternalState>({\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n Right: (backupAlreadyExist) => ({\n ..._.context._internalState,\n backupAlreadyExist,\n }),\n });\n },\n }),\n target: \"CheckIfBackupExist\",\n },\n onError: {\n actions: \"assignErrorFromEvent\",\n target: \"Error\",\n },\n },\n },\n CheckIfBackupExist: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n guard: \"hasBackup\",\n target: \"Success\",\n },\n {\n target: \"GetLanguage\",\n },\n ],\n },\n GetLanguage: {\n entry: assign({\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n step: BackupSteps.GetLanguage,\n }),\n }),\n invoke: {\n src: \"getLanguageId\",\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<BackupDAInternalState>({\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n Right: (languageId) => ({\n ..._.context._internalState,\n languageId,\n }),\n });\n },\n }),\n target: \"CheckIfDeviceIsOnboarded\",\n },\n onError: {\n actions: \"assignErrorFromEvent\",\n target: \"Error\",\n },\n },\n },\n CheckIfDeviceIsOnboarded: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n guard: \"isDeviceOnboarded\",\n target: \"ListInstalledApps\",\n },\n {\n target: \"SaveBackup\",\n },\n ],\n },\n ListInstalledApps: {\n entry: assign({\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n step: BackupSteps.ListInstalledApps,\n }),\n }),\n invoke: {\n src: \"listInstalledApps\",\n input: ({ context }) => ({\n unlockTimeout: context.input.unlockTimeout,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => ({\n ..._.event.snapshot.context.intermediateValue,\n step: _.context.intermediateValue.step,\n }),\n }),\n },\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<BackupDAInternalState>({\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n Right: (output) => ({\n ..._.context._internalState,\n installedApps: output.installedApps.filter(\n (app) => app.name !== \"\",\n ),\n }),\n });\n },\n }),\n target: \"BackupAppsStorage\",\n },\n onError: {\n actions: \"assignErrorFromEvent\",\n target: \"Error\",\n },\n },\n },\n BackupAppsStorage: {\n always: {\n guard: \"hasError\",\n target: \"Error\",\n },\n entry: assign({\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n step: BackupSteps.BackupAppsStorage,\n }),\n }),\n invoke: {\n src: \"backupAppsStorage\",\n input: ({ context }) => ({\n installedApps: context._internalState.installedApps,\n }),\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<BackupDAInternalState>({\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n Right: (backupApps) => ({\n ..._.context._internalState,\n backupApps,\n }),\n });\n },\n }),\n target: \"CheckIfDeviceSupportCustomLockScreenFeature\",\n },\n onError: {\n actions: \"assignErrorFromEvent\",\n target: \"Error\",\n },\n },\n },\n CheckIfDeviceSupportCustomLockScreenFeature: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n guard: \"isCustomLockScreenFeatureSupported\",\n target: \"DownloadCustomLockScreen\",\n },\n {\n target: \"SaveBackup\",\n },\n ],\n },\n DownloadCustomLockScreen: {\n entry: assign({\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n step: BackupSteps.DownloadCustomLockScreen,\n }),\n }),\n invoke: {\n src: \"downloadCustomLockScreen\",\n input: ({ context }) => ({\n unlockTimeout: context.input.unlockTimeout,\n allowedEmpty: true,\n }),\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) => ({\n ..._.event.snapshot.context.intermediateValue,\n step: _.context.intermediateValue.step,\n }),\n }),\n },\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<BackupDAInternalState>({\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n Right: (output) => ({\n ..._.context._internalState,\n clsHexImage:\n \"imageData\" in output && output.imageData.length > 0\n ? bufferToHexaString(output.imageData, true)\n : undefined,\n }),\n });\n },\n }),\n target: \"SaveBackup\",\n },\n onError: {\n actions: \"assignErrorFromEvent\",\n target: \"Error\",\n },\n },\n },\n SaveBackup: {\n always: {\n guard: \"hasError\",\n target: \"Error\",\n },\n entry: assign({\n intermediateValue: (_) => ({\n ..._.context.intermediateValue,\n step: BackupSteps.SaveBackup,\n }),\n }),\n invoke: {\n src: \"saveBackup\",\n input: ({ context }) => ({\n deviceId: context.input.deviceId,\n backup: {\n languageId: context._internalState.languageId,\n installedApps: context._internalState.backupApps,\n clsHexImage: context._internalState.clsHexImage,\n createdAt: new Date(),\n },\n }),\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<BackupDAInternalState>({\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n Right: () => ({\n ..._.context._internalState,\n }),\n });\n },\n }),\n target: \"CheckSaveBackup\",\n },\n onError: {\n actions: \"assignErrorFromEvent\",\n target: \"Error\",\n },\n },\n },\n CheckSaveBackup: {\n always: [\n {\n guard: \"hasError\",\n target: \"Error\",\n },\n {\n target: \"Success\",\n },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: ({ context }) => {\n if (context._internalState.error !== null) {\n return Left(context._internalState.error);\n }\n return Right(undefined);\n },\n });\n }\n}\n"],
5
+ "mappings": "AAAA,OACE,sBAAAA,EAEA,iBAAAC,EAGA,2BAAAC,EACA,sBAAAC,MACK,kCACP,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAC5B,OAAS,UAAAC,EAAQ,eAAAC,EAAa,SAAAC,MAAa,SAE3C,OAAS,uBAAAC,MAA2B,iEACpC,OAAS,qBAAAC,MAAyB,gEAClC,OAAS,kCAAAC,MAAsC,uEAC/C,OAAS,iBAAAC,MAAqB,4DAC9B,OAAS,qBAAAC,MAAyB,gEAClC,OAAS,iBAAAC,MAAqB,4DAC9B,OAAS,cAAAC,MAAkB,yDAC3B,OAME,eAAAC,MACK,2CAEA,MAAMC,UAA2Bd,CAMtC,CACmB,iBACjBe,EAOA,CASA,KAAM,CAAE,QAAAC,CAAQ,EAAI,KAAK,MACnBC,EAAsB,IAAIX,EAAoBU,CAAO,EAE3D,OAAOX,EAAM,CACX,MAAO,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EACF,CAAC,CAEL,CAAC,EACD,OAAQ,iBACV,EACA,QAAS,CACP,QAAS,uBACT,OAAQ,OACV,CACF,CACF,EACA,gBAAiB,CACf,OAAQ,CACN,CACE,MAAO,WACP,OAAQ,OACV,EACA,CACE,OAAQ,SACV,CACF,CACF,EACA,QAAS,CACP,KAAM,OACR,EACA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAAQ,CAAC,CAAE,QAAAD,CAAQ,IACbA,EAAQ,eAAe,QAAU,KAC5BjB,EAAKiB,EAAQ,eAAe,KAAK,EAEnChB,EAAM,MAAS,CAE1B,CAAC,CACH,CACF",
6
+ "names": ["bufferToHexaString", "DeviceModelId", "UserInteractionRequired", "XStateDeviceAction", "Left", "Right", "assign", "fromPromise", "setup", "DeviceBackupStorage", "backupAppsStorage", "downloadCustomLockScreenDevice", "getLanguageId", "listInstalledApps", "lookForBackup", "saveBackup", "BackupSteps", "BackupDeviceAction", "internalAPI", "storage", "deviceBackupStorage", "context", "_", "input", "error", "backupAlreadyExist", "languageId", "output", "app", "backupApps"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{DeviceActionStatus as f,DeviceModelId as I,UnknownDAError as E,UserInteractionRequired as C}from"@ledgerhq/device-management-kit";import{Left as v,Right as k}from"purify-ts";import{assign as b,createMachine as M}from"xstate";import{makeDeviceActionInternalApiMock as n}from"../../../device-action/__test-utils__/makeInternalApi";import{testDeviceActionStates as p}from"../../../device-action/__test-utils__/testDeviceActionStates";import{BackupDeviceAction as G}from"../../../device-action/OsUpdate/Backup/BackupDeviceAction";import{BackupAppsStorageError as T,GetLanguageIdError as U,LookForBackupError as N,SaveBackupError as O}from"../../../device-action/OsUpdate/Backup/BackupDeviceActionErrors";import{backupAppsStorage as h}from"../../../device-action/OsUpdate/Backup/Substeps/BackupAppsStorage";import{downloadCustomLockScreenDevice as y}from"../../../device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen";import{getLanguageId as P}from"../../../device-action/OsUpdate/Backup/Substeps/GetLanguageId";import{listInstalledApps as R}from"../../../device-action/OsUpdate/Backup/Substeps/ListInstalledApps";import{lookForBackup as g}from"../../../device-action/OsUpdate/Backup/Substeps/LookForBackup";import{saveBackup as V}from"../../../device-action/OsUpdate/Backup/Substeps/SaveBackup";import{BackupSteps as e}from"../../../device-action/OsUpdate/Backup/types";vi.mock("@api/device-action/OsUpdate/Backup/Substeps/LookForBackup");vi.mock("@api/device-action/OsUpdate/Backup/Substeps/GetLanguageId");vi.mock("@api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps");vi.mock("@api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen");vi.mock("@api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage");vi.mock("@api/device-action/OsUpdate/Backup/Substeps/SaveBackup");const o=i=>({status:f.Pending,intermediateValue:{requiredUserInteraction:C.None,step:i}}),D=()=>({status:f.Completed,output:void 0}),m=i=>({status:f.Error,error:i}),w=i=>M({initial:"ready",states:{ready:{after:{0:"done"},entry:b({intermediateValue:()=>({requiredUserInteraction:C.None})})},done:{type:"final"}},output:()=>i}),F="device123",_={getItem:vi.fn(),setItem:vi.fn(),removeItem:vi.fn()};describe("BackupDeviceAction",()=>{const{getDeviceModel:i}=n();beforeEach(()=>{vi.resetAllMocks()});const u=()=>vi.mocked(g).mockReturnValue(()=>Promise.resolve(k(!1))),d=()=>vi.mocked(P).mockReturnValue(()=>Promise.resolve(k(1))),l=()=>vi.mocked(R).mockReturnValue(w(k({installedApps:[{name:"TestApp",hash:"abc",hash_code_data:"code",flags:0}]}))),S=()=>vi.mocked(h).mockReturnValue(()=>Promise.resolve(k([{appName:"TestApp",data:"appData"}]))),A=()=>vi.mocked(y).mockReturnValue(w(k({imageData:new Uint8Array([1,2]),imageHash:"0102"}))),L=()=>vi.mocked(V).mockReturnValue(()=>Promise.resolve(k(void 0))),B=()=>i.mockReturnValue({id:I.STAX}),x=()=>i.mockReturnValue({id:I.NANO_X}),c=(r=!0)=>new G({input:{isDeviceOnboarded:r,deviceId:F,storage:_,unlockTimeout:3e4}});describe("Success",()=>{it("should complete the full backup flow for a CLS-supported device",()=>new Promise((r,a)=>{u(),d(),l(),S(),A(),L(),B();const t=[o(e.Idle),o(e.GetLanguage),o(e.ListInstalledApps),o(e.ListInstalledApps),o(e.BackupAppsStorage),o(e.DownloadCustomLockScreen),o(e.DownloadCustomLockScreen),o(e.SaveBackup),D()];p(c(),t,n(),{onDone:r,onError:a})})),it("should complete immediately when a valid backup already exists",()=>new Promise((r,a)=>{vi.mocked(g).mockReturnValue(()=>Promise.resolve(k(!0)));const t=[o(e.Idle),D()];p(c(),t,n(),{onDone:r,onError:a})})),it("should skip ListInstalledApps and DownloadCustomLockScreen when device is unseeded",()=>new Promise((r,a)=>{u(),d(),l(),S(),A(),L();const t=[o(e.Idle),o(e.GetLanguage),o(e.SaveBackup),D()];p(c(!1),t,n(),{onDone:r,onError:a})})),it("should skip DownloadCustomLockScreen for devices that do not support CLS",()=>new Promise((r,a)=>{u(),d(),l(),S(),A(),L(),x();const t=[o(e.Idle),o(e.GetLanguage),o(e.ListInstalledApps),o(e.ListInstalledApps),o(e.BackupAppsStorage),o(e.SaveBackup),D()];p(c(),t,n(),{onDone:r,onError:a})}))}),describe("Error",()=>{it("should go to Error when lookForBackup returns Left",()=>new Promise((r,a)=>{const t=new N(new Error("data storage failed"));vi.mocked(g).mockReturnValue(()=>Promise.resolve(v(t)));const s=[o(e.Idle),m(t)];p(c(),s,n(),{onDone:r,onError:a})})),it("should go to Error when lookForBackup promise rejects",()=>new Promise((r,a)=>{const t=new Error("unexpected crash");vi.mocked(g).mockReturnValue(()=>Promise.reject(t));const s=[o(e.Idle),m(t)];p(c(),s,n(),{onDone:r,onError:a})})),it("should go to Error when getLanguageId returns Left",()=>new Promise((r,a)=>{u(),l();const t=new U(new Error("command failed"));vi.mocked(P).mockReturnValue(()=>Promise.resolve(v(t)));const s=[o(e.Idle),o(e.GetLanguage),m(t)];p(c(),s,n(),{onDone:r,onError:a})})),it("should go to Error when listInstalledApps returns Left",()=>new Promise((r,a)=>{u(),d();const t=new E("listInstalledApps failed");vi.mocked(R).mockReturnValue(w(v(t)));const s=[o(e.Idle),o(e.GetLanguage),o(e.ListInstalledApps),o(e.ListInstalledApps),m(t)];p(c(),s,n(),{onDone:r,onError:a})})),it("should go to Error when backupAppsStorage returns Left",()=>new Promise((r,a)=>{u(),d(),l(),A();const t=new T(new Error("storage failed"));vi.mocked(h).mockReturnValue(()=>Promise.resolve(v(t)));const s=[o(e.Idle),o(e.GetLanguage),o(e.ListInstalledApps),o(e.ListInstalledApps),o(e.BackupAppsStorage),m(t)];p(c(),s,n(),{onDone:r,onError:a})})),it("should go to Error when downloadCustomLockScreenDevice returns Left",()=>new Promise((r,a)=>{u(),d(),l(),S(),B();const t=new E("downloadCLS failed");vi.mocked(y).mockReturnValue(w(v(t)));const s=[o(e.Idle),o(e.GetLanguage),o(e.ListInstalledApps),o(e.ListInstalledApps),o(e.BackupAppsStorage),o(e.DownloadCustomLockScreen),o(e.DownloadCustomLockScreen),m(t)];p(c(),s,n(),{onDone:r,onError:a})})),it("should go to Error when saveBackup returns Left",()=>new Promise((r,a)=>{u(),d(),l(),S(),A(),B();const t=new O(new Error("save failed"));vi.mocked(V).mockReturnValue(()=>Promise.resolve(v(t)));const s=[o(e.Idle),o(e.GetLanguage),o(e.ListInstalledApps),o(e.ListInstalledApps),o(e.BackupAppsStorage),o(e.DownloadCustomLockScreen),o(e.DownloadCustomLockScreen),o(e.SaveBackup),m(t)];p(c(),s,n(),{onDone:r,onError:a})}))})});
2
+ //# sourceMappingURL=BackupDeviceAction.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/device-action/OsUpdate/Backup/BackupDeviceAction.test.ts"],
4
+ "sourcesContent": ["import {\n DeviceActionStatus,\n DeviceModelId,\n type TransportDeviceModel,\n UnknownDAError,\n UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\nimport { type KeyValueStorage } from \"@ledgerhq/device-management-kit\";\nimport { type Either, Left, Right } from \"purify-ts\";\nimport { assign, createMachine } from \"xstate\";\n\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { testDeviceActionStates } from \"@api/device-action/__test-utils__/testDeviceActionStates\";\nimport { BackupDeviceAction } from \"@api/device-action/OsUpdate/Backup/BackupDeviceAction\";\nimport {\n BackupAppsStorageError,\n GetLanguageIdError,\n LookForBackupError,\n SaveBackupError,\n} from \"@api/device-action/OsUpdate/Backup/BackupDeviceActionErrors\";\nimport { backupAppsStorage } from \"@api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage\";\nimport { downloadCustomLockScreenDevice } from \"@api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen\";\nimport { getLanguageId } from \"@api/device-action/OsUpdate/Backup/Substeps/GetLanguageId\";\nimport { listInstalledApps } from \"@api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps\";\nimport { lookForBackup } from \"@api/device-action/OsUpdate/Backup/Substeps/LookForBackup\";\nimport { saveBackup } from \"@api/device-action/OsUpdate/Backup/Substeps/SaveBackup\";\nimport {\n type BackupDAError,\n type BackupDAState,\n BackupSteps,\n} from \"@api/device-action/OsUpdate/Backup/types\";\n\nvi.mock(\"@api/device-action/OsUpdate/Backup/Substeps/LookForBackup\");\nvi.mock(\"@api/device-action/OsUpdate/Backup/Substeps/GetLanguageId\");\nvi.mock(\"@api/device-action/OsUpdate/Backup/Substeps/ListInstalledApps\");\nvi.mock(\"@api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen\");\nvi.mock(\"@api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage\");\nvi.mock(\"@api/device-action/OsUpdate/Backup/Substeps/SaveBackup\");\n\n// \u2500\u2500\u2500 State builders \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst pendingState = (step: BackupSteps): BackupDAState => ({\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step,\n },\n});\n\nconst completedState = (): BackupDAState => ({\n status: DeviceActionStatus.Completed,\n output: undefined,\n});\n\nconst errorState = (error: BackupDAError): BackupDAState => ({\n status: DeviceActionStatus.Error,\n error,\n});\n\n// \u2500\u2500\u2500 Mock actor factory \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n//\n// Creates a minimal XState machine that immediately completes (after 0 ms) with\n// the given Either output. The machine exposes the `intermediateValue` shape\n// required by the parent's `onSnapshot` handler.\n\nconst createMockActorMachine = (output: Either<unknown, unknown>) =>\n createMachine({\n initial: \"ready\",\n states: {\n ready: {\n after: { 0: \"done\" },\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n }),\n }),\n },\n done: { type: \"final\" },\n },\n output: () => output,\n });\n\n// \u2500\u2500\u2500 Fixtures \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst DEVICE_ID = \"device123\";\n\nconst storage: KeyValueStorage = {\n getItem: vi.fn(),\n setItem: vi.fn(),\n removeItem: vi.fn(),\n};\n\n// \u2500\u2500\u2500 Tests \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ndescribe(\"BackupDeviceAction\", () => {\n const { getDeviceModel: getDeviceModelMock } =\n makeDeviceActionInternalApiMock();\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n // \u2500\u2500\u2500 Setup helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n const setupNoExistingBackup = () =>\n vi\n .mocked(lookForBackup)\n .mockReturnValue(() => Promise.resolve(Right(false)));\n\n const setupGetLanguageId = () =>\n vi.mocked(getLanguageId).mockReturnValue(() => Promise.resolve(Right(1)));\n\n const setupListInstalledApps = () =>\n vi.mocked(listInstalledApps).mockReturnValue(\n createMockActorMachine(\n Right({\n installedApps: [\n { name: \"TestApp\", hash: \"abc\", hash_code_data: \"code\", flags: 0 },\n ],\n }),\n ) as unknown as ReturnType<typeof listInstalledApps>,\n );\n\n const setupBackupAppsStorage = () =>\n vi\n .mocked(backupAppsStorage)\n .mockReturnValue(() =>\n Promise.resolve(Right([{ appName: \"TestApp\", data: \"appData\" }])),\n );\n\n const setupDownloadCls = () =>\n vi\n .mocked(downloadCustomLockScreenDevice)\n .mockReturnValue(\n createMockActorMachine(\n Right({ imageData: new Uint8Array([0x01, 0x02]), imageHash: \"0102\" }),\n ) as unknown as ReturnType<typeof downloadCustomLockScreenDevice>,\n );\n\n const setupSaveBackup = () =>\n vi\n .mocked(saveBackup)\n .mockReturnValue(() => Promise.resolve(Right(undefined)));\n\n const setupStaxModel = () =>\n getDeviceModelMock.mockReturnValue({\n id: DeviceModelId.STAX,\n } as TransportDeviceModel);\n\n const setupNanoXModel = () =>\n getDeviceModelMock.mockReturnValue({\n id: DeviceModelId.NANO_X,\n } as TransportDeviceModel);\n\n const makeDeviceAction = (isDeviceOnboarded = true) =>\n new BackupDeviceAction({\n input: {\n isDeviceOnboarded,\n deviceId: DEVICE_ID,\n storage,\n unlockTimeout: 30_000,\n },\n });\n\n // \u2500\u2500\u2500 Success \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n describe(\"Success\", () => {\n it(\"should complete the full backup flow for a CLS-supported device\", () =>\n new Promise<void>((resolve, reject) => {\n setupNoExistingBackup();\n setupGetLanguageId();\n setupListInstalledApps();\n setupBackupAppsStorage();\n setupDownloadCls();\n setupSaveBackup();\n setupStaxModel();\n\n // State transitions:\n // GetBackupIfExist \u2192 GetLanguage \u2192 ListInstalledApps (\u00D72: enter + onSnapshot)\n // \u2192 BackupAppsStorage \u2192 DownloadCustomLockScreen (\u00D72: enter + onSnapshot)\n // \u2192 SaveBackup \u2192 Success\n const expectedStates: BackupDAState[] = [\n pendingState(BackupSteps.Idle),\n pendingState(BackupSteps.GetLanguage),\n pendingState(BackupSteps.ListInstalledApps),\n pendingState(BackupSteps.ListInstalledApps),\n pendingState(BackupSteps.BackupAppsStorage),\n pendingState(BackupSteps.DownloadCustomLockScreen),\n pendingState(BackupSteps.DownloadCustomLockScreen),\n pendingState(BackupSteps.SaveBackup),\n completedState(),\n ];\n\n testDeviceActionStates(\n makeDeviceAction(),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n { onDone: resolve, onError: reject },\n );\n }));\n\n it(\"should complete immediately when a valid backup already exists\", () =>\n new Promise<void>((resolve, reject) => {\n vi.mocked(lookForBackup).mockReturnValue(() =>\n Promise.resolve(Right(true)),\n );\n\n // CheckIfBackupExist.hasBackup \u2192 immediately transitions to Success\n const expectedStates: BackupDAState[] = [\n pendingState(BackupSteps.Idle),\n completedState(),\n ];\n\n testDeviceActionStates(\n makeDeviceAction(),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n { onDone: resolve, onError: reject },\n );\n }));\n\n it(\"should skip ListInstalledApps and DownloadCustomLockScreen when device is unseeded\", () =>\n new Promise<void>((resolve, reject) => {\n setupNoExistingBackup();\n setupGetLanguageId();\n setupListInstalledApps(); // registered in actors but never invoked (always guard fires first)\n setupBackupAppsStorage(); // registered in actors but never invoked\n setupDownloadCls(); // registered in actors but never invoked\n setupSaveBackup();\n\n // ListInstalledApps.always isDeviceUnseeded \u2192 jumps directly to SaveBackup\n const expectedStates: BackupDAState[] = [\n pendingState(BackupSteps.Idle),\n pendingState(BackupSteps.GetLanguage),\n pendingState(BackupSteps.SaveBackup),\n completedState(),\n ];\n\n testDeviceActionStates(\n makeDeviceAction(false /* isDeviceOnboarded */),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n { onDone: resolve, onError: reject },\n );\n }));\n\n it(\"should skip DownloadCustomLockScreen for devices that do not support CLS\", () =>\n new Promise<void>((resolve, reject) => {\n setupNoExistingBackup();\n setupGetLanguageId();\n setupListInstalledApps();\n setupBackupAppsStorage();\n setupDownloadCls(); // registered in actors but never invoked (always guard fires first)\n setupSaveBackup();\n setupNanoXModel();\n\n // DownloadCustomLockScreen.always isCustomLockScreenFeatureNotSupported \u2192 SaveBackup\n const expectedStates: BackupDAState[] = [\n pendingState(BackupSteps.Idle),\n pendingState(BackupSteps.GetLanguage),\n pendingState(BackupSteps.ListInstalledApps),\n pendingState(BackupSteps.ListInstalledApps),\n pendingState(BackupSteps.BackupAppsStorage),\n pendingState(BackupSteps.SaveBackup),\n completedState(),\n ];\n\n testDeviceActionStates(\n makeDeviceAction(),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n { onDone: resolve, onError: reject },\n );\n }));\n });\n\n // \u2500\u2500\u2500 Error \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n describe(\"Error\", () => {\n it(\"should go to Error when lookForBackup returns Left\", () =>\n new Promise<void>((resolve, reject) => {\n const error = new LookForBackupError(new Error(\"data storage failed\"));\n vi.mocked(lookForBackup).mockReturnValue(() =>\n Promise.resolve(Left(error)),\n );\n\n // CheckIfBackupExist.hasError \u2192 Error\n const expectedStates: BackupDAState[] = [\n pendingState(BackupSteps.Idle),\n errorState(error),\n ];\n\n testDeviceActionStates(\n makeDeviceAction(),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n { onDone: resolve, onError: reject },\n );\n }));\n\n it(\"should go to Error when lookForBackup promise rejects\", () =>\n new Promise<void>((resolve, reject) => {\n const thrownError = new Error(\"unexpected crash\");\n vi.mocked(lookForBackup).mockReturnValue(() =>\n Promise.reject(thrownError),\n );\n\n // onError \u2192 assignErrorFromEvent \u2192 Error\n const expectedStates: BackupDAState[] = [\n pendingState(BackupSteps.Idle),\n errorState(thrownError as unknown as BackupDAError),\n ];\n\n testDeviceActionStates(\n makeDeviceAction(),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n { onDone: resolve, onError: reject },\n );\n }));\n\n it(\"should go to Error when getLanguageId returns Left\", () =>\n new Promise<void>((resolve, reject) => {\n setupNoExistingBackup();\n setupListInstalledApps(); // registered in actors but never invoked (always hasError guard fires first)\n const error = new GetLanguageIdError(new Error(\"command failed\"));\n vi.mocked(getLanguageId).mockReturnValue(() =>\n Promise.resolve(Left(error)),\n );\n\n // getLanguageId Left \u2192 ListInstalledApps.always hasError \u2192 Error\n const expectedStates: BackupDAState[] = [\n pendingState(BackupSteps.Idle),\n pendingState(BackupSteps.GetLanguage),\n errorState(error),\n ];\n\n testDeviceActionStates(\n makeDeviceAction(),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n { onDone: resolve, onError: reject },\n );\n }));\n\n it(\"should go to Error when listInstalledApps returns Left\", () =>\n new Promise<void>((resolve, reject) => {\n setupNoExistingBackup();\n setupGetLanguageId();\n const error = new UnknownDAError(\"listInstalledApps failed\");\n vi.mocked(listInstalledApps).mockReturnValue(\n createMockActorMachine(Left(error)) as unknown as ReturnType<\n typeof listInstalledApps\n >,\n );\n\n // listInstalledApps Left \u2192 BackupAppsStorage.always hasError \u2192 Error\n const expectedStates: BackupDAState[] = [\n pendingState(BackupSteps.Idle),\n pendingState(BackupSteps.GetLanguage),\n pendingState(BackupSteps.ListInstalledApps),\n pendingState(BackupSteps.ListInstalledApps),\n errorState(error),\n ];\n\n testDeviceActionStates(\n makeDeviceAction(),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n { onDone: resolve, onError: reject },\n );\n }));\n\n it(\"should go to Error when backupAppsStorage returns Left\", () =>\n new Promise<void>((resolve, reject) => {\n setupNoExistingBackup();\n setupGetLanguageId();\n setupListInstalledApps();\n setupDownloadCls(); // registered in actors but never invoked (always hasError guard fires first)\n const error = new BackupAppsStorageError(new Error(\"storage failed\"));\n vi.mocked(backupAppsStorage).mockReturnValue(() =>\n Promise.resolve(Left(error)),\n );\n\n // backupAppsStorage Left \u2192 DownloadCustomLockScreen.always hasError \u2192 Error\n const expectedStates: BackupDAState[] = [\n pendingState(BackupSteps.Idle),\n pendingState(BackupSteps.GetLanguage),\n pendingState(BackupSteps.ListInstalledApps),\n pendingState(BackupSteps.ListInstalledApps),\n pendingState(BackupSteps.BackupAppsStorage),\n errorState(error),\n ];\n\n testDeviceActionStates(\n makeDeviceAction(),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n { onDone: resolve, onError: reject },\n );\n }));\n\n it(\"should go to Error when downloadCustomLockScreenDevice returns Left\", () =>\n new Promise<void>((resolve, reject) => {\n setupNoExistingBackup();\n setupGetLanguageId();\n setupListInstalledApps();\n setupBackupAppsStorage();\n setupStaxModel();\n const error = new UnknownDAError(\"downloadCLS failed\");\n vi.mocked(downloadCustomLockScreenDevice).mockReturnValue(\n createMockActorMachine(Left(error)) as unknown as ReturnType<\n typeof downloadCustomLockScreenDevice\n >,\n );\n\n // downloadCustomLockScreen Left \u2192 SaveBackup.always hasError \u2192 Error\n const expectedStates: BackupDAState[] = [\n pendingState(BackupSteps.Idle),\n pendingState(BackupSteps.GetLanguage),\n pendingState(BackupSteps.ListInstalledApps),\n pendingState(BackupSteps.ListInstalledApps),\n pendingState(BackupSteps.BackupAppsStorage),\n pendingState(BackupSteps.DownloadCustomLockScreen),\n pendingState(BackupSteps.DownloadCustomLockScreen),\n errorState(error),\n ];\n\n testDeviceActionStates(\n makeDeviceAction(),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n { onDone: resolve, onError: reject },\n );\n }));\n\n it(\"should go to Error when saveBackup returns Left\", () =>\n new Promise<void>((resolve, reject) => {\n setupNoExistingBackup();\n setupGetLanguageId();\n setupListInstalledApps();\n setupBackupAppsStorage();\n setupDownloadCls();\n setupStaxModel();\n const error = new SaveBackupError(new Error(\"save failed\"));\n vi.mocked(saveBackup).mockReturnValue(() =>\n Promise.resolve(Left(error)),\n );\n\n // saveBackup Left \u2192 CheckSaveBackup.always hasError \u2192 Error\n const expectedStates: BackupDAState[] = [\n pendingState(BackupSteps.Idle),\n pendingState(BackupSteps.GetLanguage),\n pendingState(BackupSteps.ListInstalledApps),\n pendingState(BackupSteps.ListInstalledApps),\n pendingState(BackupSteps.BackupAppsStorage),\n pendingState(BackupSteps.DownloadCustomLockScreen),\n pendingState(BackupSteps.DownloadCustomLockScreen),\n pendingState(BackupSteps.SaveBackup),\n errorState(error),\n ];\n\n testDeviceActionStates(\n makeDeviceAction(),\n expectedStates,\n makeDeviceActionInternalApiMock(),\n { onDone: resolve, onError: reject },\n );\n }));\n });\n});\n"],
5
+ "mappings": "AAAA,OACE,sBAAAA,EACA,iBAAAC,EAEA,kBAAAC,EACA,2BAAAC,MACK,kCAEP,OAAsB,QAAAC,EAAM,SAAAC,MAAa,YACzC,OAAS,UAAAC,EAAQ,iBAAAC,MAAqB,SAEtC,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,0BAAAC,MAA8B,2DACvC,OAAS,sBAAAC,MAA0B,wDACnC,OACE,0BAAAC,EACA,sBAAAC,EACA,sBAAAC,EACA,mBAAAC,MACK,8DACP,OAAS,qBAAAC,MAAyB,gEAClC,OAAS,kCAAAC,MAAsC,uEAC/C,OAAS,iBAAAC,MAAqB,4DAC9B,OAAS,qBAAAC,MAAyB,gEAClC,OAAS,iBAAAC,MAAqB,4DAC9B,OAAS,cAAAC,MAAkB,yDAC3B,OAGE,eAAAC,MACK,2CAEP,GAAG,KAAK,2DAA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A,MAAMkB,EAAkC,CACtCtB,EAAaD,EAAY,IAAI,EAC7BC,EAAaD,EAAY,WAAW,EACpCC,EAAaD,EAAY,iBAAiB,EAC1CC,EAAaD,EAAY,iBAAiB,EAC1CC,EAAaD,EAAY,iBAAiB,EAC1CC,EAAaD,EAAY,wBAAwB,EACjDC,EAAaD,EAAY,wBAAwB,EACjDI,EAAWC,CAAK,CAClB,EAEAjB,EACE+B,EAAiB,EACjBI,EACApC,EAAgC,EAChC,CAAE,OAAQkC,EAAS,QAASC,CAAO,CACrC,CACF,CAAC,CAAC,EAEJ,GAAG,kDAAmD,IACpD,IAAI,QAAc,CAACD,EAASC,IAAW,CACrCX,EAAsB,EACtBC,EAAmB,EACnBC,EAAuB,EACvBC,EAAuB,EACvBC,EAAiB,EACjBE,EAAe,EACf,MAAMZ,EAAQ,IAAIZ,EAAgB,IAAI,MAAM,aAAa,CAAC,EAC1D,GAAG,OAAOM,CAAU,EAAE,gBAAgB,IACpC,QAAQ,QAAQhB,EAAKsB,CAAK,CAAC,CAC7B,EAGA,MAAMkB,EAAkC,CACtCtB,EAAaD,EAAY,IAAI,EAC7BC,EAAaD,EAAY,WAAW,EACpCC,EAAaD,EAAY,iBAAiB,EAC1CC,EAAaD,EAAY,iBAAiB,EAC1CC,EAAaD,EAAY,iBAAiB,EAC1CC,EAAaD,EAAY,wBAAwB,EACjDC,EAAaD,EAAY,wBAAwB,EACjDC,EAAaD,EAAY,UAAU,EACnCI,EAAWC,CAAK,CAClB,EAEAjB,EACE+B,EAAiB,EACjBI,EACApC,EAAgC,EAChC,CAAE,OAAQkC,EAAS,QAASC,CAAO,CACrC,CACF,CAAC,CAAC,CACN,CAAC,CACH,CAAC",
6
+ "names": ["DeviceActionStatus", "DeviceModelId", "UnknownDAError", "UserInteractionRequired", "Left", "Right", "assign", "createMachine", "makeDeviceActionInternalApiMock", "testDeviceActionStates", "BackupDeviceAction", "BackupAppsStorageError", "GetLanguageIdError", "LookForBackupError", "SaveBackupError", "backupAppsStorage", "downloadCustomLockScreenDevice", "getLanguageId", "listInstalledApps", "lookForBackup", "saveBackup", "BackupSteps", "pendingState", "step", "completedState", "errorState", "error", "createMockActorMachine", "output", "DEVICE_ID", "storage", "getDeviceModelMock", "setupNoExistingBackup", "setupGetLanguageId", "setupListInstalledApps", "setupBackupAppsStorage", "setupDownloadCls", "setupSaveBackup", "setupStaxModel", "setupNanoXModel", "makeDeviceAction", "isDeviceOnboarded", "resolve", "reject", "expectedStates", "thrownError"]
7
+ }
@@ -0,0 +1,2 @@
1
+ class n{_tag="LookForBackupError";originalError;constructor(r){this.originalError=r}}class a{_tag="GetLanguageIdError";originalError;constructor(r){this.originalError=r}}class e{_tag="BackupAppsStorageError";originalError;constructor(r){this.originalError=r}}class t{_tag="SaveBackupError";originalError;constructor(r){this.originalError=r}}export{e as BackupAppsStorageError,a as GetLanguageIdError,n as LookForBackupError,t as SaveBackupError};
2
+ //# sourceMappingURL=BackupDeviceActionErrors.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/device-action/OsUpdate/Backup/BackupDeviceActionErrors.ts"],
4
+ "sourcesContent": ["import { type DmkError } from \"@ledgerhq/device-management-kit\";\n\nexport class LookForBackupError implements DmkError {\n readonly _tag = \"LookForBackupError\";\n readonly originalError?: unknown;\n\n constructor(originalError?: unknown) {\n this.originalError = originalError;\n }\n}\n\nexport class GetLanguageIdError implements DmkError {\n readonly _tag = \"GetLanguageIdError\";\n readonly originalError?: unknown;\n\n constructor(originalError?: unknown) {\n this.originalError = originalError;\n }\n}\n\nexport class BackupAppsStorageError implements DmkError {\n readonly _tag = \"BackupAppsStorageError\";\n readonly originalError?: unknown;\n\n constructor(originalError?: unknown) {\n this.originalError = originalError;\n }\n}\n\nexport class SaveBackupError implements DmkError {\n readonly _tag = \"SaveBackupError\";\n readonly originalError?: unknown;\n\n constructor(originalError?: unknown) {\n this.originalError = originalError;\n }\n}\n\nexport type BackupDeviceActionErrors =\n | LookForBackupError\n | GetLanguageIdError\n | BackupAppsStorageError\n | SaveBackupError;\n"],
5
+ "mappings": "AAEO,MAAMA,CAAuC,CACzC,KAAO,qBACP,cAET,YAAYC,EAAyB,CACnC,KAAK,cAAgBA,CACvB,CACF,CAEO,MAAMC,CAAuC,CACzC,KAAO,qBACP,cAET,YAAYD,EAAyB,CACnC,KAAK,cAAgBA,CACvB,CACF,CAEO,MAAME,CAA2C,CAC7C,KAAO,yBACP,cAET,YAAYF,EAAyB,CACnC,KAAK,cAAgBA,CACvB,CACF,CAEO,MAAMG,CAAoC,CACtC,KAAO,kBACP,cAET,YAAYH,EAAyB,CACnC,KAAK,cAAgBA,CACvB,CACF",
6
+ "names": ["LookForBackupError", "originalError", "GetLanguageIdError", "BackupAppsStorageError", "SaveBackupError"]
7
+ }
@@ -0,0 +1,2 @@
1
+ class n{_tag="BackupSerializationError";originalError;constructor(r){this.originalError=r}}class i{_tag="BackupDeserializationError";originalError;constructor(r){this.originalError=r}}export{i as BackupDeserializationError,n as BackupSerializationError};
2
+ //# sourceMappingURL=BackSerializerErrors.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Storage/BackSerializerErrors.ts"],
4
+ "sourcesContent": ["import { type DmkError } from \"@ledgerhq/device-management-kit\";\n\nexport class BackupSerializationError implements DmkError {\n readonly _tag = \"BackupSerializationError\";\n readonly originalError?: unknown;\n\n constructor(originalError?: unknown) {\n this.originalError = originalError;\n }\n}\n\nexport class BackupDeserializationError implements DmkError {\n readonly _tag = \"BackupDeserializationError\";\n readonly originalError?: unknown;\n\n constructor(originalError?: unknown) {\n this.originalError = originalError;\n }\n}\n"],
5
+ "mappings": "AAEO,MAAMA,CAA6C,CAC/C,KAAO,2BACP,cAET,YAAYC,EAAyB,CACnC,KAAK,cAAgBA,CACvB,CACF,CAEO,MAAMC,CAA+C,CACjD,KAAO,6BACP,cAET,YAAYD,EAAyB,CACnC,KAAK,cAAgBA,CACvB,CACF",
6
+ "names": ["BackupSerializationError", "originalError", "BackupDeserializationError"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{array as n,Codec as i,Left as o,number as p,optional as a,Right as s,string as e}from"purify-ts";import{BackupDeserializationError as c,BackupSerializationError as u}from"../../../../device-action/OsUpdate/Backup/Storage/BackSerializerErrors";const d=i.interface({languageId:a(p),installedApps:n(i.interface({appName:e,data:a(e)})),clsHexImage:a(e),createdAt:e}),k=t=>{try{return s(JSON.stringify(t))}catch(r){return o(new u(r))}},B=t=>{try{return d.decode(JSON.parse(t)).mapLeft(r=>new c(r)).map(r=>({...r,createdAt:new Date(r.createdAt)}))}catch(r){return o(new c(r))}};export{B as deserialize,k as serialize};
2
+ //# sourceMappingURL=BackupSerializer.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.ts"],
4
+ "sourcesContent": ["import {\n array,\n Codec,\n type Either,\n Left,\n number,\n optional,\n Right,\n string,\n} from \"purify-ts\";\n\nimport {\n BackupDeserializationError,\n BackupSerializationError,\n} from \"@api/device-action/OsUpdate/Backup/Storage/BackSerializerErrors\";\nimport { type Backup } from \"@api/device-action/OsUpdate/Backup/types\";\n\ntype BackupData = Omit<Backup, \"createdAt\"> & { createdAt: string };\n\nconst backupCodec: Codec<BackupData> = Codec.interface({\n languageId: optional(number),\n installedApps: array(\n Codec.interface({\n appName: string,\n data: optional(string),\n }),\n ),\n clsHexImage: optional(string),\n createdAt: string,\n});\n\nexport const serialize = (\n backup: Backup,\n): Either<BackupSerializationError, string> => {\n try {\n return Right(JSON.stringify(backup));\n } catch (error) {\n return Left(new BackupSerializationError(error));\n }\n};\n\nexport const deserialize = (\n data: string,\n): Either<BackupDeserializationError, Backup> => {\n try {\n return backupCodec\n .decode(JSON.parse(data))\n .mapLeft((error) => new BackupDeserializationError(error))\n .map((backupData) => ({\n ...backupData,\n createdAt: new Date(backupData.createdAt),\n }));\n } catch (error) {\n return Left(new BackupDeserializationError(error));\n }\n};\n"],
5
+ "mappings": "AAAA,OACE,SAAAA,EACA,SAAAC,EAEA,QAAAC,EACA,UAAAC,EACA,YAAAC,EACA,SAAAC,EACA,UAAAC,MACK,YAEP,OACE,8BAAAC,EACA,4BAAAC,MACK,kEAKP,MAAMC,EAAiCR,EAAM,UAAU,CACrD,WAAYG,EAASD,CAAM,EAC3B,cAAeH,EACbC,EAAM,UAAU,CACd,QAASK,EACT,KAAMF,EAASE,CAAM,CACvB,CAAC,CACH,EACA,YAAaF,EAASE,CAAM,EAC5B,UAAWA,CACb,CAAC,EAEYI,EACXC,GAC6C,CAC7C,GAAI,CACF,OAAON,EAAM,KAAK,UAAUM,CAAM,CAAC,CACrC,OAASC,EAAO,CACd,OAAOV,EAAK,IAAIM,EAAyBI,CAAK,CAAC,CACjD,CACF,EAEaC,EACXC,GAC+C,CAC/C,GAAI,CACF,OAAOL,EACJ,OAAO,KAAK,MAAMK,CAAI,CAAC,EACvB,QAASF,GAAU,IAAIL,EAA2BK,CAAK,CAAC,EACxD,IAAKG,IAAgB,CACpB,GAAGA,EACH,UAAW,IAAI,KAAKA,EAAW,SAAS,CAC1C,EAAE,CACN,OAASH,EAAO,CACd,OAAOV,EAAK,IAAIK,EAA2BK,CAAK,CAAC,CACnD,CACF",
6
+ "names": ["array", "Codec", "Left", "number", "optional", "Right", "string", "BackupDeserializationError", "BackupSerializationError", "backupCodec", "serialize", "backup", "error", "deserialize", "data", "backupData"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{BackupDeserializationError as s,BackupSerializationError as c}from"../../../../device-action/OsUpdate/Backup/Storage/BackSerializerErrors";import{deserialize as a,serialize as i}from"../../../../device-action/OsUpdate/Backup/Storage/BackupSerializer";describe("BackupSerializer",()=>{describe("Serialize",()=>{describe("Success",()=>{it("should serialize a backup to a JSON string",()=>{const e={languageId:1,installedApps:[],clsHexImage:void 0,createdAt:new Date},t=JSON.stringify(e),r=i(e);expect(r.isRight()).toBe(!0),expect(r.extract()).toBe(t)})}),describe("Error",()=>{it("should return a BackupSerializationError when the backup is invalid",()=>{const e={languageId:1,installedApps:[],clsHexImage:void 0,createdAt:new Date};vi.spyOn(JSON,"stringify").mockImplementationOnce(()=>{throw new Error("Invalid JSON")});const t=i(e);expect(t.isLeft()).toBe(!0),expect(t.extract()).toBeInstanceOf(c)})})}),describe("Deserialize",()=>{describe("Success",()=>{it("should deserialize a serialized backup",()=>{const e={languageId:1,installedApps:[{appName:"MyApp",data:void 0}],clsHexImage:void 0,createdAt:new Date("2024-01-01T00:00:00.000Z")},t=i(e).unsafeCoerce(),r=a(t);expect(r.isRight()).toBe(!0),expect(r.extract()).toEqual(e)})}),describe("Error",()=>{it("should return a BackupDeserializationError when the JSON is invalid",()=>{const e=a("not-valid-json{{{");expect(e.isLeft()).toBe(!0),expect(e.extract()).toBeInstanceOf(s)}),it("should return a BackupDeserializationError when the decoded shape does not match",()=>{const e=JSON.stringify({unexpected:"shape"}),t=a(e);expect(t.isLeft()).toBe(!0),expect(t.extract()).toBeInstanceOf(s)})})})});
2
+ //# sourceMappingURL=BackupSerializer.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Storage/BackupSerializer.test.ts"],
4
+ "sourcesContent": ["import {\n BackupDeserializationError,\n BackupSerializationError,\n} from \"@api/device-action/OsUpdate/Backup/Storage/BackSerializerErrors\";\nimport {\n deserialize,\n serialize,\n} from \"@api/device-action/OsUpdate/Backup/Storage/BackupSerializer\";\n\ndescribe(\"BackupSerializer\", () => {\n describe(\"Serialize\", () => {\n describe(\"Success\", () => {\n it(\"should serialize a backup to a JSON string\", () => {\n // ARRANGE\n const backup = {\n languageId: 1,\n installedApps: [],\n clsHexImage: undefined,\n createdAt: new Date(),\n };\n const expected = JSON.stringify(backup);\n\n // ACT\n const result = serialize(backup);\n\n // ASSERT\n expect(result.isRight()).toBe(true);\n expect(result.extract()).toBe(expected);\n });\n });\n\n describe(\"Error\", () => {\n it(\"should return a BackupSerializationError when the backup is invalid\", () => {\n // ARRANGE\n const backup = {\n languageId: 1,\n installedApps: [],\n clsHexImage: undefined,\n createdAt: new Date(),\n };\n vi.spyOn(JSON, \"stringify\").mockImplementationOnce(() => {\n throw new Error(\"Invalid JSON\");\n });\n\n // ACT\n const result = serialize(backup);\n\n // ASSERT\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toBeInstanceOf(BackupSerializationError);\n });\n });\n });\n\n describe(\"Deserialize\", () => {\n describe(\"Success\", () => {\n it(\"should deserialize a serialized backup\", () => {\n // ARRANGE\n const backup = {\n languageId: 1,\n installedApps: [{ appName: \"MyApp\", data: undefined }],\n clsHexImage: undefined,\n createdAt: new Date(\"2024-01-01T00:00:00.000Z\"),\n };\n const json = serialize(backup).unsafeCoerce();\n\n // ACT\n const result = deserialize(json);\n\n // ASSERT\n expect(result.isRight()).toBe(true);\n expect(result.extract()).toEqual(backup);\n });\n });\n\n describe(\"Error\", () => {\n it(\"should return a BackupDeserializationError when the JSON is invalid\", () => {\n // ACT\n const result = deserialize(\"not-valid-json{{{\");\n\n // ASSERT\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toBeInstanceOf(BackupDeserializationError);\n });\n\n it(\"should return a BackupDeserializationError when the decoded shape does not match\", () => {\n // ARRANGE\n const json = JSON.stringify({ unexpected: \"shape\" });\n\n // ACT\n const result = deserialize(json);\n\n // ASSERT\n expect(result.isLeft()).toBe(true);\n expect(result.extract()).toBeInstanceOf(BackupDeserializationError);\n });\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OACE,8BAAAA,EACA,4BAAAC,MACK,kEACP,OACE,eAAAC,EACA,aAAAC,MACK,8DAEP,SAAS,mBAAoB,IAAM,CACjC,SAAS,YAAa,IAAM,CAC1B,SAAS,UAAW,IAAM,CACxB,GAAG,6CAA8C,IAAM,CAErD,MAAMC,EAAS,CACb,WAAY,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AAC,EAED,GAAG,mFAAoF,IAAM,CAE3F,MAAMO,EAAO,KAAK,UAAU,CAAE,WAAY,OAAQ,CAAC,EAG7CD,EAASJ,EAAYK,CAAI,EAG/B,OAAOD,EAAO,OAAO,CAAC,EAAE,KAAK,EAAI,EACjC,OAAOA,EAAO,QAAQ,CAAC,EAAE,eAAeN,CAA0B,CACpE,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["BackupDeserializationError", "BackupSerializationError", "deserialize", "serialize", "backup", "expected", "result", "json"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{DMK_STORAGE_PREFIX_KEY as c}from"@ledgerhq/device-management-kit";import{EitherAsync as a}from"purify-ts";import{deserialize as p,serialize as s}from"../../../../device-action/OsUpdate/Backup/Storage/BackupSerializer";import{GetBackupError as u,SaveBackupError as n}from"../../../../device-action/OsUpdate/Backup/Storage/DeviceBackupStorageErrors";const o=`${c}-device-backup`;class B{constructor(t){this.storage=t}async getBackup(t){return a(async({liftEither:r})=>{const e=await this.storage.getItem(`${o}-${t}`);return e?r(p(e)):null}).mapLeft(r=>new u(r)).run()}async saveBackup(t,r){return a(async({liftEither:e})=>{const i=await e(s(r));await this.storage.setItem(`${o}-${t}`,i)}).mapLeft(e=>new n(e)).run()}}export{B as DeviceBackupStorage};
2
+ //# sourceMappingURL=DeviceBackupStorage.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.ts"],
4
+ "sourcesContent": ["import {\n type DeviceId,\n DMK_STORAGE_PREFIX_KEY,\n type KeyValueStorage,\n} from \"@ledgerhq/device-management-kit\";\nimport { EitherAsync } from \"purify-ts\";\nimport { type Either } from \"purify-ts/Either\";\n\nimport {\n deserialize,\n serialize,\n} from \"@api/device-action/OsUpdate/Backup/Storage/BackupSerializer\";\nimport {\n GetBackupError,\n SaveBackupError,\n} from \"@api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorageErrors\";\nimport { type Backup } from \"@api/device-action/OsUpdate/Backup/types\";\n\nconst BACKUP_STORAGE_PREFIX_KEY = `${DMK_STORAGE_PREFIX_KEY}-device-backup`;\n\nexport class DeviceBackupStorage {\n constructor(private readonly storage: KeyValueStorage) {}\n\n async getBackup(\n deviceId: DeviceId,\n ): Promise<Either<GetBackupError, Backup | null>> {\n return EitherAsync(async ({ liftEither }) => {\n const data = await this.storage.getItem(\n `${BACKUP_STORAGE_PREFIX_KEY}-${deviceId}`,\n );\n if (!data) return null;\n return liftEither(deserialize(data));\n })\n .mapLeft((error) => new GetBackupError(error))\n .run();\n }\n\n async saveBackup(\n deviceId: DeviceId,\n backup: Backup,\n ): Promise<Either<SaveBackupError, void>> {\n return EitherAsync(async ({ liftEither }) => {\n const serialized = await liftEither(serialize(backup));\n await this.storage.setItem(\n `${BACKUP_STORAGE_PREFIX_KEY}-${deviceId}`,\n serialized,\n );\n })\n .mapLeft((error) => new SaveBackupError(error))\n .run();\n }\n}\n"],
5
+ "mappings": "AAAA,OAEE,0BAAAA,MAEK,kCACP,OAAS,eAAAC,MAAmB,YAG5B,OACE,eAAAC,EACA,aAAAC,MACK,8DACP,OACE,kBAAAC,EACA,mBAAAC,MACK,uEAGP,MAAMC,EAA4B,GAAGN,CAAsB,iBAEpD,MAAMO,CAAoB,CAC/B,YAA6BC,EAA0B,CAA1B,aAAAA,CAA2B,CAExD,MAAM,UACJC,EACgD,CAChD,OAAOR,EAAY,MAAO,CAAE,WAAAS,CAAW,IAAM,CAC3C,MAAMC,EAAO,MAAM,KAAK,QAAQ,QAC9B,GAAGL,CAAyB,IAAIG,CAAQ,EAC1C,EACA,OAAKE,EACED,EAAWR,EAAYS,CAAI,CAAC,EADjB,IAEpB,CAAC,EACE,QAASC,GAAU,IAAIR,EAAeQ,CAAK,CAAC,EAC5C,IAAI,CACT,CAEA,MAAM,WACJH,EACAI,EACwC,CACxC,OAAOZ,EAAY,MAAO,CAAE,WAAAS,CAAW,IAAM,CAC3C,MAAMI,EAAa,MAAMJ,EAAWP,EAAUU,CAAM,CAAC,EACrD,MAAM,KAAK,QAAQ,QACjB,GAAGP,CAAyB,IAAIG,CAAQ,GACxCK,CACF,CACF,CAAC,EACE,QAASF,GAAU,IAAIP,EAAgBO,CAAK,CAAC,EAC7C,IAAI,CACT,CACF",
6
+ "names": ["DMK_STORAGE_PREFIX_KEY", "EitherAsync", "deserialize", "serialize", "GetBackupError", "SaveBackupError", "BACKUP_STORAGE_PREFIX_KEY", "DeviceBackupStorage", "storage", "deviceId", "liftEither", "data", "error", "backup", "serialized"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{DeviceBackupStorage as d}from"../../../../device-action/OsUpdate/Backup/Storage/DeviceBackupStorage";import{GetBackupError as p,SaveBackupError as l}from"../../../../device-action/OsUpdate/Backup/Storage/DeviceBackupStorageErrors";import{serialize as k}from"./BackupSerializer";describe("DeviceBackupStorage",()=>{const o={getItem:vi.fn(),setItem:vi.fn(),removeItem:vi.fn()},c=new d(o);beforeEach(()=>{vi.resetAllMocks()}),describe("getBackup",()=>{const r=vi.mocked(o.getItem);describe("Success",()=>{it("should return backup when it exists",async()=>{const e={languageId:1,installedApps:[],clsHexImage:void 0,createdAt:new Date};r.mockResolvedValueOnce(JSON.stringify({...e,createdAt:e.createdAt.toISOString()}));const t=await c.getBackup("12345");expect(t.isRight()).toBe(!0),expect(t.extract()).toEqual(e)}),it("should return null when backup does not exist",async()=>{r.mockResolvedValueOnce(null);const e=await c.getBackup("12345");expect(e.isRight()).toBe(!0),expect(e.extract()).toBeNull()})}),describe("Error",()=>{it("should return error when getItem fails",async()=>{const e=new Error("storage read failed");r.mockRejectedValueOnce(e);const t=await c.getBackup("12345");expect(t.isLeft()).toBe(!0),t.mapLeft(a=>{expect(a).toBeInstanceOf(p),expect(a.originalError).toBe(e)})})})}),describe("saveBackup",()=>{const r=vi.mocked(o.setItem),e={languageId:1,installedApps:[{appName:"app1",data:"deadbeef"}],clsHexImage:void 0,createdAt:new Date("2025-01-01T00:00:00.000Z")};describe("Success",()=>{it("should save backup",async()=>{r.mockResolvedValueOnce(void 0);const t=await c.saveBackup("12345",e);expect(t.isRight()).toBe(!0),expect(r).toHaveBeenCalledWith("dmk-device-backup-12345",JSON.stringify({...e,createdAt:e.createdAt.toISOString()}))})}),describe("Error",()=>{it("should return error when setItem fails",async()=>{const t=new Error("storage write failed");r.mockRejectedValueOnce(t);const a=await c.saveBackup("12345",e);expect(a.isLeft()).toBe(!0),a.mapLeft(s=>{expect(s).toBeInstanceOf(l),expect(s.originalError).toBe(t)})})}),describe("Chain saveBackup and getBackup",()=>{it("should read back the exact same backup that was saved",async()=>{const t=vi.mocked(o.getItem),a=vi.mocked(o.setItem),n={languageId:1,installedApps:[{appName:"app1",data:"deadbeef"}],clsHexImage:"0x1234567890",createdAt:new Date("2025-06-15T12:34:56.789Z")};a.mockResolvedValueOnce(void 0),await c.saveBackup("12345",n);const i=k(n);t.mockResolvedValueOnce(i.unsafeCoerce());const u=await c.getBackup("12345");expect(a).toHaveBeenCalledWith("dmk-device-backup-12345",i.unsafeCoerce()),expect(u.isRight()).toBe(!0),expect(u.extract()).toStrictEqual(n)})})})});
2
+ //# sourceMappingURL=DeviceBackupStorage.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage.test.ts"],
4
+ "sourcesContent": ["import { type KeyValueStorage } from \"@ledgerhq/device-management-kit\";\n\nimport { DeviceBackupStorage } from \"@api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorage\";\nimport {\n GetBackupError,\n SaveBackupError,\n} from \"@api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorageErrors\";\n\nimport { serialize } from \"./BackupSerializer\";\n\ndescribe(\"DeviceBackupStorage\", () => {\n const storage: KeyValueStorage = {\n getItem: vi.fn(),\n setItem: vi.fn(),\n removeItem: vi.fn(),\n };\n const deviceBackupStorage = new DeviceBackupStorage(storage);\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"getBackup\", () => {\n const getItemMock = vi.mocked(storage.getItem);\n\n describe(\"Success\", () => {\n it(\"should return backup when it exists\", async () => {\n const backup = {\n languageId: 1,\n installedApps: [],\n clsHexImage: undefined,\n createdAt: new Date(),\n };\n\n getItemMock.mockResolvedValueOnce(\n JSON.stringify({\n ...backup,\n createdAt: backup.createdAt.toISOString(),\n }),\n );\n const result = await deviceBackupStorage.getBackup(\"12345\");\n\n expect(result.isRight()).toBe(true);\n expect(result.extract()).toEqual(backup);\n });\n\n it(\"should return null when backup does not exist\", async () => {\n getItemMock.mockResolvedValueOnce(null);\n const result = await deviceBackupStorage.getBackup(\"12345\");\n\n expect(result.isRight()).toBe(true);\n expect(result.extract()).toBeNull();\n });\n });\n\n describe(\"Error\", () => {\n it(\"should return error when getItem fails\", async () => {\n const error = new Error(\"storage read failed\");\n getItemMock.mockRejectedValueOnce(error);\n\n const result = await deviceBackupStorage.getBackup(\"12345\");\n\n expect(result.isLeft()).toBe(true);\n result.mapLeft((e) => {\n expect(e).toBeInstanceOf(GetBackupError);\n expect(e.originalError).toBe(error);\n });\n });\n });\n });\n\n describe(\"saveBackup\", () => {\n const setItemMock = vi.mocked(storage.setItem);\n\n const backup = {\n languageId: 1,\n installedApps: [{ appName: \"app1\", data: \"deadbeef\" }],\n clsHexImage: undefined,\n createdAt: new Date(\"2025-01-01T00:00:00.000Z\"),\n };\n\n describe(\"Success\", () => {\n it(\"should save backup\", async () => {\n setItemMock.mockResolvedValueOnce(undefined);\n\n const result = await deviceBackupStorage.saveBackup(\"12345\", backup);\n\n expect(result.isRight()).toBe(true);\n expect(setItemMock).toHaveBeenCalledWith(\n \"dmk-device-backup-12345\",\n JSON.stringify({\n ...backup,\n createdAt: backup.createdAt.toISOString(),\n }),\n );\n });\n });\n\n describe(\"Error\", () => {\n it(\"should return error when setItem fails\", async () => {\n const error = new Error(\"storage write failed\");\n setItemMock.mockRejectedValueOnce(error);\n\n const result = await deviceBackupStorage.saveBackup(\"12345\", backup);\n\n expect(result.isLeft()).toBe(true);\n result.mapLeft((e) => {\n expect(e).toBeInstanceOf(SaveBackupError);\n expect(e.originalError).toBe(error);\n });\n });\n });\n\n describe(\"Chain saveBackup and getBackup\", () => {\n it(\"should read back the exact same backup that was saved\", async () => {\n // ARRANGE\n const getItemMock = vi.mocked(storage.getItem);\n const setItemMock = vi.mocked(storage.setItem);\n\n const backupCreationDate = new Date(\"2025-06-15T12:34:56.789Z\");\n const originalBackup = {\n languageId: 1,\n installedApps: [{ appName: \"app1\", data: \"deadbeef\" }],\n clsHexImage: \"0x1234567890\",\n createdAt: backupCreationDate,\n };\n\n setItemMock.mockResolvedValueOnce(undefined);\n await deviceBackupStorage.saveBackup(\"12345\", originalBackup);\n\n const capturedBackup = serialize(originalBackup);\n\n getItemMock.mockResolvedValueOnce(capturedBackup.unsafeCoerce());\n const getResult = await deviceBackupStorage.getBackup(\"12345\");\n\n // ASSERT\n expect(setItemMock).toHaveBeenCalledWith(\n \"dmk-device-backup-12345\",\n capturedBackup.unsafeCoerce(),\n );\n expect(getResult.isRight()).toBe(true);\n expect(getResult.extract()).toStrictEqual(originalBackup);\n });\n });\n });\n});\n"],
5
+ "mappings": "AAEA,OAAS,uBAAAA,MAA2B,iEACpC,OACE,kBAAAC,EACA,mBAAAC,MACK,uEAEP,OAAS,aAAAC,MAAiB,qBAE1B,SAAS,sBAAuB,IAAM,CACpC,MAAMC,EAA2B,CAC/B,QAAS,GAAG,GAAG,EACf,QAAS,GAAG,GAAG,EACf,WAAY,GAAG,GAAG,CACpB,EACMC,EAAsB,IAAIL,EAAoBI,CAAO,EAC3D,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,YAAa,IAAM,CAC1B,MAAME,EAAc,GAAG,OAAOF,EAAQ,OAAO,EAE7C,SAAS,UAAW,IAAM,CACxB,GAAG,sCAAuC,SAAY,CACpD,MAAMG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",
6
+ "names": ["DeviceBackupStorage", "GetBackupError", "SaveBackupError", "serialize", "storage", "deviceBackupStorage", "getItemMock", "backup", "result", "error", "e", "setItemMock", "originalBackup", "capturedBackup", "getResult"]
7
+ }
@@ -0,0 +1,2 @@
1
+ class n{_tag="GetBackupError";originalError;constructor(r){this.originalError=r}}class a{_tag="SaveBackupError";originalError;constructor(r){this.originalError=r}}export{n as GetBackupError,a as SaveBackupError};
2
+ //# sourceMappingURL=DeviceBackupStorageErrors.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Storage/DeviceBackupStorageErrors.ts"],
4
+ "sourcesContent": ["import { type DmkError } from \"@ledgerhq/device-management-kit\";\n\nexport class GetBackupError implements DmkError {\n readonly _tag = \"GetBackupError\";\n readonly originalError?: unknown;\n\n constructor(originalError?: unknown) {\n this.originalError = originalError;\n }\n}\n\nexport class SaveBackupError implements DmkError {\n readonly _tag = \"SaveBackupError\";\n readonly originalError?: unknown;\n\n constructor(originalError?: unknown) {\n this.originalError = originalError;\n }\n}\n"],
5
+ "mappings": "AAEO,MAAMA,CAAmC,CACrC,KAAO,iBACP,cAET,YAAYC,EAAyB,CACnC,KAAK,cAAgBA,CACvB,CACF,CAEO,MAAMC,CAAoC,CACtC,KAAO,kBACP,cAET,YAAYD,EAAyB,CACnC,KAAK,cAAgBA,CACvB,CACF",
6
+ "names": ["GetBackupError", "originalError", "SaveBackupError"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{BackupAppStorageTask as c,isSuccessCommandResult as g}from"@ledgerhq/device-management-kit";import{Left as A,Right as u}from"purify-ts";import{BackupAppsStorageError as i}from"../../../../device-action/OsUpdate/Backup/BackupDeviceActionErrors";const l="0x",m=(r,t)=>async({input:s})=>{const{installedApps:o}=s,n=t("BackupAppStorageTask"),a=[];for(const e of o){const p=await new c({appName:e.name},r,n).run();if(!g(p))return A(new i(p.error.originalError));a.push({appName:e.name,data:p.data.appStorageData===l?void 0:p.data.appStorageData})}return u(a)};export{m as backupAppsStorage};
2
+ //# sourceMappingURL=BackupAppsStorage.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.ts"],
4
+ "sourcesContent": ["import {\n BackupAppStorageTask,\n type InstalledApp,\n type InternalApi,\n isSuccessCommandResult,\n type LoggerPublisherService,\n} from \"@ledgerhq/device-management-kit\";\nimport { type Either, Left, Right } from \"purify-ts\";\n\nimport { BackupAppsStorageError } from \"@api/device-action/OsUpdate/Backup/BackupDeviceActionErrors\";\nimport { type BackupApp } from \"@api/device-action/OsUpdate/Backup/types\";\n\nconst EMPTY_STORAGE = \"0x\";\n\ntype BackupAppsStorageHandlerArgs = {\n input: { installedApps: InstalledApp[] };\n};\n\ntype BackupAppsStorageHandlerResponse = Promise<\n Either<BackupAppsStorageError, BackupApp[]>\n>;\n\ntype BackupAppsStorageHandler = (\n args: BackupAppsStorageHandlerArgs,\n) => BackupAppsStorageHandlerResponse;\n\nexport const backupAppsStorage =\n (\n internalApi: InternalApi,\n loggerFactory: (tag: string) => LoggerPublisherService,\n ): BackupAppsStorageHandler =>\n async ({\n input,\n }: BackupAppsStorageHandlerArgs): BackupAppsStorageHandlerResponse => {\n const { installedApps } = input;\n const logger = loggerFactory(\"BackupAppStorageTask\");\n const backupApps: BackupApp[] = [];\n for (const installedApp of installedApps) {\n const backupAppStorageTaskResponse = await new BackupAppStorageTask(\n {\n appName: installedApp.name,\n },\n internalApi,\n logger,\n ).run();\n\n if (!isSuccessCommandResult(backupAppStorageTaskResponse)) {\n return Left(\n new BackupAppsStorageError(\n backupAppStorageTaskResponse.error.originalError,\n ),\n );\n }\n\n backupApps.push({\n appName: installedApp.name,\n data:\n backupAppStorageTaskResponse.data.appStorageData === EMPTY_STORAGE\n ? undefined\n : backupAppStorageTaskResponse.data.appStorageData,\n });\n }\n\n return Right(backupApps);\n };\n"],
5
+ "mappings": "AAAA,OACE,wBAAAA,EAGA,0BAAAC,MAEK,kCACP,OAAsB,QAAAC,EAAM,SAAAC,MAAa,YAEzC,OAAS,0BAAAC,MAA8B,8DAGvC,MAAMC,EAAgB,KAcTC,EACX,CACEC,EACAC,IAEF,MAAO,CACL,MAAAC,CACF,IAAsE,CACpE,KAAM,CAAE,cAAAC,CAAc,EAAID,EACpBE,EAASH,EAAc,sBAAsB,EAC7CI,EAA0B,CAAC,EACjC,UAAWC,KAAgBH,EAAe,CACxC,MAAMI,EAA+B,MAAM,IAAId,EAC7C,CACE,QAASa,EAAa,IACxB,EACAN,EACAI,CACF,EAAE,IAAI,EAEN,GAAI,CAACV,EAAuBa,CAA4B,EACtD,OAAOZ,EACL,IAAIE,EACFU,EAA6B,MAAM,aACrC,CACF,EAGFF,EAAW,KAAK,CACd,QAASC,EAAa,KACtB,KACEC,EAA6B,KAAK,iBAAmBT,EACjD,OACAS,EAA6B,KAAK,cAC1C,CAAC,CACH,CAEA,OAAOX,EAAMS,CAAU,CACzB",
6
+ "names": ["BackupAppStorageTask", "isSuccessCommandResult", "Left", "Right", "BackupAppsStorageError", "EMPTY_STORAGE", "backupAppsStorage", "internalApi", "loggerFactory", "input", "installedApps", "logger", "backupApps", "installedApp", "backupAppStorageTaskResponse"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{BackupAppStorageTask as i,CommandResultFactory as c,GLOBAL_ERRORS as d,GlobalCommandError as l}from"@ledgerhq/device-management-kit";import{makeDeviceActionInternalApiMock as m}from"../../../../device-action/__test-utils__/makeInternalApi";import{BackupAppsStorageError as h}from"../../../../device-action/OsUpdate/Backup/BackupDeviceActionErrors";import{backupAppsStorage as n}from"../../../../device-action/OsUpdate/Backup/Substeps/BackupAppsStorage";vi.mock("@ledgerhq/device-management-kit",async a=>({...await a(),BackupAppStorageTask:vi.fn()}));describe("BackupAppStorage",()=>{const a=m(),r=vi.mocked(i);beforeEach(()=>{vi.resetAllMocks()}),describe("Success",()=>{it("Should return the list of installed apps and their storage",async()=>{const o=[{name:"app1",flags:0,hash:"hash1",hash_code_data:"hcd1"},{name:"app2",flags:0,hash:"hash2",hash_code_data:"hcd2"}],t=vi.fn().mockResolvedValueOnce(c({data:{appStorageData:"deadbeef"}})).mockResolvedValueOnce(c({data:{appStorageData:"cafebabe"}}));r.mockImplementation(()=>({run:t}));const e=await n(a,a.loggerFactory)({input:{installedApps:o}});expect(e.isRight()).toBe(!0),expect(e.extract()).toEqual([{appName:"app1",data:"deadbeef"},{appName:"app2",data:"cafebabe"}])}),it("Should set data to undefined when appStorageData is '0x'",async()=>{const o=[{name:"app1",flags:0,hash:"hash1",hash_code_data:"hcd1"}],t=vi.fn().mockResolvedValueOnce(c({data:{appStorageData:"0x"}}));r.mockImplementation(()=>({run:t}));const e=await n(a,a.loggerFactory)({input:{installedApps:o}});expect(e.isRight()).toBe(!0),expect(e.extract()).toEqual([{appName:"app1",data:void 0}])})}),describe("Error",()=>{it("Should return BackupAppsStorageError",async()=>{const o=[{name:"app1",flags:0,hash:"hash1",hash_code_data:"hcd1"}],t=new l({errorCode:"6e00",...d["6e00"]}),e=vi.fn().mockResolvedValueOnce(c({error:t}));r.mockImplementation(()=>({run:e}));const p=await n(a,a.loggerFactory)({input:{installedApps:o}});expect(p.isLeft()).toBe(!0),p.mapLeft(s=>{expect(s).toBeInstanceOf(h),expect(s.originalError).toBe(t.originalError)})})})});
2
+ //# sourceMappingURL=BackupAppsStorage.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage.test.ts"],
4
+ "sourcesContent": ["import {\n BackupAppStorageTask,\n CommandResultFactory,\n GLOBAL_ERRORS,\n GlobalCommandError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { BackupAppsStorageError } from \"@api/device-action/OsUpdate/Backup/BackupDeviceActionErrors\";\nimport { backupAppsStorage } from \"@api/device-action/OsUpdate/Backup/Substeps/BackupAppsStorage\";\n\nvi.mock(\"@ledgerhq/device-management-kit\", async (importOriginal) => {\n const original =\n await importOriginal<typeof import(\"@ledgerhq/device-management-kit\")>();\n return {\n ...original,\n BackupAppStorageTask: vi.fn(),\n };\n});\n\ndescribe(\"BackupAppStorage\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n const MockTask = vi.mocked(BackupAppStorageTask);\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"Success\", () => {\n it(\"Should return the list of installed apps and their storage\", async () => {\n const installedApps = [\n { name: \"app1\", flags: 0, hash: \"hash1\", hash_code_data: \"hcd1\" },\n { name: \"app2\", flags: 0, hash: \"hash2\", hash_code_data: \"hcd2\" },\n ];\n const runMock = vi\n .fn()\n .mockResolvedValueOnce(\n CommandResultFactory({ data: { appStorageData: \"deadbeef\" } }),\n )\n .mockResolvedValueOnce(\n CommandResultFactory({ data: { appStorageData: \"cafebabe\" } }),\n );\n MockTask.mockImplementation(() => ({ run: runMock }) as never);\n\n const result = await backupAppsStorage(\n apiMock,\n apiMock.loggerFactory!,\n )({ input: { installedApps } });\n\n expect(result.isRight()).toBe(true);\n expect(result.extract()).toEqual([\n { appName: \"app1\", data: \"deadbeef\" },\n { appName: \"app2\", data: \"cafebabe\" },\n ]);\n });\n\n it(\"Should set data to undefined when appStorageData is '0x'\", async () => {\n const installedApps = [\n { name: \"app1\", flags: 0, hash: \"hash1\", hash_code_data: \"hcd1\" },\n ];\n const runMock = vi\n .fn()\n .mockResolvedValueOnce(\n CommandResultFactory({ data: { appStorageData: \"0x\" } }),\n );\n MockTask.mockImplementation(() => ({ run: runMock }) as never);\n\n const result = await backupAppsStorage(\n apiMock,\n apiMock.loggerFactory!,\n )({ input: { installedApps } });\n\n expect(result.isRight()).toBe(true);\n expect(result.extract()).toEqual([{ appName: \"app1\", data: undefined }]);\n });\n });\n describe(\"Error\", () => {\n it(\"Should return BackupAppsStorageError\", async () => {\n const installedApps = [\n { name: \"app1\", flags: 0, hash: \"hash1\", hash_code_data: \"hcd1\" },\n ];\n const error = new GlobalCommandError({\n errorCode: \"6e00\",\n ...GLOBAL_ERRORS[\"6e00\"],\n });\n const runMock = vi\n .fn()\n .mockResolvedValueOnce(CommandResultFactory({ error }));\n MockTask.mockImplementation(() => ({ run: runMock }) as never);\n\n const result = await backupAppsStorage(\n apiMock,\n apiMock.loggerFactory!,\n )({ input: { installedApps } });\n\n expect(result.isLeft()).toBe(true);\n result.mapLeft((e) => {\n expect(e).toBeInstanceOf(BackupAppsStorageError);\n expect(e.originalError).toBe(error.originalError);\n });\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OACE,wBAAAA,EACA,wBAAAC,EACA,iBAAAC,EACA,sBAAAC,MACK,kCAEP,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,0BAAAC,MAA8B,8DACvC,OAAS,qBAAAC,MAAyB,gEAElC,GAAG,KAAK,kCAAmC,MAAOC,IAGzC,CACL,GAFA,MAAMA,EAAiE,EAGvE,qBAAsB,GAAG,GAAG,CAC9B,EACD,EAED,SAAS,mBAAoB,IAAM,CACjC,MAAMC,EAAUJ,EAAgC,EAC1CK,EAAW,GAAG,OAAOT,CAAoB,EAE/C,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,6DAA8D,SAAY,CAC3E,MAAMU,EAAgB,CACpB,CAAE,KAAM,OAAQ,MAAO,EAAG,KAAM,QAAS,eAAgB,MAAO,EAChE,CAAE,KAAM,OAAQ,MAAO,EAAG,KAAM,QAAS,eAAgB,MAAO,CAClE,EACMC,EAAU,GACb,GAAG,EACH,sBACCV,EAAqB,CAAE,KAAM,CAAE,eAAgB,UAAW,CAAE,CAAC,CAC/D,EACC,sBACCA,EAAqB,CAAE,KAAM,CAAE,eAAgB,UAAW,CAAE,CAAC,CAC/D,EACFQ,EAAS,mBAAmB,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MN,EACnBE,EACAA,EAAQ,aACV,EAAE,CAAE,MAAO,CAAE,cAAAE,CAAc,CAAE,CAAC,EAE9B,OAAOE,EAAO,OAAO,CAAC,EAAE,KAAK,EAAI,EACjCA,EAAO,QAASE,GAAM,CACpB,OAAOA,CAAC,EAAE,eAAeT,CAAsB,EAC/C,OAAOS,EAAE,aAAa,EAAE,KAAKD,EAAM,aAAa,CAClD,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["BackupAppStorageTask", "CommandResultFactory", "GLOBAL_ERRORS", "GlobalCommandError", "makeDeviceActionInternalApiMock", "BackupAppsStorageError", "backupAppsStorage", "importOriginal", "apiMock", "MockTask", "installedApps", "runMock", "result", "error", "e"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{DownloadCustomLockScreenDeviceAction as t}from"../../../../device-action/DownloadCustomLockScreen/DownloadCustomLockScreenDeviceAction";const a=(e,o,n)=>new t({input:{unlockTimeout:o,allowedEmpty:n}}).makeStateMachine(e);export{a as downloadCustomLockScreenDevice};
2
+ //# sourceMappingURL=DownloadCustomLockScreen.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.ts"],
4
+ "sourcesContent": ["import { type InternalApi } from \"@ledgerhq/device-management-kit\";\n\nimport { DownloadCustomLockScreenDeviceAction } from \"@api/device-action/DownloadCustomLockScreen/DownloadCustomLockScreenDeviceAction\";\n\ntype DownloadCustomLockScreenResult = ReturnType<\n DownloadCustomLockScreenDeviceAction[\"makeStateMachine\"]\n>;\n\nexport const downloadCustomLockScreenDevice = (\n internalAPI: InternalApi,\n unlockTimeout: number,\n allowedEmpty: boolean,\n): DownloadCustomLockScreenResult =>\n new DownloadCustomLockScreenDeviceAction({\n input: { unlockTimeout, allowedEmpty },\n }).makeStateMachine(internalAPI);\n"],
5
+ "mappings": "AAEA,OAAS,wCAAAA,MAA4C,mFAM9C,MAAMC,EAAiC,CAC5CC,EACAC,EACAC,IAEA,IAAIJ,EAAqC,CACvC,MAAO,CAAE,cAAAG,EAAe,aAAAC,CAAa,CACvC,CAAC,EAAE,iBAAiBF,CAAW",
6
+ "names": ["DownloadCustomLockScreenDeviceAction", "downloadCustomLockScreenDevice", "internalAPI", "unlockTimeout", "allowedEmpty"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{makeDeviceActionInternalApiMock as i}from"../../../../device-action/__test-utils__/makeInternalApi";import{DownloadCustomLockScreenDeviceAction as a}from"../../../../device-action/DownloadCustomLockScreen/DownloadCustomLockScreenDeviceAction";import{downloadCustomLockScreenDevice as n}from"../../../../device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen";vi.mock("@api/device-action/DownloadCustomLockScreen/DownloadCustomLockScreenDeviceAction");describe("DownloadCustomLockScreen",()=>{const t=i(),c=vi.mocked(a);beforeEach(()=>{vi.resetAllMocks()}),describe("Success",()=>{it("Should return the custom lock screen from the device",()=>{const e=Symbol("stateMachine"),o=vi.fn().mockReturnValue(e);c.mockImplementation(()=>({makeStateMachine:o}));const r=n(t,5e3,!0);expect(c).toHaveBeenCalledWith({input:{unlockTimeout:5e3,allowedEmpty:!0}}),expect(o).toHaveBeenCalledWith(t),expect(r).toBe(e)})}),describe("Error",()=>{it("Should return the error from the device action",()=>{const e=new Error("Device action failed"),o=vi.fn().mockImplementation(()=>{throw e});c.mockImplementation(()=>({makeStateMachine:o})),expect(()=>n(t,5e3,!0)).toThrow(e)})})});
2
+ //# sourceMappingURL=DownloadCustomLockScreen.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen.test.ts"],
4
+ "sourcesContent": ["import { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { DownloadCustomLockScreenDeviceAction } from \"@api/device-action/DownloadCustomLockScreen/DownloadCustomLockScreenDeviceAction\";\nimport { downloadCustomLockScreenDevice } from \"@api/device-action/OsUpdate/Backup/Substeps/DownloadCustomLockScreen\";\n\nvi.mock(\n \"@api/device-action/DownloadCustomLockScreen/DownloadCustomLockScreenDeviceAction\",\n);\n\ndescribe(\"DownloadCustomLockScreen\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n const MockDA = vi.mocked(DownloadCustomLockScreenDeviceAction);\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n describe(\"Success\", () => {\n it(\"Should return the custom lock screen from the device\", () => {\n const fakeStateMachine = Symbol(\"stateMachine\");\n const makeStateMachineMock = vi.fn().mockReturnValue(fakeStateMachine);\n MockDA.mockImplementation(\n () => ({ makeStateMachine: makeStateMachineMock }) as never,\n );\n\n const result = downloadCustomLockScreenDevice(apiMock, 5000, true);\n\n expect(MockDA).toHaveBeenCalledWith({\n input: { unlockTimeout: 5000, allowedEmpty: true },\n });\n expect(makeStateMachineMock).toHaveBeenCalledWith(apiMock);\n expect(result).toBe(fakeStateMachine);\n });\n });\n describe(\"Error\", () => {\n it(\"Should return the error from the device action\", () => {\n const error = new Error(\"Device action failed\");\n const makeStateMachineMock = vi.fn().mockImplementation(() => {\n throw error;\n });\n MockDA.mockImplementation(\n () => ({ makeStateMachine: makeStateMachineMock }) as never,\n );\n\n expect(() => downloadCustomLockScreenDevice(apiMock, 5000, true)).toThrow(\n error,\n );\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,mCAAAA,MAAuC,oDAChD,OAAS,wCAAAC,MAA4C,mFACrD,OAAS,kCAAAC,MAAsC,uEAE/C,GAAG,KACD,kFACF,EAEA,SAAS,2BAA4B,IAAM,CACzC,MAAMC,EAAUH,EAAgC,EAC1CI,EAAS,GAAG,OAAOH,CAAoC,EAE7D,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EACD,SAAS,UAAW,IAAM,CACxB,GAAG,uDAAwD,IAAM,CAC/D,MAAMI,EAAmB,OAAO,cAAc,EACxCC,EAAuB,GAAG,GAAG,EAAE,gBAAgBD,CAAgB,EACrED,EAAO,mBACL,KAAO,CAAE,iBAAkBE,CAAqB,EAClD,EAEA,MAAMC,EAASL,EAA+BC,EAAS,IAAM,EAAI,EAEjE,OAAOC,CAAM,EAAE,qBAAqB,CAClC,MAAO,CAAE,cAAe,IAAM,aAAc,EAAK,CACnD,CAAC,EACD,OAAOE,CAAoB,EAAE,qBAAqBH,CAAO,EACzD,OAAOI,CAAM,EAAE,KAAKF,CAAgB,CACtC,CAAC,CACH,CAAC,EACD,SAAS,QAAS,IAAM,CACtB,GAAG,iDAAkD,IAAM,CACzD,MAAMG,EAAQ,IAAI,MAAM,sBAAsB,EACxCF,EAAuB,GAAG,GAAG,EAAE,mBAAmB,IAAM,CAC5D,MAAME,CACR,CAAC,EACDJ,EAAO,mBACL,KAAO,CAAE,iBAAkBE,CAAqB,EAClD,EAEA,OAAO,IAAMJ,EAA+BC,EAAS,IAAM,EAAI,CAAC,EAAE,QAChEK,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["makeDeviceActionInternalApiMock", "DownloadCustomLockScreenDeviceAction", "downloadCustomLockScreenDevice", "apiMock", "MockDA", "fakeStateMachine", "makeStateMachineMock", "result", "error"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{GetOsVersionCommand as r,isSuccessCommandResult as a}from"@ledgerhq/device-management-kit";import{Left as t,Right as o}from"purify-ts/Either";import{GetLanguageIdError as d}from"../../../../device-action/OsUpdate/Backup/BackupDeviceActionErrors";const u=n=>async()=>{const e=await n.sendCommand(new r);return a(e)?o(e.data.langId):t(new d(e.error.originalError))};export{u as getLanguageId};
2
+ //# sourceMappingURL=GetLanguageId.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.ts"],
4
+ "sourcesContent": ["import {\n GetOsVersionCommand,\n type InternalApi,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\nimport { type Either, Left, Right } from \"purify-ts/Either\";\n\nimport { GetLanguageIdError } from \"@api/device-action/OsUpdate/Backup/BackupDeviceActionErrors\";\n\ntype GetLanguageIdHandlerResponse = Promise<\n Either<GetLanguageIdError, number | undefined>\n>;\n\ntype GetLanguageIdHandler = () => GetLanguageIdHandlerResponse;\n\nexport const getLanguageId =\n (internalApi: InternalApi): GetLanguageIdHandler =>\n async (): GetLanguageIdHandlerResponse => {\n const result = await internalApi.sendCommand(new GetOsVersionCommand());\n\n if (!isSuccessCommandResult(result)) {\n return Left(new GetLanguageIdError(result.error.originalError));\n }\n\n return Right(result.data.langId);\n };\n"],
5
+ "mappings": "AAAA,OACE,uBAAAA,EAEA,0BAAAC,MACK,kCACP,OAAsB,QAAAC,EAAM,SAAAC,MAAa,mBAEzC,OAAS,sBAAAC,MAA0B,8DAQ5B,MAAMC,EACVC,GACD,SAA0C,CACxC,MAAMC,EAAS,MAAMD,EAAY,YAAY,IAAIN,CAAqB,EAEtE,OAAKC,EAAuBM,CAAM,EAI3BJ,EAAMI,EAAO,KAAK,MAAM,EAHtBL,EAAK,IAAIE,EAAmBG,EAAO,MAAM,aAAa,CAAC,CAIlE",
6
+ "names": ["GetOsVersionCommand", "isSuccessCommandResult", "Left", "Right", "GetLanguageIdError", "getLanguageId", "internalApi", "result"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{CommandResultFactory as n,GLOBAL_ERRORS as s,GlobalCommandError as d}from"@ledgerhq/device-management-kit";import{makeDeviceActionInternalApiMock as i}from"../../../../device-action/__test-utils__/makeInternalApi";import{GetLanguageIdError as l}from"../../../../device-action/OsUpdate/Backup/BackupDeviceActionErrors";import{getLanguageId as c}from"../../../../device-action/OsUpdate/Backup/Substeps/GetLanguageId";describe("GetLanguageId",()=>{const r=i(),{sendCommand:t}=r;beforeEach(()=>{vi.resetAllMocks()}),describe("Success",()=>{it("Should return language Id",async()=>{t.mockResolvedValueOnce(n({data:{langId:1}}));const e=await c(r)();expect(e.isRight()).toBe(!0),expect(e.extract()).toBe(1)})}),describe("Error",()=>{it("Should return GetLanguageIdError",async()=>{const o=new d({errorCode:"6e00",...s["6e00"]});t.mockResolvedValueOnce(n({error:o}));const e=await c(r)();expect(e.isLeft()).toBe(!0),e.mapLeft(a=>{expect(a).toBeInstanceOf(l),expect(a.originalError).toBe(o.originalError)})})})});
2
+ //# sourceMappingURL=GetLanguageId.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/api/device-action/OsUpdate/Backup/Substeps/GetLanguageId.test.ts"],
4
+ "sourcesContent": ["import {\n CommandResultFactory,\n GLOBAL_ERRORS,\n GlobalCommandError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { makeDeviceActionInternalApiMock } from \"@api/device-action/__test-utils__/makeInternalApi\";\nimport { GetLanguageIdError } from \"@api/device-action/OsUpdate/Backup/BackupDeviceActionErrors\";\nimport { getLanguageId } from \"@api/device-action/OsUpdate/Backup/Substeps/GetLanguageId\";\n\ndescribe(\"GetLanguageId\", () => {\n const apiMock = makeDeviceActionInternalApiMock();\n const { sendCommand: sendCommandMock } = apiMock;\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"Success\", () => {\n it(\"Should return language Id\", async () => {\n const langId = 1;\n sendCommandMock.mockResolvedValueOnce(\n CommandResultFactory({ data: { langId } }),\n );\n\n const result = await getLanguageId(apiMock)();\n\n expect(result.isRight()).toBe(true);\n expect(result.extract()).toBe(langId);\n });\n });\n describe(\"Error\", () => {\n it(\"Should return GetLanguageIdError\", async () => {\n const error = new GlobalCommandError({\n errorCode: \"6e00\",\n ...GLOBAL_ERRORS[\"6e00\"],\n });\n sendCommandMock.mockResolvedValueOnce(CommandResultFactory({ error }));\n\n const result = await getLanguageId(apiMock)();\n\n expect(result.isLeft()).toBe(true);\n result.mapLeft((e) => {\n expect(e).toBeInstanceOf(GetLanguageIdError);\n expect(e.originalError).toBe(error.originalError);\n });\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OACE,wBAAAA,EACA,iBAAAC,EACA,sBAAAC,MACK,kCAEP,OAAS,mCAAAC,MAAuC,oDAChD,OAAS,sBAAAC,MAA0B,8DACnC,OAAS,iBAAAC,MAAqB,4DAE9B,SAAS,gBAAiB,IAAM,CAC9B,MAAMC,EAAUH,EAAgC,EAC1C,CAAE,YAAaI,CAAgB,EAAID,EAEzC,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,4BAA6B,SAAY,CAE1CC,EAAgB,sBACdP,EAAqB,CAAE,KAAM,CAAE,QAAO,CAAE,CAAC,CAC3C,EAEA,MAAMQ,EAAS,MAAMH,EAAcC,CAAO,EAAE,EAE5C,OAAOE,EAAO,QAAQ,CAAC,EAAE,KAAK,EAAI,EAClC,OAAOA,EAAO,QAAQ,CAAC,EAAE,KAAK,CAAM,CACtC,CAAC,CACH,CAAC,EACD,SAAS,QAAS,IAAM,CACtB,GAAG,mCAAoC,SAAY,CACjD,MAAMC,EAAQ,IAAIP,EAAmB,CACnC,UAAW,OACX,GAAGD,EAAc,MAAM,CACzB,CAAC,EACDM,EAAgB,sBAAsBP,EAAqB,CAAE,MAAAS,CAAM,CAAC,CAAC,EAErE,MAAMD,EAAS,MAAMH,EAAcC,CAAO,EAAE,EAE5C,OAAOE,EAAO,OAAO,CAAC,EAAE,KAAK,EAAI,EACjCA,EAAO,QAASE,GAAM,CACpB,OAAOA,CAAC,EAAE,eAAeN,CAAkB,EAC3C,OAAOM,EAAE,aAAa,EAAE,KAAKD,EAAM,aAAa,CAClD,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["CommandResultFactory", "GLOBAL_ERRORS", "GlobalCommandError", "makeDeviceActionInternalApiMock", "GetLanguageIdError", "getLanguageId", "apiMock", "sendCommandMock", "result", "error", "e"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{ListInstalledAppsDeviceAction as n}from"@ledgerhq/device-management-kit";const s=(t,e)=>new n({input:{unlockTimeout:e}}).makeStateMachine(t);export{s as listInstalledApps};
2
+ //# sourceMappingURL=ListInstalledApps.js.map