@noldova/desktop.electron 0.0.0-stage → 0.0.2

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 (590) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +55 -2
  3. package/api/index.d.ts +11138 -0
  4. package/api/index.js +144 -0
  5. package/api/index.js.map +1 -0
  6. package/enums/file-save-outcome.js +14 -0
  7. package/enums/file-save-outcome.js.map +1 -0
  8. package/enums/main-process-failure-kind.js +13 -0
  9. package/enums/main-process-failure-kind.js.map +1 -0
  10. package/enums/menu-bar-row-type.js +14 -0
  11. package/enums/menu-bar-row-type.js.map +1 -0
  12. package/enums/menu-check.js +14 -0
  13. package/enums/menu-check.js.map +1 -0
  14. package/enums/path-command-outcome.js +16 -0
  15. package/enums/path-command-outcome.js.map +1 -0
  16. package/enums/quit-choice.js +14 -0
  17. package/enums/quit-choice.js.map +1 -0
  18. package/enums/quit-outcome.js +14 -0
  19. package/enums/quit-outcome.js.map +1 -0
  20. package/enums/startup-state-kind.js +19 -0
  21. package/enums/startup-state-kind.js.map +1 -0
  22. package/enums/tray-icon-state.js +16 -0
  23. package/enums/tray-icon-state.js.map +1 -0
  24. package/enums/update-state-kind.js +18 -0
  25. package/enums/update-state-kind.js.map +1 -0
  26. package/enums/web-address-kind.js +16 -0
  27. package/enums/web-address-kind.js.map +1 -0
  28. package/enums/window-error-admission.js +14 -0
  29. package/enums/window-error-admission.js.map +1 -0
  30. package/exceptions/app-image-folder-unwritable.exception.js +18 -0
  31. package/exceptions/app-image-folder-unwritable.exception.js.map +1 -0
  32. package/exceptions/app-image-leftover-not-removed.exception.js +17 -0
  33. package/exceptions/app-image-leftover-not-removed.exception.js.map +1 -0
  34. package/exceptions/app-image-not-replaced.exception.js +18 -0
  35. package/exceptions/app-image-not-replaced.exception.js.map +1 -0
  36. package/exceptions/app-image-unreadable.exception.js +18 -0
  37. package/exceptions/app-image-unreadable.exception.js.map +1 -0
  38. package/exceptions/databases-not-backed-up.exception.js +18 -0
  39. package/exceptions/databases-not-backed-up.exception.js.map +1 -0
  40. package/exceptions/debian-installer-missing.exception.js +15 -0
  41. package/exceptions/debian-installer-missing.exception.js.map +1 -0
  42. package/exceptions/debian-package-not-installed.exception.js +18 -0
  43. package/exceptions/debian-package-not-installed.exception.js.map +1 -0
  44. package/exceptions/device-identity.exception.js +17 -0
  45. package/exceptions/device-identity.exception.js.map +1 -0
  46. package/exceptions/electron.exception.js +14 -0
  47. package/exceptions/electron.exception.js.map +1 -0
  48. package/exceptions/installer-not-copied.exception.js +15 -0
  49. package/exceptions/installer-not-copied.exception.js.map +1 -0
  50. package/exceptions/installer-not-held.exception.js +17 -0
  51. package/exceptions/installer-not-held.exception.js.map +1 -0
  52. package/exceptions/installer-not-started.exception.js +18 -0
  53. package/exceptions/installer-not-started.exception.js.map +1 -0
  54. package/exceptions/installer-unsigned.exception.js +19 -0
  55. package/exceptions/installer-unsigned.exception.js.map +1 -0
  56. package/exceptions/not-an-app-image.exception.js +15 -0
  57. package/exceptions/not-an-app-image.exception.js.map +1 -0
  58. package/exceptions/path-command.exception.js +18 -0
  59. package/exceptions/path-command.exception.js.map +1 -0
  60. package/exceptions/processes-not-exited.exception.js +19 -0
  61. package/exceptions/processes-not-exited.exception.js.map +1 -0
  62. package/exceptions/program.exception.js +18 -0
  63. package/exceptions/program.exception.js.map +1 -0
  64. package/exceptions/restart-arguments-not-written.exception.js +15 -0
  65. package/exceptions/restart-arguments-not-written.exception.js.map +1 -0
  66. package/exceptions/runtime-starter-ended.exception.js +15 -0
  67. package/exceptions/runtime-starter-ended.exception.js.map +1 -0
  68. package/exceptions/runtime-starter-failed.exception.js +17 -0
  69. package/exceptions/runtime-starter-failed.exception.js.map +1 -0
  70. package/exceptions/ship-it-not-found.exception.js +15 -0
  71. package/exceptions/ship-it-not-found.exception.js.map +1 -0
  72. package/exceptions/ship-it-not-removed.exception.js +16 -0
  73. package/exceptions/ship-it-not-removed.exception.js.map +1 -0
  74. package/exceptions/ship-it-unreadable.exception.js +16 -0
  75. package/exceptions/ship-it-unreadable.exception.js.map +1 -0
  76. package/exceptions/stale-update.exception.js +14 -0
  77. package/exceptions/stale-update.exception.js.map +1 -0
  78. package/exceptions/unusable-folder.exception.js +18 -0
  79. package/exceptions/unusable-folder.exception.js.map +1 -0
  80. package/exceptions/update-changed-before-handoff.exception.js +15 -0
  81. package/exceptions/update-changed-before-handoff.exception.js.map +1 -0
  82. package/exceptions/update-checker-unknown.exception.js +15 -0
  83. package/exceptions/update-checker-unknown.exception.js.map +1 -0
  84. package/exceptions/update-download-interrupted.exception.js +15 -0
  85. package/exceptions/update-download-interrupted.exception.js.map +1 -0
  86. package/exceptions/update-download-mismatch.exception.js +15 -0
  87. package/exceptions/update-download-mismatch.exception.js.map +1 -0
  88. package/exceptions/update-failed-unexpectedly.exception.js +15 -0
  89. package/exceptions/update-failed-unexpectedly.exception.js.map +1 -0
  90. package/exceptions/update-feed-redirected.exception.js +15 -0
  91. package/exceptions/update-feed-redirected.exception.js.map +1 -0
  92. package/exceptions/update-feed-refused.exception.js +17 -0
  93. package/exceptions/update-feed-refused.exception.js.map +1 -0
  94. package/exceptions/update-feed-unreachable.exception.js +15 -0
  95. package/exceptions/update-feed-unreachable.exception.js.map +1 -0
  96. package/exceptions/update-handoff.exception.js +14 -0
  97. package/exceptions/update-handoff.exception.js.map +1 -0
  98. package/exceptions/update-holder-not-found.exception.js +15 -0
  99. package/exceptions/update-holder-not-found.exception.js.map +1 -0
  100. package/exceptions/update-info-invalid.exception.js +15 -0
  101. package/exceptions/update-info-invalid.exception.js.map +1 -0
  102. package/exceptions/update-no-longer-offered.exception.js +17 -0
  103. package/exceptions/update-no-longer-offered.exception.js.map +1 -0
  104. package/exceptions/update-not-signed.exception.js +15 -0
  105. package/exceptions/update-not-signed.exception.js.map +1 -0
  106. package/exceptions/update-not-staged-in-time.exception.js +15 -0
  107. package/exceptions/update-not-staged-in-time.exception.js.map +1 -0
  108. package/exceptions/update-not-staged.exception.js +15 -0
  109. package/exceptions/update-not-staged.exception.js.map +1 -0
  110. package/exceptions/update-refused.exception.js +19 -0
  111. package/exceptions/update-refused.exception.js.map +1 -0
  112. package/exceptions/update-runtime-not-found.exception.js +17 -0
  113. package/exceptions/update-runtime-not-found.exception.js.map +1 -0
  114. package/exceptions/update-runtime-not-reached.exception.js +17 -0
  115. package/exceptions/update-runtime-not-reached.exception.js.map +1 -0
  116. package/exceptions/update-runtime-still-starting.exception.js +17 -0
  117. package/exceptions/update-runtime-still-starting.exception.js.map +1 -0
  118. package/exceptions/update-stop-failed-unexpectedly.exception.js +15 -0
  119. package/exceptions/update-stop-failed-unexpectedly.exception.js.map +1 -0
  120. package/exceptions/update-stop.exception.js +14 -0
  121. package/exceptions/update-stop.exception.js.map +1 -0
  122. package/exceptions/update-under-way.exception.js +15 -0
  123. package/exceptions/update-under-way.exception.js.map +1 -0
  124. package/exceptions/update-unsaved.exception.js +19 -0
  125. package/exceptions/update-unsaved.exception.js.map +1 -0
  126. package/exceptions/update.exception.js +14 -0
  127. package/exceptions/update.exception.js.map +1 -0
  128. package/exceptions/window-state-not-connected.exception.js +15 -0
  129. package/exceptions/window-state-not-connected.exception.js.map +1 -0
  130. package/exceptions/window-state-refused.exception.js +19 -0
  131. package/exceptions/window-state-refused.exception.js.map +1 -0
  132. package/exceptions/window-state-runtime-unreachable.exception.js +15 -0
  133. package/exceptions/window-state-runtime-unreachable.exception.js.map +1 -0
  134. package/exceptions/window-state-unavailable.exception.js +14 -0
  135. package/exceptions/window-state-unavailable.exception.js.map +1 -0
  136. package/exceptions/window-state.exception.js +14 -0
  137. package/exceptions/window-state.exception.js.map +1 -0
  138. package/exceptions/work-started-meanwhile.exception.js +17 -0
  139. package/exceptions/work-started-meanwhile.exception.js.map +1 -0
  140. package/interfaces/i-app-updater.js +9 -0
  141. package/interfaces/i-app-updater.js.map +1 -0
  142. package/interfaces/i-application-host.js +9 -0
  143. package/interfaces/i-application-host.js.map +1 -0
  144. package/interfaces/i-checked-path.js +9 -0
  145. package/interfaces/i-checked-path.js.map +1 -0
  146. package/interfaces/i-clipboard-host.js +9 -0
  147. package/interfaces/i-clipboard-host.js.map +1 -0
  148. package/interfaces/i-close-guard.js +9 -0
  149. package/interfaces/i-close-guard.js.map +1 -0
  150. package/interfaces/i-command-line-host.js +9 -0
  151. package/interfaces/i-command-line-host.js.map +1 -0
  152. package/interfaces/i-context-menu-params.js +9 -0
  153. package/interfaces/i-context-menu-params.js.map +1 -0
  154. package/interfaces/i-created-updater.js +9 -0
  155. package/interfaces/i-created-updater.js.map +1 -0
  156. package/interfaces/i-device-file-store.js +9 -0
  157. package/interfaces/i-device-file-store.js.map +1 -0
  158. package/interfaces/i-dialog-host.js +9 -0
  159. package/interfaces/i-dialog-host.js.map +1 -0
  160. package/interfaces/i-display-host.js +9 -0
  161. package/interfaces/i-display-host.js.map +1 -0
  162. package/interfaces/i-dock-host.js +9 -0
  163. package/interfaces/i-dock-host.js.map +1 -0
  164. package/interfaces/i-electron.js +9 -0
  165. package/interfaces/i-electron.js.map +1 -0
  166. package/interfaces/i-feed-net-session.js +9 -0
  167. package/interfaces/i-feed-net-session.js.map +1 -0
  168. package/interfaces/i-feed-response.js +9 -0
  169. package/interfaces/i-feed-response.js.map +1 -0
  170. package/interfaces/i-feed-runtime-options.js +9 -0
  171. package/interfaces/i-feed-runtime-options.js.map +1 -0
  172. package/interfaces/i-feed-web-request.js +9 -0
  173. package/interfaces/i-feed-web-request.js.map +1 -0
  174. package/interfaces/i-ipc-event.js +9 -0
  175. package/interfaces/i-ipc-event.js.map +1 -0
  176. package/interfaces/i-ipc-host.js +9 -0
  177. package/interfaces/i-ipc-host.js.map +1 -0
  178. package/interfaces/i-ipc-owners.js +9 -0
  179. package/interfaces/i-ipc-owners.js.map +1 -0
  180. package/interfaces/i-main-process-environment.js +9 -0
  181. package/interfaces/i-main-process-environment.js.map +1 -0
  182. package/interfaces/i-main-process-log.js +9 -0
  183. package/interfaces/i-main-process-log.js.map +1 -0
  184. package/interfaces/i-main-process-options.js +9 -0
  185. package/interfaces/i-main-process-options.js.map +1 -0
  186. package/interfaces/i-main-process-tray-parts.js +9 -0
  187. package/interfaces/i-main-process-tray-parts.js.map +1 -0
  188. package/interfaces/i-main-process-update-parts.js +9 -0
  189. package/interfaces/i-main-process-update-parts.js.map +1 -0
  190. package/interfaces/i-main-process-window.js +9 -0
  191. package/interfaces/i-main-process-window.js.map +1 -0
  192. package/interfaces/i-menu-host.js +9 -0
  193. package/interfaces/i-menu-host.js.map +1 -0
  194. package/interfaces/i-native-updater.js +9 -0
  195. package/interfaces/i-native-updater.js.map +1 -0
  196. package/interfaces/i-notification-host.js +9 -0
  197. package/interfaces/i-notification-host.js.map +1 -0
  198. package/interfaces/i-parent-port.js +9 -0
  199. package/interfaces/i-parent-port.js.map +1 -0
  200. package/interfaces/i-path-command-files.js +9 -0
  201. package/interfaces/i-path-command-files.js.map +1 -0
  202. package/interfaces/i-permission-host.js +9 -0
  203. package/interfaces/i-permission-host.js.map +1 -0
  204. package/interfaces/i-preload-channels.js +9 -0
  205. package/interfaces/i-preload-channels.js.map +1 -0
  206. package/interfaces/i-preload-settings.js +9 -0
  207. package/interfaces/i-preload-settings.js.map +1 -0
  208. package/interfaces/i-preventable-event.js +9 -0
  209. package/interfaces/i-preventable-event.js.map +1 -0
  210. package/interfaces/i-program-host.js +9 -0
  211. package/interfaces/i-program-host.js.map +1 -0
  212. package/interfaces/i-protocol-host.js +9 -0
  213. package/interfaces/i-protocol-host.js.map +1 -0
  214. package/interfaces/i-quit-control-parts.js +9 -0
  215. package/interfaces/i-quit-control-parts.js.map +1 -0
  216. package/interfaces/i-quit-host.js +9 -0
  217. package/interfaces/i-quit-host.js.map +1 -0
  218. package/interfaces/i-quit-prompt.js +9 -0
  219. package/interfaces/i-quit-prompt.js.map +1 -0
  220. package/interfaces/i-runtime-connection.js +9 -0
  221. package/interfaces/i-runtime-connection.js.map +1 -0
  222. package/interfaces/i-runtime-event-owners.js +9 -0
  223. package/interfaces/i-runtime-event-owners.js.map +1 -0
  224. package/interfaces/i-runtime-launcher.js +9 -0
  225. package/interfaces/i-runtime-launcher.js.map +1 -0
  226. package/interfaces/i-scheme-registry.js +9 -0
  227. package/interfaces/i-scheme-registry.js.map +1 -0
  228. package/interfaces/i-secret-storage-host.js +9 -0
  229. package/interfaces/i-secret-storage-host.js.map +1 -0
  230. package/interfaces/i-sender-frame.js +9 -0
  231. package/interfaces/i-sender-frame.js.map +1 -0
  232. package/interfaces/i-session-host.js +9 -0
  233. package/interfaces/i-session-host.js.map +1 -0
  234. package/interfaces/i-shell-host.js +9 -0
  235. package/interfaces/i-shell-host.js.map +1 -0
  236. package/interfaces/i-ship-it-process.js +9 -0
  237. package/interfaces/i-ship-it-process.js.map +1 -0
  238. package/interfaces/i-shortcut-host.js +9 -0
  239. package/interfaces/i-shortcut-host.js.map +1 -0
  240. package/interfaces/i-shown-path-files.js +9 -0
  241. package/interfaces/i-shown-path-files.js.map +1 -0
  242. package/interfaces/i-shown-path-status.js +9 -0
  243. package/interfaces/i-shown-path-status.js.map +1 -0
  244. package/interfaces/i-spell-check-host.js +9 -0
  245. package/interfaces/i-spell-check-host.js.map +1 -0
  246. package/interfaces/i-split-path.js +9 -0
  247. package/interfaces/i-split-path.js.map +1 -0
  248. package/interfaces/i-system-notification.js +9 -0
  249. package/interfaces/i-system-notification.js.map +1 -0
  250. package/interfaces/i-theme-host.js +9 -0
  251. package/interfaces/i-theme-host.js.map +1 -0
  252. package/interfaces/i-tray-actions.js +9 -0
  253. package/interfaces/i-tray-actions.js.map +1 -0
  254. package/interfaces/i-tray-host.js +9 -0
  255. package/interfaces/i-tray-host.js.map +1 -0
  256. package/interfaces/i-tray.js +9 -0
  257. package/interfaces/i-tray.js.map +1 -0
  258. package/interfaces/i-update-check-lock.js +9 -0
  259. package/interfaces/i-update-check-lock.js.map +1 -0
  260. package/interfaces/i-update-handoff.js +9 -0
  261. package/interfaces/i-update-handoff.js.map +1 -0
  262. package/interfaces/i-update-host.js +9 -0
  263. package/interfaces/i-update-host.js.map +1 -0
  264. package/interfaces/i-update-setup.js +9 -0
  265. package/interfaces/i-update-setup.js.map +1 -0
  266. package/interfaces/i-update-target.js +9 -0
  267. package/interfaces/i-update-target.js.map +1 -0
  268. package/interfaces/i-updater.js +9 -0
  269. package/interfaces/i-updater.js.map +1 -0
  270. package/interfaces/i-utility-process-host.js +9 -0
  271. package/interfaces/i-utility-process-host.js.map +1 -0
  272. package/interfaces/i-utility-process.js +9 -0
  273. package/interfaces/i-utility-process.js.map +1 -0
  274. package/interfaces/i-web-view-attach-params.js +9 -0
  275. package/interfaces/i-web-view-attach-params.js.map +1 -0
  276. package/interfaces/i-web-view-attach-preferences.js +9 -0
  277. package/interfaces/i-web-view-attach-preferences.js.map +1 -0
  278. package/interfaces/i-web-view-contents.js +9 -0
  279. package/interfaces/i-web-view-contents.js.map +1 -0
  280. package/interfaces/i-web-view-debugger.js +9 -0
  281. package/interfaces/i-web-view-debugger.js.map +1 -0
  282. package/interfaces/i-web-view-engine.js +9 -0
  283. package/interfaces/i-web-view-engine.js.map +1 -0
  284. package/interfaces/i-web-view-guest.js +9 -0
  285. package/interfaces/i-web-view-guest.js.map +1 -0
  286. package/interfaces/i-web-view-input-event.js +9 -0
  287. package/interfaces/i-web-view-input-event.js.map +1 -0
  288. package/interfaces/i-web-view-input.js +9 -0
  289. package/interfaces/i-web-view-input.js.map +1 -0
  290. package/interfaces/i-web-view-key-event.js +9 -0
  291. package/interfaces/i-web-view-key-event.js.map +1 -0
  292. package/interfaces/i-web-view-redirect.js +9 -0
  293. package/interfaces/i-web-view-redirect.js.map +1 -0
  294. package/interfaces/i-web-view-request.js +9 -0
  295. package/interfaces/i-web-view-request.js.map +1 -0
  296. package/interfaces/i-web-view-session.js +9 -0
  297. package/interfaces/i-web-view-session.js.map +1 -0
  298. package/interfaces/i-window-contents.js +9 -0
  299. package/interfaces/i-window-contents.js.map +1 -0
  300. package/interfaces/i-window-navigation.js +9 -0
  301. package/interfaces/i-window-navigation.js.map +1 -0
  302. package/interfaces/i-window-open-details.js +9 -0
  303. package/interfaces/i-window-open-details.js.map +1 -0
  304. package/interfaces/i-window-session.js +9 -0
  305. package/interfaces/i-window-session.js.map +1 -0
  306. package/interfaces/i-window-state-store.js +9 -0
  307. package/interfaces/i-window-state-store.js.map +1 -0
  308. package/main.js +160 -0
  309. package/main.js.map +1 -0
  310. package/models/caught-failure.js +15 -0
  311. package/models/caught-failure.js.map +1 -0
  312. package/models/detached-start-reply.js +51 -0
  313. package/models/detached-start-reply.js.map +1 -0
  314. package/models/detached-start-request.js +45 -0
  315. package/models/detached-start-request.js.map +1 -0
  316. package/models/error-code.js +22 -0
  317. package/models/error-code.js.map +1 -0
  318. package/models/feed-source.js +32 -0
  319. package/models/feed-source.js.map +1 -0
  320. package/models/file-grant-request.js +35 -0
  321. package/models/file-grant-request.js.map +1 -0
  322. package/models/file-path-choice.js +38 -0
  323. package/models/file-path-choice.js.map +1 -0
  324. package/models/issued-files.js +21 -0
  325. package/models/issued-files.js.map +1 -0
  326. package/models/known-device.js +32 -0
  327. package/models/known-device.js.map +1 -0
  328. package/models/longest-text.js +35 -0
  329. package/models/longest-text.js.map +1 -0
  330. package/models/main-process-phase.js +13 -0
  331. package/models/main-process-phase.js.map +1 -0
  332. package/models/main-process-settings.js +34 -0
  333. package/models/main-process-settings.js.map +1 -0
  334. package/models/menu-bar-menu.js +25 -0
  335. package/models/menu-bar-menu.js.map +1 -0
  336. package/models/menu-bar-row.js +49 -0
  337. package/models/menu-bar-row.js.map +1 -0
  338. package/models/menu-bar.js +20 -0
  339. package/models/menu-bar.js.map +1 -0
  340. package/models/offered-file.js +50 -0
  341. package/models/offered-file.js.map +1 -0
  342. package/models/pending-quit.js +26 -0
  343. package/models/pending-quit.js.map +1 -0
  344. package/models/preload-settings.js +21 -0
  345. package/models/preload-settings.js.map +1 -0
  346. package/models/quit-question.js +22 -0
  347. package/models/quit-question.js.map +1 -0
  348. package/models/screen-area.js +31 -0
  349. package/models/screen-area.js.map +1 -0
  350. package/models/sender-info.js +18 -0
  351. package/models/sender-info.js.map +1 -0
  352. package/models/started-program.js +17 -0
  353. package/models/started-program.js.map +1 -0
  354. package/models/startup-state.js +45 -0
  355. package/models/startup-state.js.map +1 -0
  356. package/models/taskbar-identity.js +48 -0
  357. package/models/taskbar-identity.js.map +1 -0
  358. package/models/update-ready-record.js +37 -0
  359. package/models/update-ready-record.js.map +1 -0
  360. package/models/update-status.js +40 -0
  361. package/models/update-status.js.map +1 -0
  362. package/models/update-stop-result.js +22 -0
  363. package/models/update-stop-result.js.map +1 -0
  364. package/models/update-version.js +43 -0
  365. package/models/update-version.js.map +1 -0
  366. package/models/web-view-history.js +19 -0
  367. package/models/web-view-history.js.map +1 -0
  368. package/models/window-appearance.js +52 -0
  369. package/models/window-appearance.js.map +1 -0
  370. package/models/window-page.js +23 -0
  371. package/models/window-page.js.map +1 -0
  372. package/models/window-registry.js +85 -0
  373. package/models/window-registry.js.map +1 -0
  374. package/models/window-state.js +93 -0
  375. package/models/window-state.js.map +1 -0
  376. package/package.json +78 -3
  377. package/preload.cjs +186 -0
  378. package/preload.cjs.map +1 -0
  379. package/resources.js +1549 -0
  380. package/resources.js.map +1 -0
  381. package/services/agent-controller.js +61 -0
  382. package/services/agent-controller.js.map +1 -0
  383. package/services/app-icons.js +49 -0
  384. package/services/app-icons.js.map +1 -0
  385. package/services/app-image-environment.js +34 -0
  386. package/services/app-image-environment.js.map +1 -0
  387. package/services/app-image-handoff.js +33 -0
  388. package/services/app-image-handoff.js.map +1 -0
  389. package/services/app-image-replacement.js +82 -0
  390. package/services/app-image-replacement.js.map +1 -0
  391. package/services/app-image-restart.js +71 -0
  392. package/services/app-image-restart.js.map +1 -0
  393. package/services/app-surface-feed.js +114 -0
  394. package/services/app-surface-feed.js.map +1 -0
  395. package/services/appearance-keeper.js +67 -0
  396. package/services/appearance-keeper.js.map +1 -0
  397. package/services/application-menu.js +14 -0
  398. package/services/application-menu.js.map +1 -0
  399. package/services/child-program-host.js +59 -0
  400. package/services/child-program-host.js.map +1 -0
  401. package/services/clipboard-copier.js +82 -0
  402. package/services/clipboard-copier.js.map +1 -0
  403. package/services/close-coordinator.js +47 -0
  404. package/services/close-coordinator.js.map +1 -0
  405. package/services/command-installer.js +58 -0
  406. package/services/command-installer.js.map +1 -0
  407. package/services/daily-check-mark.js +61 -0
  408. package/services/daily-check-mark.js.map +1 -0
  409. package/services/debian-handoff.js +41 -0
  410. package/services/debian-handoff.js.map +1 -0
  411. package/services/debian-package.js +24 -0
  412. package/services/debian-package.js.map +1 -0
  413. package/services/detached-start.js +27 -0
  414. package/services/detached-start.js.map +1 -0
  415. package/services/device-file-store.js +45 -0
  416. package/services/device-file-store.js.map +1 -0
  417. package/services/device-identity.js +39 -0
  418. package/services/device-identity.js.map +1 -0
  419. package/services/device-setting-follower.js +61 -0
  420. package/services/device-setting-follower.js.map +1 -0
  421. package/services/device-state.js +51 -0
  422. package/services/device-state.js.map +1 -0
  423. package/services/electron-web-view-contents.js +96 -0
  424. package/services/electron-web-view-contents.js.map +1 -0
  425. package/services/electron-web-view-engine.js +42 -0
  426. package/services/electron-web-view-engine.js.map +1 -0
  427. package/services/electron-web-view-session.js +47 -0
  428. package/services/electron-web-view-session.js.map +1 -0
  429. package/services/feed-provider.js +84 -0
  430. package/services/feed-provider.js.map +1 -0
  431. package/services/feed-request-guard.js +63 -0
  432. package/services/feed-request-guard.js.map +1 -0
  433. package/services/feed-session.js +30 -0
  434. package/services/feed-session.js.map +1 -0
  435. package/services/feed-updater.js +119 -0
  436. package/services/feed-updater.js.map +1 -0
  437. package/services/file-dialogs.js +180 -0
  438. package/services/file-dialogs.js.map +1 -0
  439. package/services/file-grant-issuer.js +119 -0
  440. package/services/file-grant-issuer.js.map +1 -0
  441. package/services/file-presence.js +14 -0
  442. package/services/file-presence.js.map +1 -0
  443. package/services/installer-handoff.js +75 -0
  444. package/services/installer-handoff.js.map +1 -0
  445. package/services/installer-start.js +35 -0
  446. package/services/installer-start.js.map +1 -0
  447. package/services/ipc-router.js +114 -0
  448. package/services/ipc-router.js.map +1 -0
  449. package/services/layout-keeper.js +52 -0
  450. package/services/layout-keeper.js.map +1 -0
  451. package/services/local-window-state-store.js +38 -0
  452. package/services/local-window-state-store.js.map +1 -0
  453. package/services/main-process-log.js +81 -0
  454. package/services/main-process-log.js.map +1 -0
  455. package/services/main-process-record.js +19 -0
  456. package/services/main-process-record.js.map +1 -0
  457. package/services/main-process-recovery.js +98 -0
  458. package/services/main-process-recovery.js.map +1 -0
  459. package/services/main-process-services.js +34 -0
  460. package/services/main-process-services.js.map +1 -0
  461. package/services/main-process-tray.js +64 -0
  462. package/services/main-process-tray.js.map +1 -0
  463. package/services/main-process-updates.js +69 -0
  464. package/services/main-process-updates.js.map +1 -0
  465. package/services/main-process.js +530 -0
  466. package/services/main-process.js.map +1 -0
  467. package/services/menu-bar-template.js +78 -0
  468. package/services/menu-bar-template.js.map +1 -0
  469. package/services/mirrored-window-state-store.js +26 -0
  470. package/services/mirrored-window-state-store.js.map +1 -0
  471. package/services/open-web-view.js +784 -0
  472. package/services/open-web-view.js.map +1 -0
  473. package/services/open-web-view.resources.js +13 -0
  474. package/services/open-web-view.resources.js.map +1 -0
  475. package/services/open-window.js +155 -0
  476. package/services/open-window.js.map +1 -0
  477. package/services/opened-file-policy.js +46 -0
  478. package/services/opened-file-policy.js.map +1 -0
  479. package/services/path-command.js +78 -0
  480. package/services/path-command.js.map +1 -0
  481. package/services/product-app-adapter.js +30 -0
  482. package/services/product-app-adapter.js.map +1 -0
  483. package/services/publisher-check.js +78 -0
  484. package/services/publisher-check.js.map +1 -0
  485. package/services/quit-control.js +78 -0
  486. package/services/quit-control.js.map +1 -0
  487. package/services/quit-coordinator.js +98 -0
  488. package/services/quit-coordinator.js.map +1 -0
  489. package/services/quit-flow.js +59 -0
  490. package/services/quit-flow.js.map +1 -0
  491. package/services/restart-arguments.js +58 -0
  492. package/services/restart-arguments.js.map +1 -0
  493. package/services/runtime-caller.js +31 -0
  494. package/services/runtime-caller.js.map +1 -0
  495. package/services/runtime-events.js +100 -0
  496. package/services/runtime-events.js.map +1 -0
  497. package/services/runtime-requests.js +92 -0
  498. package/services/runtime-requests.js.map +1 -0
  499. package/services/runtime-startup.js +228 -0
  500. package/services/runtime-startup.js.map +1 -0
  501. package/services/runtime-window-state-store.js +50 -0
  502. package/services/runtime-window-state-store.js.map +1 -0
  503. package/services/secret-answerer.js +57 -0
  504. package/services/secret-answerer.js.map +1 -0
  505. package/services/sender-policy.js +24 -0
  506. package/services/sender-policy.js.map +1 -0
  507. package/services/shared-file-server.js +71 -0
  508. package/services/shared-file-server.js.map +1 -0
  509. package/services/shell-opener.js +88 -0
  510. package/services/shell-opener.js.map +1 -0
  511. package/services/ship-it-process.js +54 -0
  512. package/services/ship-it-process.js.map +1 -0
  513. package/services/shown-file-policy.js +95 -0
  514. package/services/shown-file-policy.js.map +1 -0
  515. package/services/spell-checker.js +62 -0
  516. package/services/spell-checker.js.map +1 -0
  517. package/services/spelling-dictionaries.js +58 -0
  518. package/services/spelling-dictionaries.js.map +1 -0
  519. package/services/squirrel-handoff.js +98 -0
  520. package/services/squirrel-handoff.js.map +1 -0
  521. package/services/stop-key-controller.js +97 -0
  522. package/services/stop-key-controller.js.map +1 -0
  523. package/services/system-notifier.js +103 -0
  524. package/services/system-notifier.js.map +1 -0
  525. package/services/terminal-relaunch.js +52 -0
  526. package/services/terminal-relaunch.js.map +1 -0
  527. package/services/tray-controller.js +164 -0
  528. package/services/tray-controller.js.map +1 -0
  529. package/services/tray-host-watcher.js +86 -0
  530. package/services/tray-host-watcher.js.map +1 -0
  531. package/services/tray-menu-template.js +42 -0
  532. package/services/tray-menu-template.js.map +1 -0
  533. package/services/tray-notices.js +76 -0
  534. package/services/tray-notices.js.map +1 -0
  535. package/services/tray-refresher.js +72 -0
  536. package/services/tray-refresher.js.map +1 -0
  537. package/services/update-barrier-gate.js +78 -0
  538. package/services/update-barrier-gate.js.map +1 -0
  539. package/services/update-barrier-watch.js +83 -0
  540. package/services/update-barrier-watch.js.map +1 -0
  541. package/services/update-bridge.js +86 -0
  542. package/services/update-bridge.js.map +1 -0
  543. package/services/update-check-lock.js +120 -0
  544. package/services/update-check-lock.js.map +1 -0
  545. package/services/update-controller.js +325 -0
  546. package/services/update-controller.js.map +1 -0
  547. package/services/update-restart.js +139 -0
  548. package/services/update-restart.js.map +1 -0
  549. package/services/update-save-coordinator.js +48 -0
  550. package/services/update-save-coordinator.js.map +1 -0
  551. package/services/update-stop.js +222 -0
  552. package/services/update-stop.js.map +1 -0
  553. package/services/update-target-connector.js +84 -0
  554. package/services/update-target-connector.js.map +1 -0
  555. package/services/update-work-question.js +84 -0
  556. package/services/update-work-question.js.map +1 -0
  557. package/services/utility-process-starter.js +47 -0
  558. package/services/utility-process-starter.js.map +1 -0
  559. package/services/web-view-attach-guard.js +41 -0
  560. package/services/web-view-attach-guard.js.map +1 -0
  561. package/services/web-view-bridge.js +55 -0
  562. package/services/web-view-bridge.js.map +1 -0
  563. package/services/web-view-event-backlog.js +38 -0
  564. package/services/web-view-event-backlog.js.map +1 -0
  565. package/services/web-view-event-cut.js +42 -0
  566. package/services/web-view-event-cut.js.map +1 -0
  567. package/services/web-view-host.js +340 -0
  568. package/services/web-view-host.js.map +1 -0
  569. package/services/web-view-key-input.js +37 -0
  570. package/services/web-view-key-input.js.map +1 -0
  571. package/services/web-view-origin-check.js +150 -0
  572. package/services/web-view-origin-check.js.map +1 -0
  573. package/services/web-view-origin-check.resources.js +46 -0
  574. package/services/web-view-origin-check.resources.js.map +1 -0
  575. package/services/window-bounds-keeper.js +145 -0
  576. package/services/window-bounds-keeper.js.map +1 -0
  577. package/services/window-controls.js +97 -0
  578. package/services/window-controls.js.map +1 -0
  579. package/services/window-error-limit.js +32 -0
  580. package/services/window-error-limit.js.map +1 -0
  581. package/services/window-factory.js +87 -0
  582. package/services/window-factory.js.map +1 -0
  583. package/services/window-placement.js +67 -0
  584. package/services/window-placement.js.map +1 -0
  585. package/services/window-recovery.js +138 -0
  586. package/services/window-recovery.js.map +1 -0
  587. package/services/window-text-log.js +37 -0
  588. package/services/window-text-log.js.map +1 -0
  589. package/utility-entry.js +11 -0
  590. package/utility-entry.js.map +1 -0
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import "@noldova/context.core";
9
+ import { SettingEntry, SettingKey } from "@noldova/desktop.protocol";
10
+ import { Resources } from "../resources.js";
11
+ export class DeviceSettingFollower {
12
+ name;
13
+ readAsync;
14
+ onChange;
15
+ log;
16
+ current;
17
+ generation = 0;
18
+ constructor(name, initial, readAsync, onChange, log) {
19
+ this.name = name;
20
+ this.current = initial;
21
+ this.readAsync = readAsync;
22
+ this.onChange = onChange;
23
+ this.log = log;
24
+ }
25
+ get value() {
26
+ return this.current;
27
+ }
28
+ startFrom(value) {
29
+ this.current = value;
30
+ }
31
+ async refreshAsync(device) {
32
+ const generation = ++this.generation;
33
+ const response = await this.readAsync(new SettingKey(this.name, null, device));
34
+ if (generation !== this.generation)
35
+ return;
36
+ const failure = response.failure;
37
+ if (!Object.isUndefined(failure)) {
38
+ this.log(Resources.formatSettingNotRead(this.name.text, failure.message));
39
+ return;
40
+ }
41
+ try {
42
+ this.set(SettingEntry.fromJson(response.payload).value);
43
+ }
44
+ catch (error) {
45
+ this.log(Resources.formatSettingNotRead(this.name.text, String(error)));
46
+ }
47
+ }
48
+ receive(change, device) {
49
+ if (change.key.name.text !== this.name.text || change.key.device !== device || !Object.isNull(change.key.scope))
50
+ return;
51
+ this.generation++;
52
+ this.set(change.value);
53
+ }
54
+ set(value) {
55
+ if (JSON.stringify(value) === JSON.stringify(this.current))
56
+ return;
57
+ this.current = value;
58
+ this.onChange(value);
59
+ }
60
+ }
61
+ //# sourceMappingURL=device-setting-follower.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-setting-follower.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/device-setting-follower.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAyD,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5H,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,qBAAqB;IACf,IAAI,CAAgB;IACpB,SAAS,CAAyC;IAClD,QAAQ,CAA6B;IACrC,GAAG,CAAyB;IACrC,OAAO,CAAY;IACnB,UAAU,GAAW,CAAC,CAAC;IAE/B,YAAmB,IAAmB,EAAE,OAAkB,EAAE,SAAiD,EAAE,QAAoC,EAAE,GAA2B;QAC9K,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,SAAS,CAAC,KAAgB;QAC/B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,MAAqB;QAC7C,MAAM,UAAU,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC;QACrC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC/E,IAAI,UAAU,KAAK,IAAI,CAAC,UAAU;YAChC,OAAO;QACT,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC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in the root directory of this source tree.
7
+ */
8
+ import { Resources } from "../resources.js";
9
+ export class DeviceState {
10
+ store;
11
+ log;
12
+ shown = new Set();
13
+ state;
14
+ writing = Promise.resolve();
15
+ constructor(store, log) {
16
+ this.store = store;
17
+ this.log = log;
18
+ this.state = undefined;
19
+ }
20
+ readAsync() {
21
+ this.state ??= this.loadAsync();
22
+ return this.state;
23
+ }
24
+ async showOnceAsync(key, showAsync) {
25
+ if (this.shown.has(key))
26
+ return;
27
+ this.shown.add(key);
28
+ const state = await this.readAsync();
29
+ if (state[key] === true || !await showAsync())
30
+ return;
31
+ await this.rememberAsync(key, true);
32
+ }
33
+ rememberAsync(key, value) {
34
+ this.writing = this.writing.then(async () => {
35
+ const state = { ...await this.readAsync(), [key]: value };
36
+ this.state = Promise.resolve(state);
37
+ await this.store.writeAsync(state);
38
+ }).catch((error) => this.log(Resources.formatDeviceStateUnsaved(key, String(error))));
39
+ return this.writing;
40
+ }
41
+ async loadAsync() {
42
+ try {
43
+ return await this.store.readAsync() ?? {};
44
+ }
45
+ catch (error) {
46
+ this.log(Resources.formatDeviceStateNotRead(String(error)));
47
+ return {};
48
+ }
49
+ }
50
+ }
51
+ //# sourceMappingURL=device-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-state.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/device-state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,WAAW;IACL,KAAK,CAAmB;IACxB,GAAG,CAAyB;IAC5B,KAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;IACxC,KAAK,CAAkC;IACvC,OAAO,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAEnD,YAAmB,KAAuB,EAAE,GAA2B;QACrE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,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IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC;QAC5C,CAAC;QACD,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,wBAAwB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC5D,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { WebViewHistory } from "../models/web-view-history.js";
9
+ export class ElectronWebViewContents {
10
+ page;
11
+ history;
12
+ events;
13
+ id;
14
+ debugger;
15
+ constructor(page) {
16
+ this.page = page;
17
+ this.history = page.navigationHistory;
18
+ this.events = page;
19
+ this.id = page.id;
20
+ this.debugger = page.debugger;
21
+ }
22
+ loadURL(url) {
23
+ return this.page.loadURL(url);
24
+ }
25
+ getURL() {
26
+ return this.page.getURL();
27
+ }
28
+ getTitle() {
29
+ return this.page.getTitle();
30
+ }
31
+ isLoading() {
32
+ return this.page.isLoading();
33
+ }
34
+ isDestroyed() {
35
+ return this.page.isDestroyed();
36
+ }
37
+ canGoBack() {
38
+ return this.history.canGoBack();
39
+ }
40
+ canGoForward() {
41
+ return this.history.canGoForward();
42
+ }
43
+ readHistoryEntry(offset) {
44
+ const index = this.history.getActiveIndex() + offset;
45
+ return index >= 0 && index < this.history.length() ? this.history.getEntryAtIndex(index).url : null;
46
+ }
47
+ readHistory() {
48
+ return new WebViewHistory(this.history.getAllEntries(), this.history.getActiveIndex());
49
+ }
50
+ restoreHistoryAsync(history) {
51
+ return this.history.restore({ entries: [...history.entries], index: history.index });
52
+ }
53
+ goBack() {
54
+ this.history.goBack();
55
+ }
56
+ goForward() {
57
+ this.history.goForward();
58
+ }
59
+ reload() {
60
+ this.page.reload();
61
+ }
62
+ stop() {
63
+ this.page.stop();
64
+ }
65
+ setWindowOpenHandler(handler) {
66
+ this.page.setWindowOpenHandler(handler);
67
+ }
68
+ setWebRTCIPHandlingPolicy(policy) {
69
+ this.page.setWebRTCIPHandlingPolicy(policy);
70
+ }
71
+ getZoomFactor() {
72
+ return this.page.getZoomFactor();
73
+ }
74
+ setZoomFactor(factor) {
75
+ this.page.setZoomFactor(factor);
76
+ }
77
+ findInPage(text, options) {
78
+ return this.page.findInPage(text, options);
79
+ }
80
+ stopFindInPage(action) {
81
+ this.page.stopFindInPage(action);
82
+ }
83
+ sendInputEvent(event) {
84
+ this.page.sendInputEvent({ type: event.type, keyCode: event.keyCode, modifiers: [...event.modifiers] });
85
+ }
86
+ insertText(text) {
87
+ return this.page.insertText(text);
88
+ }
89
+ executeJavaScriptInIsolatedWorld(worldId, scripts) {
90
+ return this.page.executeJavaScriptInIsolatedWorld(worldId, scripts);
91
+ }
92
+ on(event, listener) {
93
+ return this.events.on(event, listener);
94
+ }
95
+ }
96
+ //# sourceMappingURL=electron-web-view-contents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electron-web-view-contents.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/electron-web-view-contents.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,OAAO,uBAAuB;IACjB,IAAI,CAAc;IAClB,OAAO,CAAoB;IAC3B,MAAM,CAAe;IAEtB,EAAE,CAAS;IACX,QAAQ,CAAmB;IAE3C,YAAmB,IAAiB;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAChC,CAAC;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CAAC,OAAe,EAAE,OAA2B;QAClF,OAAO,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;IAEM,EAAE,CAA4B,KAAa,EAAE,QAAsC;QACxF,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { setTimeout as delay } from "node:timers/promises";
9
+ import "@noldova/context.core";
10
+ import { app, session, webContents } from "electron";
11
+ import { Resources } from "../resources.js";
12
+ import { ElectronWebViewContents } from "./electron-web-view-contents.js";
13
+ import { ElectronWebViewSession } from "./electron-web-view-session.js";
14
+ import { WebViewAttachGuard } from "./web-view-attach-guard.js";
15
+ export class ElectronWebViewEngine {
16
+ partitions = new WeakMap();
17
+ readSession(partition) {
18
+ const profile = session.fromPartition(partition, { cache: false });
19
+ this.partitions.set(profile, partition);
20
+ return new ElectronWebViewSession(profile);
21
+ }
22
+ findGuest(contentsId) {
23
+ const guest = webContents.fromId(contentsId);
24
+ if (Object.isUndefined(guest) || guest.isDestroyed() || guest.getType() !== Resources.webViewContentsType)
25
+ return null;
26
+ return { contents: new ElectronWebViewContents(guest), hostId: guest.hostWebContents?.id ?? null, partition: this.partitions.get(guest.session) ?? null };
27
+ }
28
+ watchAttach(isAllowed, log, claim = () => false, attached = () => undefined) {
29
+ const guard = new WebViewAttachGuard(isAllowed, claim, log);
30
+ app.on(Resources.webContentsCreatedEvent, (_event, contents) => {
31
+ contents.on(Resources.willAttachWebviewEvent, (event, preferences, params) => guard.judge(contents.id, contents.getType() === Resources.webViewContentsType, event, preferences, params));
32
+ contents.on(Resources.didAttachWebviewEvent, (_event, guest) => attached(contents.id, new ElectronWebViewContents(guest)));
33
+ });
34
+ }
35
+ now() {
36
+ return performance.now();
37
+ }
38
+ waitAsync(milliseconds, signal) {
39
+ return delay(milliseconds, undefined, { signal });
40
+ }
41
+ }
42
+ //# sourceMappingURL=electron-web-view-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electron-web-view-engine.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/electron-web-view-engine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EAAgB,MAAM,UAAU,CAAC;AAMnE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,OAAO,qBAAqB;IACf,UAAU,GAA6B,IAAI,OAAO,EAAE,CAAC;IAE/D,WAAW,CAAC,SAAiB;QAClC,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACnE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACxC,OAAO,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAEM,SAAS,CAAC,UAAkB;QACjC,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,OAAO,EAAE,KAAK,SAAS,CAAC,mBAAmB;YACvG,OAAO,IAA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;CACF"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import "@noldova/context.core";
9
+ import { webContents } from "electron";
10
+ export class ElectronWebViewSession {
11
+ profile;
12
+ constructor(profile) {
13
+ this.profile = profile;
14
+ }
15
+ setPermissionRequestHandler(handler) {
16
+ this.profile.setPermissionRequestHandler(handler);
17
+ }
18
+ setPermissionCheckHandler(handler) {
19
+ this.profile.setPermissionCheckHandler(handler);
20
+ }
21
+ setDevicePermissionHandler(handler) {
22
+ this.profile.setDevicePermissionHandler(handler);
23
+ }
24
+ setDisplayMediaRequestHandler(handler) {
25
+ this.profile.setDisplayMediaRequestHandler((request, callback) => handler(Object.isNull(request.frame) ? null : webContents.fromFrame(request.frame)?.id ?? null, () => callback({})));
26
+ }
27
+ onBeforeRequest(listener) {
28
+ this.profile.webRequest.onBeforeRequest((details, callback) => listener(details, callback));
29
+ }
30
+ onBeforeSendHeaders(listener) {
31
+ this.profile.webRequest.onBeforeSendHeaders((details, callback) => listener(details, callback));
32
+ }
33
+ onBeforeRedirect(listener) {
34
+ this.profile.webRequest.onBeforeRedirect(details => listener(details));
35
+ }
36
+ on(event, listener) {
37
+ return this.profile.on(event, (download, item, contents) => listener(download, item.getURL(), contents.id));
38
+ }
39
+ async resolveHostAsync(host) {
40
+ return (await this.profile.resolveHost(host)).endpoints.map(t => t.address);
41
+ }
42
+ async clearStorageDataAsync() {
43
+ await this.profile.clearStorageData();
44
+ await this.profile.clearCache();
45
+ }
46
+ }
47
+ //# sourceMappingURL=electron-web-view-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electron-web-view-session.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/electron-web-view-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAgB,WAAW,EAAE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AI,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IACzE,CAAC;IAEM,EAAE,CAAC,KAAsB,EAAE,QAAuF;QACvH,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9G,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,IAAY;QACxC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC9E,CAAC;IAEM,KAAK,CAAC,qBAAqB;QAChC,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QACtC,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;CACF"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { URL } from "node:url";
9
+ import { Provider } from "electron-updater";
10
+ import "@noldova/context.core";
11
+ import { ArgumentException, ExceptionOptions } from "@noldova/context.exceptions";
12
+ import { JsonException, JsonReader } from "@noldova/context.json";
13
+ import { UpdateFeedRedirectedException } from "../exceptions/update-feed-redirected.exception.js";
14
+ import { UpdateFeedRefusedException } from "../exceptions/update-feed-refused.exception.js";
15
+ import { UpdateFeedUnreachableException } from "../exceptions/update-feed-unreachable.exception.js";
16
+ import { UpdateInfoInvalidException } from "../exceptions/update-info-invalid.exception.js";
17
+ import { CaughtFailure } from "../models/caught-failure.js";
18
+ import { FeedSource } from "../models/feed-source.js";
19
+ import { Resources } from "../resources.js";
20
+ import { ProductAppAdapter } from "./product-app-adapter.js";
21
+ export class FeedProvider extends Provider {
22
+ source;
23
+ base;
24
+ constructor(options, _updater, runtimeOptions) {
25
+ super(ProductAppAdapter.toProviderOptions(runtimeOptions));
26
+ const source = options[Resources.feedSourceOption];
27
+ if (!(source instanceof FeedSource))
28
+ throw new ArgumentException(Resources.feedSourceMissing, Resources.feedSourceOption);
29
+ this.source = source;
30
+ this.base = undefined;
31
+ }
32
+ async getLatestVersion() {
33
+ const requested = new URL(this.source.channelFile, this.source.feed);
34
+ const signal = this.source.timeout(Resources.updateFeedTimeout);
35
+ const response = await FeedProvider.reach(this.source.fetchAsync(requested.href, signal));
36
+ if (!response.ok)
37
+ throw new UpdateFeedRefusedException(response.status);
38
+ const url = response.url.length > 0 ? new URL(response.url) : requested;
39
+ if (url.protocol !== requested.protocol)
40
+ throw new UpdateFeedRedirectedException();
41
+ const info = FeedProvider.parse(await FeedProvider.reach(response.text()), this.source.channelFile, url);
42
+ FeedProvider.check(info);
43
+ if (Object.isUndefined(FeedProvider.findPackage(info, this.source.packageFile)))
44
+ throw new UpdateInfoInvalidException();
45
+ this.base = url;
46
+ return info;
47
+ }
48
+ resolveFiles(updateInfo) {
49
+ const file = FeedProvider.findPackage(updateInfo, this.source.packageFile);
50
+ if (Object.isUndefined(this.base) || Object.isUndefined(file))
51
+ throw new UpdateInfoInvalidException();
52
+ return [{ url: new URL(this.source.packageFile, this.base), info: file }];
53
+ }
54
+ static async reach(operation) {
55
+ try {
56
+ return await operation;
57
+ }
58
+ catch (error) {
59
+ throw new UpdateFeedUnreachableException(new ExceptionOptions(error));
60
+ }
61
+ }
62
+ static parse(text, channelFile, url) {
63
+ try {
64
+ return ProductAppAdapter.parseUpdateInfo(text, channelFile, url);
65
+ }
66
+ catch (error) {
67
+ throw new UpdateInfoInvalidException(new ExceptionOptions(error));
68
+ }
69
+ }
70
+ static check(info) {
71
+ try {
72
+ const reader = JsonReader.fromValue({ [Resources.updateVersionField]: info?.version, [Resources.updateFilesField]: info?.files });
73
+ reader.readNonBlankString(Resources.updateVersionField);
74
+ reader.readObjectArray(Resources.updateFilesField);
75
+ }
76
+ catch (error) {
77
+ throw new UpdateInfoInvalidException(new ExceptionOptions(CaughtFailure.expect(error, JsonException)));
78
+ }
79
+ }
80
+ static findPackage(info, packageFile) {
81
+ return info.files.find(t => Object.isObject(t) && t.url === packageFile && Object.isString(t.sha512) && t.sha512.length > 0 && Number.isInteger(t.size) && Number(t.size) > 0);
82
+ }
83
+ }
84
+ //# sourceMappingURL=feed-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feed-provider.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/feed-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAqE,MAAM,kBAAkB,CAAC;AAE/G,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAE5F,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC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license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { URL } from "node:url";
9
+ import "@noldova/context.core";
10
+ import { Resources } from "../resources.js";
11
+ export class FeedRequestGuard {
12
+ origins;
13
+ product;
14
+ mark;
15
+ log;
16
+ marked;
17
+ constructor(feed, product, mark, log) {
18
+ this.origins = [new URL(feed).origin, ...Resources.updateAssetOrigins];
19
+ this.product = product;
20
+ this.mark = mark;
21
+ this.log = log;
22
+ this.marked = undefined;
23
+ }
24
+ static formatUserAgent(product, isDaily) {
25
+ const [slug, version, platform, architecture] = product;
26
+ return Resources.formatFeedUserAgent(slug, version, [platform, architecture, ...isDaily ? [Resources.dailyCheckToken] : []]);
27
+ }
28
+ allows(url) {
29
+ return URL.canParse(url) && this.origins.includes(new URL(url).origin);
30
+ }
31
+ headersOf(headers, isDaily) {
32
+ const kept = Object.entries(headers).filter(([name]) => Resources.updateSentHeaders.includes(name.toLowerCase()));
33
+ return Object.fromEntries([...kept, [Resources.userAgentHeader, FeedRequestGuard.formatUserAgent(this.product, isDaily)]]);
34
+ }
35
+ install(webRequest) {
36
+ webRequest.onBeforeRequest((details, callback) => {
37
+ const isAllowed = this.allows(details.url);
38
+ if (!isAllowed)
39
+ this.log(Resources.formatUpdateRequestCancelled(URL.canParse(details.url) ? new URL(details.url).host : Resources.invalidAddress));
40
+ callback({ cancel: !isAllowed });
41
+ });
42
+ webRequest.onBeforeSendHeaders((details, callback) => {
43
+ void this.mark.takeAsync().then(isDaily => {
44
+ if (isDaily)
45
+ this.marked = details.id;
46
+ callback({ requestHeaders: this.headersOf(details.requestHeaders, isDaily) });
47
+ });
48
+ });
49
+ webRequest.onResponseStarted(details => {
50
+ if (details.id === this.marked) {
51
+ this.marked = undefined;
52
+ void this.mark.recordAsync();
53
+ }
54
+ });
55
+ webRequest.onErrorOccurred(details => {
56
+ if (details.id === this.marked) {
57
+ this.marked = undefined;
58
+ this.mark.release();
59
+ }
60
+ });
61
+ }
62
+ }
63
+ //# sourceMappingURL=feed-request-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feed-request-guard.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/feed-request-guard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,uBAAuB,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,OAAO,gBAAgB;IACV,OAAO,CAAoB;IAC3B,OAAO,CAAmF;IAC1F,IAAI,CAAiB;IACrB,GAAG,CAAyB;IACrC,MAAM,CAAqB;IAEnC,YAAmB,IAAY,EAAE,OAAyF,EAAE,IAAoB,EAC9I,GAA2B;QAC3B,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACvE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,OAAyF,EAAE,OAAgB;QACvI,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,GAAG,OAAO,CAAC;QACxD,OAAO,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/H,CAAC;IAEM,MAAM,CAAC,GAAW;QACvB,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CA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,OAAO;oBACT,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;gBAC3B,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;YAChF,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,UAAU,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE;YACrC,IAAI,OAAO,CAAC,EAAE,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;gBAC/B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;gBACxB,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAC/B,CAAC;QACH,CAAC,CAAC,CAAC;QACH,UAAU,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE;YACnC,IAAI,OAAO,CAAC,EAAE,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;gBAC/B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;gBACxB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YACtB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import "@noldova/context.core";
9
+ export class FeedSession {
10
+ create;
11
+ guard;
12
+ session;
13
+ constructor(create, guard) {
14
+ this.create = create;
15
+ this.guard = guard;
16
+ this.session = undefined;
17
+ }
18
+ fetchAsync(url, signal) {
19
+ return this.open().fetch(url, { signal });
20
+ }
21
+ open() {
22
+ if (Object.isUndefined(this.session)) {
23
+ const created = this.create();
24
+ this.guard.install(created.webRequest);
25
+ this.session = created;
26
+ }
27
+ return this.session;
28
+ }
29
+ }
30
+ //# sourceMappingURL=feed-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feed-session.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/feed-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAM/B,MAAM,OAAO,WAAW;IACL,MAAM,CAAwB;IAC9B,KAAK,CAAmB;IACjC,OAAO,CAA8B;IAE7C,YAAmB,MAA6B,EAAE,KAAuB;QACvE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;IAC3B,CAAC;IAEM,UAAU,CAAC,GAAW,EAAE,MAAmB;QAChD,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;IAEO,IAAI;QACV,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { mkdir, rm, writeFile } from "node:fs/promises";
9
+ import { basename, dirname, join } from "node:path";
10
+ import { CancellationToken } from "electron-updater";
11
+ import "@noldova/context.core";
12
+ import { ExceptionOptions } from "@noldova/context.exceptions";
13
+ import { UpdateDownloadInterruptedException } from "../exceptions/update-download-interrupted.exception.js";
14
+ import { UpdateDownloadMismatchException } from "../exceptions/update-download-mismatch.exception.js";
15
+ import { UpdateFailedUnexpectedlyException } from "../exceptions/update-failed-unexpectedly.exception.js";
16
+ import { UpdateInfoInvalidException } from "../exceptions/update-info-invalid.exception.js";
17
+ import { UpdateNotSignedException } from "../exceptions/update-not-signed.exception.js";
18
+ import { UpdateException } from "../exceptions/update.exception.js";
19
+ import { UpdateVersion } from "../models/update-version.js";
20
+ import { ErrorCode } from "../models/error-code.js";
21
+ import { Resources } from "../resources.js";
22
+ import { FeedProvider } from "./feed-provider.js";
23
+ export class FeedUpdater {
24
+ updater;
25
+ source;
26
+ configFile;
27
+ configuration;
28
+ verifyAsync;
29
+ log;
30
+ cancellation;
31
+ isConfigured = false;
32
+ downloaded = null;
33
+ packagePath;
34
+ constructor(updater, source, installationFolder, cacheRoot, productSlug, verifyAsync, log) {
35
+ const cacheFolder = Resources.formatUpdateCacheFolder(productSlug, basename(installationFolder));
36
+ this.updater = updater;
37
+ this.source = source;
38
+ this.configFile = join(installationFolder, Resources.updateConfigFile);
39
+ this.configuration = JSON.stringify({ [Resources.updaterCacheFolderField]: cacheFolder });
40
+ this.verifyAsync = verifyAsync;
41
+ this.log = log;
42
+ this.packagePath = join(cacheRoot, cacheFolder, Resources.pendingUpdateFolder, source.packageFile);
43
+ this.cancellation = undefined;
44
+ updater.autoDownload = false;
45
+ updater.autoInstallOnAppQuit = false;
46
+ updater.allowDowngrade = false;
47
+ updater.allowPrerelease = false;
48
+ updater.disableDifferentialDownload = true;
49
+ updater.disableWebInstaller = true;
50
+ updater.logger = { info: () => undefined, warn: (message) => log(Resources.formatUpdaterMessage(String(message))), error: (message) => log(Resources.formatUpdaterMessage(String(message))) };
51
+ updater.isUpdateSupported = info => UpdateVersion.isOffered(info.version);
52
+ }
53
+ get downloadedFile() {
54
+ return this.downloaded;
55
+ }
56
+ async checkAsync() {
57
+ try {
58
+ await this.configureAsync();
59
+ const result = await this.updater.checkForUpdates();
60
+ return Object.isNull(result) || !result.isUpdateAvailable ? null : result.updateInfo.version;
61
+ }
62
+ catch (error) {
63
+ throw FeedUpdater.explain(error, UpdateFailedUnexpectedlyException);
64
+ }
65
+ }
66
+ async downloadAsync(onProgress) {
67
+ const listener = (info) => onProgress(Math.floor(info.percent));
68
+ const cancellation = new CancellationToken();
69
+ this.cancellation = cancellation;
70
+ this.downloaded = null;
71
+ this.updater.on(Resources.downloadProgressEvent, listener);
72
+ try {
73
+ const [file] = await this.updater.downloadUpdate(cancellation);
74
+ if (Object.isUndefined(file))
75
+ throw new UpdateDownloadInterruptedException();
76
+ if (file !== this.packagePath)
77
+ throw new UpdateFailedUnexpectedlyException();
78
+ await this.verifyPublisherAsync(file);
79
+ this.downloaded = file;
80
+ return file;
81
+ }
82
+ catch (error) {
83
+ throw FeedUpdater.explain(error, UpdateDownloadInterruptedException);
84
+ }
85
+ finally {
86
+ this.updater.removeListener(Resources.downloadProgressEvent, listener);
87
+ this.cancellation = undefined;
88
+ }
89
+ }
90
+ cancel() {
91
+ this.cancellation?.cancel();
92
+ }
93
+ async verifyPublisherAsync(file) {
94
+ if (Object.isNull(this.verifyAsync) || Object.isNull(await this.verifyAsync(file)))
95
+ return;
96
+ await rm(file, { force: true }).catch((error) => this.log(Resources.formatUpdateNotDeleted(String(error))));
97
+ throw new UpdateNotSignedException();
98
+ }
99
+ static explain(error, otherwise) {
100
+ if (error instanceof UpdateException)
101
+ return error;
102
+ const options = new ExceptionOptions(error);
103
+ if (ErrorCode.isOneOf(error, Resources.updateInfoInvalidCodes))
104
+ return new UpdateInfoInvalidException(options);
105
+ if (ErrorCode.isOneOf(error, Resources.updateDownloadMismatchCodes))
106
+ return new UpdateDownloadMismatchException(options);
107
+ return ErrorCode.isOneOf(error, Resources.updateNotSignedCodes) ? new UpdateNotSignedException(options) : new otherwise(options);
108
+ }
109
+ async configureAsync() {
110
+ if (this.isConfigured)
111
+ return;
112
+ await mkdir(dirname(this.configFile), { recursive: true });
113
+ await writeFile(this.configFile, this.configuration, Resources.textEncoding);
114
+ this.updater.updateConfigPath = this.configFile;
115
+ this.updater.setFeedURL({ provider: Resources.customProvider, updateProvider: FeedProvider, source: this.source });
116
+ this.isConfigured = true;
117
+ }
118
+ }
119
+ //# sourceMappingURL=feed-updater.js.map