@bobfrankston/mailx 1.0.9 → 1.0.13

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 (246) hide show
  1. package/bin/mailx.js +47 -29
  2. package/bin/postinstall.js +41 -0
  3. package/client/app.js +93 -13
  4. package/client/components/folder-tree.js +84 -3
  5. package/client/components/message-list.js +134 -8
  6. package/client/components/message-viewer.js +130 -13
  7. package/client/compose/compose.html +4 -4
  8. package/client/compose/compose.js +53 -34
  9. package/client/index.html +33 -9
  10. package/client/lib/api-client.js +102 -30
  11. package/client/lib/mailxapi.js +123 -0
  12. package/client/package.json +5 -1
  13. package/client/styles/components.css +188 -15
  14. package/client/styles/layout.css +2 -1
  15. package/killmail.cmd +6 -0
  16. package/launch.ps1 +48 -3
  17. package/launcher/bin/mailx-app.exe +0 -0
  18. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Breadcrumbs +0 -0
  19. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Crashpad/metadata +0 -0
  20. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Crashpad/settings.dat +0 -0
  21. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Crashpad/throttle_store.dat +1 -0
  22. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/CrashpadMetrics-active.pma +0 -0
  23. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/BrowsingTopicsSiteData +0 -0
  24. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Cache/No_Vary_Search/journal.baj +1 -0
  25. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/DIPS +0 -0
  26. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/DashTrackerDatabase +0 -0
  27. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/EdgeJourneys/EdgeJourneys.db +0 -0
  28. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension Rules/LOCK +0 -0
  29. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension Rules/LOG +3 -0
  30. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension Rules/MANIFEST-000001 +0 -0
  31. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension Scripts/LOCK +0 -0
  32. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension Scripts/LOG +3 -0
  33. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension Scripts/MANIFEST-000001 +0 -0
  34. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension State/LOCK +0 -0
  35. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension State/LOG +3 -0
  36. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension State/MANIFEST-000001 +0 -0
  37. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/ExtensionActivityComp +0 -0
  38. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/ExtensionActivityEdge +0 -0
  39. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Favicons +0 -0
  40. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/History +0 -0
  41. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/History-journal +0 -0
  42. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/IndexedDB/devtools_devtools_0.indexeddb.leveldb/LOCK +0 -0
  43. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/IndexedDB/devtools_devtools_0.indexeddb.leveldb/LOG +3 -0
  44. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/IndexedDB/devtools_devtools_0.indexeddb.leveldb/MANIFEST-000001 +0 -0
  45. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Local Storage/leveldb/LOCK +0 -0
  46. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Local Storage/leveldb/LOG +3 -0
  47. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Local Storage/leveldb/MANIFEST-000001 +0 -0
  48. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Login Data +0 -0
  49. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Login Data For Account +0 -0
  50. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Network/Cookies +0 -0
  51. NEL +0 -0
  52. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Network/Trust Tokens +0 -0
  53. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Network Action Predictor +0 -0
  54. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Preferences +1 -0
  55. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Safe Browsing Network/Safe Browsing Cookies +0 -0
  56. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/ServerCertificate +0 -0
  57. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Session Storage/LOCK +0 -0
  58. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Session Storage/LOG +3 -0
  59. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Session Storage/MANIFEST-000001 +0 -0
  60. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Shared Dictionary/db +0 -0
  61. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/SharedStorage +0 -0
  62. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Shortcuts +0 -0
  63. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Site Characteristics Database/LOCK +0 -0
  64. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Site Characteristics Database/LOG +3 -0
  65. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Site Characteristics Database/MANIFEST-000001 +0 -0
  66. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Sync Data/LevelDB/LOCK +0 -0
  67. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Sync Data/LevelDB/LOG +3 -0
  68. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Sync Data/LevelDB/MANIFEST-000001 +0 -0
  69. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Top Sites +0 -0
  70. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Vpn Tokens +0 -0
  71. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Web Data +0 -0
  72. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Web Data-journal +0 -0
  73. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/WebStorage/QuotaManager +0 -0
  74. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/WebStorage/QuotaManager-journal +0 -0
  75. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/heavy_ad_intervention_opt_out.db +0 -0
  76. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/shared_proto_db/LOCK +0 -0
  77. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/shared_proto_db/LOG +3 -0
  78. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/shared_proto_db/MANIFEST-000001 +0 -0
  79. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/shared_proto_db/metadata/LOCK +0 -0
  80. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/shared_proto_db/metadata/LOG +3 -0
  81. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/shared_proto_db/metadata/MANIFEST-000001 +0 -0
  82. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/DeferredBrowserMetrics/BrowserMetrics-69CAD063-BE24.pma +0 -0
  83. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Local State +1 -0
  84. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Variations +1 -0
  85. package/launcher/bin/mailx-app.old.exe +0 -0
  86. package/launcher/mailx.ico +0 -0
  87. package/npmg.bat +6 -0
  88. package/package.json +9 -3
  89. package/packages/mailx-api/index.js +79 -26
  90. package/packages/mailx-api/package.json +5 -1
  91. package/packages/mailx-compose/package.json +5 -1
  92. package/packages/mailx-core/index.d.ts +129 -0
  93. package/packages/mailx-core/index.js +323 -0
  94. package/packages/mailx-core/ipc.d.ts +13 -0
  95. package/packages/mailx-core/ipc.js +56 -0
  96. package/packages/mailx-core/package.json +18 -0
  97. package/packages/mailx-imap/index.d.ts +5 -1
  98. package/packages/mailx-imap/index.js +76 -14
  99. package/packages/mailx-imap/package.json +5 -1
  100. package/packages/mailx-send/package.json +12 -2
  101. package/packages/mailx-server/index.js +42 -31
  102. package/packages/mailx-server/package.json +5 -2
  103. package/packages/mailx-settings/index.d.ts +1 -1
  104. package/packages/mailx-settings/index.js +21 -12
  105. package/packages/mailx-settings/package.json +5 -1
  106. package/packages/mailx-store/db.d.ts +5 -1
  107. package/packages/mailx-store/db.js +64 -12
  108. package/packages/mailx-store/file-store.d.ts +2 -8
  109. package/packages/mailx-store/file-store.js +7 -31
  110. package/packages/mailx-store/package.json +5 -1
  111. package/packages/mailx-types/index.d.ts +3 -1
  112. package/packages/mailx-types/package.json +6 -2
  113. package/.tswalk.json +0 -3366
  114. package/mailx.json +0 -9
  115. package/packages/mailx-api/node_modules/nodemailer/.ncurc.js +0 -9
  116. package/packages/mailx-api/node_modules/nodemailer/.prettierignore +0 -8
  117. package/packages/mailx-api/node_modules/nodemailer/.prettierrc +0 -12
  118. package/packages/mailx-api/node_modules/nodemailer/.prettierrc.js +0 -10
  119. package/packages/mailx-api/node_modules/nodemailer/.release-please-config.json +0 -9
  120. package/packages/mailx-api/node_modules/nodemailer/LICENSE +0 -16
  121. package/packages/mailx-api/node_modules/nodemailer/README.md +0 -86
  122. package/packages/mailx-api/node_modules/nodemailer/SECURITY.txt +0 -22
  123. package/packages/mailx-api/node_modules/nodemailer/eslint.config.js +0 -88
  124. package/packages/mailx-api/node_modules/nodemailer/lib/addressparser/index.js +0 -383
  125. package/packages/mailx-api/node_modules/nodemailer/lib/base64/index.js +0 -139
  126. package/packages/mailx-api/node_modules/nodemailer/lib/dkim/index.js +0 -253
  127. package/packages/mailx-api/node_modules/nodemailer/lib/dkim/message-parser.js +0 -155
  128. package/packages/mailx-api/node_modules/nodemailer/lib/dkim/relaxed-body.js +0 -154
  129. package/packages/mailx-api/node_modules/nodemailer/lib/dkim/sign.js +0 -117
  130. package/packages/mailx-api/node_modules/nodemailer/lib/fetch/cookies.js +0 -281
  131. package/packages/mailx-api/node_modules/nodemailer/lib/fetch/index.js +0 -280
  132. package/packages/mailx-api/node_modules/nodemailer/lib/json-transport/index.js +0 -82
  133. package/packages/mailx-api/node_modules/nodemailer/lib/mail-composer/index.js +0 -629
  134. package/packages/mailx-api/node_modules/nodemailer/lib/mailer/index.js +0 -441
  135. package/packages/mailx-api/node_modules/nodemailer/lib/mailer/mail-message.js +0 -316
  136. package/packages/mailx-api/node_modules/nodemailer/lib/mime-funcs/index.js +0 -625
  137. package/packages/mailx-api/node_modules/nodemailer/lib/mime-funcs/mime-types.js +0 -2113
  138. package/packages/mailx-api/node_modules/nodemailer/lib/mime-node/index.js +0 -1316
  139. package/packages/mailx-api/node_modules/nodemailer/lib/mime-node/last-newline.js +0 -33
  140. package/packages/mailx-api/node_modules/nodemailer/lib/mime-node/le-unix.js +0 -43
  141. package/packages/mailx-api/node_modules/nodemailer/lib/mime-node/le-windows.js +0 -52
  142. package/packages/mailx-api/node_modules/nodemailer/lib/nodemailer.js +0 -157
  143. package/packages/mailx-api/node_modules/nodemailer/lib/punycode/index.js +0 -460
  144. package/packages/mailx-api/node_modules/nodemailer/lib/qp/index.js +0 -227
  145. package/packages/mailx-api/node_modules/nodemailer/lib/sendmail-transport/index.js +0 -210
  146. package/packages/mailx-api/node_modules/nodemailer/lib/ses-transport/index.js +0 -234
  147. package/packages/mailx-api/node_modules/nodemailer/lib/shared/index.js +0 -754
  148. package/packages/mailx-api/node_modules/nodemailer/lib/smtp-connection/data-stream.js +0 -108
  149. package/packages/mailx-api/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +0 -143
  150. package/packages/mailx-api/node_modules/nodemailer/lib/smtp-connection/index.js +0 -1870
  151. package/packages/mailx-api/node_modules/nodemailer/lib/smtp-pool/index.js +0 -652
  152. package/packages/mailx-api/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +0 -259
  153. package/packages/mailx-api/node_modules/nodemailer/lib/smtp-transport/index.js +0 -421
  154. package/packages/mailx-api/node_modules/nodemailer/lib/stream-transport/index.js +0 -135
  155. package/packages/mailx-api/node_modules/nodemailer/lib/well-known/index.js +0 -47
  156. package/packages/mailx-api/node_modules/nodemailer/lib/well-known/services.json +0 -611
  157. package/packages/mailx-api/node_modules/nodemailer/lib/xoauth2/index.js +0 -427
  158. package/packages/mailx-api/node_modules/nodemailer/package.json +0 -47
  159. package/packages/mailx-imap/node_modules/nodemailer/.ncurc.js +0 -9
  160. package/packages/mailx-imap/node_modules/nodemailer/.prettierignore +0 -8
  161. package/packages/mailx-imap/node_modules/nodemailer/.prettierrc +0 -12
  162. package/packages/mailx-imap/node_modules/nodemailer/.prettierrc.js +0 -10
  163. package/packages/mailx-imap/node_modules/nodemailer/.release-please-config.json +0 -9
  164. package/packages/mailx-imap/node_modules/nodemailer/LICENSE +0 -16
  165. package/packages/mailx-imap/node_modules/nodemailer/README.md +0 -86
  166. package/packages/mailx-imap/node_modules/nodemailer/SECURITY.txt +0 -22
  167. package/packages/mailx-imap/node_modules/nodemailer/eslint.config.js +0 -88
  168. package/packages/mailx-imap/node_modules/nodemailer/lib/addressparser/index.js +0 -383
  169. package/packages/mailx-imap/node_modules/nodemailer/lib/base64/index.js +0 -139
  170. package/packages/mailx-imap/node_modules/nodemailer/lib/dkim/index.js +0 -253
  171. package/packages/mailx-imap/node_modules/nodemailer/lib/dkim/message-parser.js +0 -155
  172. package/packages/mailx-imap/node_modules/nodemailer/lib/dkim/relaxed-body.js +0 -154
  173. package/packages/mailx-imap/node_modules/nodemailer/lib/dkim/sign.js +0 -117
  174. package/packages/mailx-imap/node_modules/nodemailer/lib/fetch/cookies.js +0 -281
  175. package/packages/mailx-imap/node_modules/nodemailer/lib/fetch/index.js +0 -280
  176. package/packages/mailx-imap/node_modules/nodemailer/lib/json-transport/index.js +0 -82
  177. package/packages/mailx-imap/node_modules/nodemailer/lib/mail-composer/index.js +0 -629
  178. package/packages/mailx-imap/node_modules/nodemailer/lib/mailer/index.js +0 -441
  179. package/packages/mailx-imap/node_modules/nodemailer/lib/mailer/mail-message.js +0 -316
  180. package/packages/mailx-imap/node_modules/nodemailer/lib/mime-funcs/index.js +0 -625
  181. package/packages/mailx-imap/node_modules/nodemailer/lib/mime-funcs/mime-types.js +0 -2113
  182. package/packages/mailx-imap/node_modules/nodemailer/lib/mime-node/index.js +0 -1316
  183. package/packages/mailx-imap/node_modules/nodemailer/lib/mime-node/last-newline.js +0 -33
  184. package/packages/mailx-imap/node_modules/nodemailer/lib/mime-node/le-unix.js +0 -43
  185. package/packages/mailx-imap/node_modules/nodemailer/lib/mime-node/le-windows.js +0 -52
  186. package/packages/mailx-imap/node_modules/nodemailer/lib/nodemailer.js +0 -157
  187. package/packages/mailx-imap/node_modules/nodemailer/lib/punycode/index.js +0 -460
  188. package/packages/mailx-imap/node_modules/nodemailer/lib/qp/index.js +0 -227
  189. package/packages/mailx-imap/node_modules/nodemailer/lib/sendmail-transport/index.js +0 -210
  190. package/packages/mailx-imap/node_modules/nodemailer/lib/ses-transport/index.js +0 -234
  191. package/packages/mailx-imap/node_modules/nodemailer/lib/shared/index.js +0 -754
  192. package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-connection/data-stream.js +0 -108
  193. package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +0 -143
  194. package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-connection/index.js +0 -1870
  195. package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-pool/index.js +0 -652
  196. package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +0 -259
  197. package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-transport/index.js +0 -421
  198. package/packages/mailx-imap/node_modules/nodemailer/lib/stream-transport/index.js +0 -135
  199. package/packages/mailx-imap/node_modules/nodemailer/lib/well-known/index.js +0 -47
  200. package/packages/mailx-imap/node_modules/nodemailer/lib/well-known/services.json +0 -611
  201. package/packages/mailx-imap/node_modules/nodemailer/lib/xoauth2/index.js +0 -427
  202. package/packages/mailx-imap/node_modules/nodemailer/package.json +0 -47
  203. package/packages/mailx-send/node_modules/nodemailer/.ncurc.js +0 -9
  204. package/packages/mailx-send/node_modules/nodemailer/.prettierignore +0 -8
  205. package/packages/mailx-send/node_modules/nodemailer/.prettierrc +0 -12
  206. package/packages/mailx-send/node_modules/nodemailer/.prettierrc.js +0 -10
  207. package/packages/mailx-send/node_modules/nodemailer/.release-please-config.json +0 -9
  208. package/packages/mailx-send/node_modules/nodemailer/LICENSE +0 -16
  209. package/packages/mailx-send/node_modules/nodemailer/README.md +0 -86
  210. package/packages/mailx-send/node_modules/nodemailer/SECURITY.txt +0 -22
  211. package/packages/mailx-send/node_modules/nodemailer/eslint.config.js +0 -88
  212. package/packages/mailx-send/node_modules/nodemailer/lib/addressparser/index.js +0 -383
  213. package/packages/mailx-send/node_modules/nodemailer/lib/base64/index.js +0 -139
  214. package/packages/mailx-send/node_modules/nodemailer/lib/dkim/index.js +0 -253
  215. package/packages/mailx-send/node_modules/nodemailer/lib/dkim/message-parser.js +0 -155
  216. package/packages/mailx-send/node_modules/nodemailer/lib/dkim/relaxed-body.js +0 -154
  217. package/packages/mailx-send/node_modules/nodemailer/lib/dkim/sign.js +0 -117
  218. package/packages/mailx-send/node_modules/nodemailer/lib/fetch/cookies.js +0 -281
  219. package/packages/mailx-send/node_modules/nodemailer/lib/fetch/index.js +0 -280
  220. package/packages/mailx-send/node_modules/nodemailer/lib/json-transport/index.js +0 -82
  221. package/packages/mailx-send/node_modules/nodemailer/lib/mail-composer/index.js +0 -629
  222. package/packages/mailx-send/node_modules/nodemailer/lib/mailer/index.js +0 -441
  223. package/packages/mailx-send/node_modules/nodemailer/lib/mailer/mail-message.js +0 -316
  224. package/packages/mailx-send/node_modules/nodemailer/lib/mime-funcs/index.js +0 -625
  225. package/packages/mailx-send/node_modules/nodemailer/lib/mime-funcs/mime-types.js +0 -2113
  226. package/packages/mailx-send/node_modules/nodemailer/lib/mime-node/index.js +0 -1316
  227. package/packages/mailx-send/node_modules/nodemailer/lib/mime-node/last-newline.js +0 -33
  228. package/packages/mailx-send/node_modules/nodemailer/lib/mime-node/le-unix.js +0 -43
  229. package/packages/mailx-send/node_modules/nodemailer/lib/mime-node/le-windows.js +0 -52
  230. package/packages/mailx-send/node_modules/nodemailer/lib/nodemailer.js +0 -157
  231. package/packages/mailx-send/node_modules/nodemailer/lib/punycode/index.js +0 -460
  232. package/packages/mailx-send/node_modules/nodemailer/lib/qp/index.js +0 -227
  233. package/packages/mailx-send/node_modules/nodemailer/lib/sendmail-transport/index.js +0 -210
  234. package/packages/mailx-send/node_modules/nodemailer/lib/ses-transport/index.js +0 -234
  235. package/packages/mailx-send/node_modules/nodemailer/lib/shared/index.js +0 -754
  236. package/packages/mailx-send/node_modules/nodemailer/lib/smtp-connection/data-stream.js +0 -108
  237. package/packages/mailx-send/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +0 -143
  238. package/packages/mailx-send/node_modules/nodemailer/lib/smtp-connection/index.js +0 -1870
  239. package/packages/mailx-send/node_modules/nodemailer/lib/smtp-pool/index.js +0 -652
  240. package/packages/mailx-send/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +0 -259
  241. package/packages/mailx-send/node_modules/nodemailer/lib/smtp-transport/index.js +0 -421
  242. package/packages/mailx-send/node_modules/nodemailer/lib/stream-transport/index.js +0 -135
  243. package/packages/mailx-send/node_modules/nodemailer/lib/well-known/index.js +0 -47
  244. package/packages/mailx-send/node_modules/nodemailer/lib/well-known/services.json +0 -611
  245. package/packages/mailx-send/node_modules/nodemailer/lib/xoauth2/index.js +0 -427
  246. package/packages/mailx-send/node_modules/nodemailer/package.json +0 -47
@@ -1,652 +0,0 @@
1
- 'use strict';
2
-
3
- const EventEmitter = require('events');
4
- const PoolResource = require('./pool-resource');
5
- const SMTPConnection = require('../smtp-connection');
6
- const wellKnown = require('../well-known');
7
- const shared = require('../shared');
8
- const packageData = require('../../package.json');
9
-
10
- /**
11
- * Creates a SMTP pool transport object for Nodemailer
12
- *
13
- * @constructor
14
- * @param {Object} options SMTP Connection options
15
- */
16
- class SMTPPool extends EventEmitter {
17
- constructor(options) {
18
- super();
19
-
20
- options = options || {};
21
- if (typeof options === 'string') {
22
- options = {
23
- url: options
24
- };
25
- }
26
-
27
- let urlData;
28
- let service = options.service;
29
-
30
- if (typeof options.getSocket === 'function') {
31
- this.getSocket = options.getSocket;
32
- }
33
-
34
- if (options.url) {
35
- urlData = shared.parseConnectionUrl(options.url);
36
- service = service || urlData.service;
37
- }
38
-
39
- this.options = shared.assign(
40
- false, // create new object
41
- options, // regular options
42
- urlData, // url options
43
- service && wellKnown(service) // wellknown options
44
- );
45
-
46
- this.options.maxConnections = this.options.maxConnections || 5;
47
- this.options.maxMessages = this.options.maxMessages || 100;
48
-
49
- this.logger = shared.getLogger(this.options, {
50
- component: this.options.component || 'smtp-pool'
51
- });
52
-
53
- // temporary object
54
- let connection = new SMTPConnection(this.options);
55
-
56
- this.name = 'SMTP (pool)';
57
- this.version = packageData.version + '[client:' + connection.version + ']';
58
-
59
- this._rateLimit = {
60
- counter: 0,
61
- timeout: null,
62
- waiting: [],
63
- checkpoint: false,
64
- delta: Number(this.options.rateDelta) || 1000,
65
- limit: Number(this.options.rateLimit) || 0
66
- };
67
- this._closed = false;
68
- this._queue = [];
69
- this._connections = [];
70
- this._connectionCounter = 0;
71
-
72
- this.idling = true;
73
-
74
- setImmediate(() => {
75
- if (this.idling) {
76
- this.emit('idle');
77
- }
78
- });
79
- }
80
-
81
- /**
82
- * Placeholder function for creating proxy sockets. This method immediatelly returns
83
- * without a socket
84
- *
85
- * @param {Object} options Connection options
86
- * @param {Function} callback Callback function to run with the socket keys
87
- */
88
- getSocket(options, callback) {
89
- // return immediatelly
90
- return setImmediate(() => callback(null, false));
91
- }
92
-
93
- /**
94
- * Queues an e-mail to be sent using the selected settings
95
- *
96
- * @param {Object} mail Mail object
97
- * @param {Function} callback Callback function
98
- */
99
- send(mail, callback) {
100
- if (this._closed) {
101
- return false;
102
- }
103
-
104
- this._queue.push({
105
- mail,
106
- requeueAttempts: 0,
107
- callback
108
- });
109
-
110
- if (this.idling && this._queue.length >= this.options.maxConnections) {
111
- this.idling = false;
112
- }
113
-
114
- setImmediate(() => this._processMessages());
115
-
116
- return true;
117
- }
118
-
119
- /**
120
- * Closes all connections in the pool. If there is a message being sent, the connection
121
- * is closed later
122
- */
123
- close() {
124
- let connection;
125
- let len = this._connections.length;
126
- this._closed = true;
127
-
128
- // clear rate limit timer if it exists
129
- clearTimeout(this._rateLimit.timeout);
130
-
131
- if (!len && !this._queue.length) {
132
- return;
133
- }
134
-
135
- // remove all available connections
136
- for (let i = len - 1; i >= 0; i--) {
137
- if (this._connections[i] && this._connections[i].available) {
138
- connection = this._connections[i];
139
- connection.close();
140
- this.logger.info(
141
- {
142
- tnx: 'connection',
143
- cid: connection.id,
144
- action: 'removed'
145
- },
146
- 'Connection #%s removed',
147
- connection.id
148
- );
149
- }
150
- }
151
-
152
- if (len && !this._connections.length) {
153
- this.logger.debug(
154
- {
155
- tnx: 'connection'
156
- },
157
- 'All connections removed'
158
- );
159
- }
160
-
161
- if (!this._queue.length) {
162
- return;
163
- }
164
-
165
- // make sure that entire queue would be cleaned
166
- let invokeCallbacks = () => {
167
- if (!this._queue.length) {
168
- this.logger.debug(
169
- {
170
- tnx: 'connection'
171
- },
172
- 'Pending queue entries cleared'
173
- );
174
- return;
175
- }
176
- let entry = this._queue.shift();
177
- if (entry && typeof entry.callback === 'function') {
178
- try {
179
- entry.callback(new Error('Connection pool was closed'));
180
- } catch (E) {
181
- this.logger.error(
182
- {
183
- err: E,
184
- tnx: 'callback',
185
- cid: connection.id
186
- },
187
- 'Callback error for #%s: %s',
188
- connection.id,
189
- E.message
190
- );
191
- }
192
- }
193
- setImmediate(invokeCallbacks);
194
- };
195
- setImmediate(invokeCallbacks);
196
- }
197
-
198
- /**
199
- * Check the queue and available connections. If there is a message to be sent and there is
200
- * an available connection, then use this connection to send the mail
201
- */
202
- _processMessages() {
203
- let connection;
204
- let i, len;
205
-
206
- // do nothing if already closed
207
- if (this._closed) {
208
- return;
209
- }
210
-
211
- // do nothing if queue is empty
212
- if (!this._queue.length) {
213
- if (!this.idling) {
214
- // no pending jobs
215
- this.idling = true;
216
- this.emit('idle');
217
- }
218
- return;
219
- }
220
-
221
- // find first available connection
222
- for (i = 0, len = this._connections.length; i < len; i++) {
223
- if (this._connections[i].available) {
224
- connection = this._connections[i];
225
- break;
226
- }
227
- }
228
-
229
- if (!connection && this._connections.length < this.options.maxConnections) {
230
- connection = this._createConnection();
231
- }
232
-
233
- if (!connection) {
234
- // no more free connection slots available
235
- this.idling = false;
236
- return;
237
- }
238
-
239
- // check if there is free space in the processing queue
240
- if (!this.idling && this._queue.length < this.options.maxConnections) {
241
- this.idling = true;
242
- this.emit('idle');
243
- }
244
-
245
- let entry = (connection.queueEntry = this._queue.shift());
246
- entry.messageId = (connection.queueEntry.mail.message.getHeader('message-id') || '').replace(/[<>\s]/g, '');
247
-
248
- connection.available = false;
249
-
250
- this.logger.debug(
251
- {
252
- tnx: 'pool',
253
- cid: connection.id,
254
- messageId: entry.messageId,
255
- action: 'assign'
256
- },
257
- 'Assigned message <%s> to #%s (%s)',
258
- entry.messageId,
259
- connection.id,
260
- connection.messages + 1
261
- );
262
-
263
- if (this._rateLimit.limit) {
264
- this._rateLimit.counter++;
265
- if (!this._rateLimit.checkpoint) {
266
- this._rateLimit.checkpoint = Date.now();
267
- }
268
- }
269
-
270
- connection.send(entry.mail, (err, info) => {
271
- // only process callback if current handler is not changed
272
- if (entry === connection.queueEntry) {
273
- try {
274
- entry.callback(err, info);
275
- } catch (E) {
276
- this.logger.error(
277
- {
278
- err: E,
279
- tnx: 'callback',
280
- cid: connection.id
281
- },
282
- 'Callback error for #%s: %s',
283
- connection.id,
284
- E.message
285
- );
286
- }
287
- connection.queueEntry = false;
288
- }
289
- });
290
- }
291
-
292
- /**
293
- * Creates a new pool resource
294
- */
295
- _createConnection() {
296
- let connection = new PoolResource(this);
297
-
298
- connection.id = ++this._connectionCounter;
299
-
300
- this.logger.info(
301
- {
302
- tnx: 'pool',
303
- cid: connection.id,
304
- action: 'conection'
305
- },
306
- 'Created new pool resource #%s',
307
- connection.id
308
- );
309
-
310
- // resource comes available
311
- connection.on('available', () => {
312
- this.logger.debug(
313
- {
314
- tnx: 'connection',
315
- cid: connection.id,
316
- action: 'available'
317
- },
318
- 'Connection #%s became available',
319
- connection.id
320
- );
321
-
322
- if (this._closed) {
323
- // if already closed run close() that will remove this connections from connections list
324
- this.close();
325
- } else {
326
- // check if there's anything else to send
327
- this._processMessages();
328
- }
329
- });
330
-
331
- // resource is terminated with an error
332
- connection.once('error', err => {
333
- if (err.code !== 'EMAXLIMIT') {
334
- this.logger.warn(
335
- {
336
- err,
337
- tnx: 'pool',
338
- cid: connection.id
339
- },
340
- 'Pool Error for #%s: %s',
341
- connection.id,
342
- err.message
343
- );
344
- } else {
345
- this.logger.debug(
346
- {
347
- tnx: 'pool',
348
- cid: connection.id,
349
- action: 'maxlimit'
350
- },
351
- 'Max messages limit exchausted for #%s',
352
- connection.id
353
- );
354
- }
355
-
356
- if (connection.queueEntry) {
357
- try {
358
- connection.queueEntry.callback(err);
359
- } catch (E) {
360
- this.logger.error(
361
- {
362
- err: E,
363
- tnx: 'callback',
364
- cid: connection.id
365
- },
366
- 'Callback error for #%s: %s',
367
- connection.id,
368
- E.message
369
- );
370
- }
371
- connection.queueEntry = false;
372
- }
373
-
374
- // remove the erroneus connection from connections list
375
- this._removeConnection(connection);
376
-
377
- this._continueProcessing();
378
- });
379
-
380
- connection.once('close', () => {
381
- this.logger.info(
382
- {
383
- tnx: 'connection',
384
- cid: connection.id,
385
- action: 'closed'
386
- },
387
- 'Connection #%s was closed',
388
- connection.id
389
- );
390
-
391
- this._removeConnection(connection);
392
-
393
- if (connection.queueEntry) {
394
- // If the connection closed when sending, add the message to the queue again
395
- // if max number of requeues is not reached yet
396
- // Note that we must wait a bit.. because the callback of the 'error' handler might be called
397
- // in the next event loop
398
- setTimeout(() => {
399
- if (connection.queueEntry) {
400
- if (this._shouldRequeuOnConnectionClose(connection.queueEntry)) {
401
- this._requeueEntryOnConnectionClose(connection);
402
- } else {
403
- this._failDeliveryOnConnectionClose(connection);
404
- }
405
- }
406
- this._continueProcessing();
407
- }, 50);
408
- } else {
409
- if (!this._closed && this.idling && !this._connections.length) {
410
- this.emit('clear');
411
- }
412
-
413
- this._continueProcessing();
414
- }
415
- });
416
-
417
- this._connections.push(connection);
418
-
419
- return connection;
420
- }
421
-
422
- _shouldRequeuOnConnectionClose(queueEntry) {
423
- if (this.options.maxRequeues === undefined || this.options.maxRequeues < 0) {
424
- return true;
425
- }
426
-
427
- return queueEntry.requeueAttempts < this.options.maxRequeues;
428
- }
429
-
430
- _failDeliveryOnConnectionClose(connection) {
431
- if (connection.queueEntry && connection.queueEntry.callback) {
432
- try {
433
- connection.queueEntry.callback(new Error('Reached maximum number of retries after connection was closed'));
434
- } catch (E) {
435
- this.logger.error(
436
- {
437
- err: E,
438
- tnx: 'callback',
439
- messageId: connection.queueEntry.messageId,
440
- cid: connection.id
441
- },
442
- 'Callback error for #%s: %s',
443
- connection.id,
444
- E.message
445
- );
446
- }
447
- connection.queueEntry = false;
448
- }
449
- }
450
-
451
- _requeueEntryOnConnectionClose(connection) {
452
- connection.queueEntry.requeueAttempts = connection.queueEntry.requeueAttempts + 1;
453
- this.logger.debug(
454
- {
455
- tnx: 'pool',
456
- cid: connection.id,
457
- messageId: connection.queueEntry.messageId,
458
- action: 'requeue'
459
- },
460
- 'Re-queued message <%s> for #%s. Attempt: #%s',
461
- connection.queueEntry.messageId,
462
- connection.id,
463
- connection.queueEntry.requeueAttempts
464
- );
465
- this._queue.unshift(connection.queueEntry);
466
- connection.queueEntry = false;
467
- }
468
-
469
- /**
470
- * Continue to process message if the pool hasn't closed
471
- */
472
- _continueProcessing() {
473
- if (this._closed) {
474
- this.close();
475
- } else {
476
- setTimeout(() => this._processMessages(), 100);
477
- }
478
- }
479
-
480
- /**
481
- * Remove resource from pool
482
- *
483
- * @param {Object} connection The PoolResource to remove
484
- */
485
- _removeConnection(connection) {
486
- let index = this._connections.indexOf(connection);
487
-
488
- if (index !== -1) {
489
- this._connections.splice(index, 1);
490
- }
491
- }
492
-
493
- /**
494
- * Checks if connections have hit current rate limit and if so, queues the availability callback
495
- *
496
- * @param {Function} callback Callback function to run once rate limiter has been cleared
497
- */
498
- _checkRateLimit(callback) {
499
- if (!this._rateLimit.limit) {
500
- return callback();
501
- }
502
-
503
- let now = Date.now();
504
-
505
- if (this._rateLimit.counter < this._rateLimit.limit) {
506
- return callback();
507
- }
508
-
509
- this._rateLimit.waiting.push(callback);
510
-
511
- if (this._rateLimit.checkpoint <= now - this._rateLimit.delta) {
512
- return this._clearRateLimit();
513
- } else if (!this._rateLimit.timeout) {
514
- this._rateLimit.timeout = setTimeout(() => this._clearRateLimit(), this._rateLimit.delta - (now - this._rateLimit.checkpoint));
515
- this._rateLimit.checkpoint = now;
516
- }
517
- }
518
-
519
- /**
520
- * Clears current rate limit limitation and runs paused callback
521
- */
522
- _clearRateLimit() {
523
- clearTimeout(this._rateLimit.timeout);
524
- this._rateLimit.timeout = null;
525
- this._rateLimit.counter = 0;
526
- this._rateLimit.checkpoint = false;
527
-
528
- // resume all paused connections
529
- while (this._rateLimit.waiting.length) {
530
- let cb = this._rateLimit.waiting.shift();
531
- setImmediate(cb);
532
- }
533
- }
534
-
535
- /**
536
- * Returns true if there are free slots in the queue
537
- */
538
- isIdle() {
539
- return this.idling;
540
- }
541
-
542
- /**
543
- * Verifies SMTP configuration
544
- *
545
- * @param {Function} callback Callback function
546
- */
547
- verify(callback) {
548
- let promise;
549
-
550
- if (!callback) {
551
- promise = new Promise((resolve, reject) => {
552
- callback = shared.callbackPromise(resolve, reject);
553
- });
554
- }
555
-
556
- let auth = new PoolResource(this).auth;
557
-
558
- this.getSocket(this.options, (err, socketOptions) => {
559
- if (err) {
560
- return callback(err);
561
- }
562
-
563
- let options = this.options;
564
- if (socketOptions && socketOptions.connection) {
565
- this.logger.info(
566
- {
567
- tnx: 'proxy',
568
- remoteAddress: socketOptions.connection.remoteAddress,
569
- remotePort: socketOptions.connection.remotePort,
570
- destHost: options.host || '',
571
- destPort: options.port || '',
572
- action: 'connected'
573
- },
574
- 'Using proxied socket from %s:%s to %s:%s',
575
- socketOptions.connection.remoteAddress,
576
- socketOptions.connection.remotePort,
577
- options.host || '',
578
- options.port || ''
579
- );
580
- options = shared.assign(false, options);
581
- Object.keys(socketOptions).forEach(key => {
582
- options[key] = socketOptions[key];
583
- });
584
- }
585
-
586
- let connection = new SMTPConnection(options);
587
- let returned = false;
588
-
589
- connection.once('error', err => {
590
- if (returned) {
591
- return;
592
- }
593
- returned = true;
594
- connection.close();
595
- return callback(err);
596
- });
597
-
598
- connection.once('end', () => {
599
- if (returned) {
600
- return;
601
- }
602
- returned = true;
603
- return callback(new Error('Connection closed'));
604
- });
605
-
606
- let finalize = () => {
607
- if (returned) {
608
- return;
609
- }
610
- returned = true;
611
- connection.quit();
612
- return callback(null, true);
613
- };
614
-
615
- connection.connect(() => {
616
- if (returned) {
617
- return;
618
- }
619
-
620
- if (auth && (connection.allowsAuth || options.forceAuth)) {
621
- connection.login(auth, err => {
622
- if (returned) {
623
- return;
624
- }
625
-
626
- if (err) {
627
- returned = true;
628
- connection.close();
629
- return callback(err);
630
- }
631
-
632
- finalize();
633
- });
634
- } else if (!auth && connection.allowsAuth && options.forceAuth) {
635
- let err = new Error('Authentication info was not provided');
636
- err.code = 'NoAuth';
637
-
638
- returned = true;
639
- connection.close();
640
- return callback(err);
641
- } else {
642
- finalize();
643
- }
644
- });
645
- });
646
-
647
- return promise;
648
- }
649
- }
650
-
651
- // expose to the world
652
- module.exports = SMTPPool;