@bobfrankston/mailx 1.0.465 → 1.0.500

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 (344) hide show
  1. package/.globalize.json5 +25 -0
  2. package/README.md +17 -420
  3. package/bin/mailx.js +87 -84
  4. package/bin/mailx.js.map +1 -1
  5. package/bin/mailx.ts +87 -84
  6. package/client/android.html +5 -5
  7. package/client/app.js +42 -38
  8. package/client/components/folder-tree.js +7 -5
  9. package/client/components/message-list.js +485 -448
  10. package/client/components/message-viewer.js +36 -41
  11. package/client/index.html +8 -8
  12. package/client/lib/message-state.js +46 -65
  13. package/index.js +59 -0
  14. package/package.json +12 -114
  15. package/packages/mailx-send/mailsend/{package-lock.json → node_modules/.package-lock.json} +0 -16
  16. package/packages/mailx-send/mailsend/node_modules/@types/node/LICENSE +21 -0
  17. package/packages/mailx-send/mailsend/node_modules/@types/node/README.md +15 -0
  18. package/packages/mailx-send/mailsend/node_modules/@types/node/assert/strict.d.ts +111 -0
  19. package/packages/mailx-send/mailsend/node_modules/@types/node/assert.d.ts +1078 -0
  20. package/packages/mailx-send/mailsend/node_modules/@types/node/async_hooks.d.ts +603 -0
  21. package/packages/mailx-send/mailsend/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  22. package/packages/mailx-send/mailsend/node_modules/@types/node/buffer.d.ts +1934 -0
  23. package/packages/mailx-send/mailsend/node_modules/@types/node/child_process.d.ts +1476 -0
  24. package/packages/mailx-send/mailsend/node_modules/@types/node/cluster.d.ts +578 -0
  25. package/packages/mailx-send/mailsend/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
  26. package/packages/mailx-send/mailsend/node_modules/@types/node/compatibility/index.d.ts +9 -0
  27. package/packages/mailx-send/mailsend/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  28. package/packages/mailx-send/mailsend/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
  29. package/packages/mailx-send/mailsend/node_modules/@types/node/console.d.ts +452 -0
  30. package/packages/mailx-send/mailsend/node_modules/@types/node/constants.d.ts +21 -0
  31. package/packages/mailx-send/mailsend/node_modules/@types/node/crypto.d.ts +4545 -0
  32. package/packages/mailx-send/mailsend/node_modules/@types/node/dgram.d.ts +600 -0
  33. package/packages/mailx-send/mailsend/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
  34. package/packages/mailx-send/mailsend/node_modules/@types/node/dns/promises.d.ts +503 -0
  35. package/packages/mailx-send/mailsend/node_modules/@types/node/dns.d.ts +923 -0
  36. package/packages/mailx-send/mailsend/node_modules/@types/node/domain.d.ts +170 -0
  37. package/packages/mailx-send/mailsend/node_modules/@types/node/events.d.ts +976 -0
  38. package/packages/mailx-send/mailsend/node_modules/@types/node/fs/promises.d.ts +1295 -0
  39. package/packages/mailx-send/mailsend/node_modules/@types/node/fs.d.ts +4461 -0
  40. package/packages/mailx-send/mailsend/node_modules/@types/node/globals.d.ts +172 -0
  41. package/packages/mailx-send/mailsend/node_modules/@types/node/globals.typedarray.d.ts +38 -0
  42. package/packages/mailx-send/mailsend/node_modules/@types/node/http.d.ts +2089 -0
  43. package/packages/mailx-send/mailsend/node_modules/@types/node/http2.d.ts +2644 -0
  44. package/packages/mailx-send/mailsend/node_modules/@types/node/https.d.ts +579 -0
  45. package/packages/mailx-send/mailsend/node_modules/@types/node/index.d.ts +97 -0
  46. package/packages/mailx-send/mailsend/node_modules/@types/node/inspector.d.ts +253 -0
  47. package/packages/mailx-send/mailsend/node_modules/@types/node/inspector.generated.d.ts +4052 -0
  48. package/packages/mailx-send/mailsend/node_modules/@types/node/module.d.ts +891 -0
  49. package/packages/mailx-send/mailsend/node_modules/@types/node/net.d.ts +1057 -0
  50. package/packages/mailx-send/mailsend/node_modules/@types/node/os.d.ts +506 -0
  51. package/packages/mailx-send/mailsend/node_modules/@types/node/package.json +145 -0
  52. package/packages/mailx-send/mailsend/node_modules/@types/node/path.d.ts +200 -0
  53. package/packages/mailx-send/mailsend/node_modules/@types/node/perf_hooks.d.ts +968 -0
  54. package/packages/mailx-send/mailsend/node_modules/@types/node/process.d.ts +2084 -0
  55. package/packages/mailx-send/mailsend/node_modules/@types/node/punycode.d.ts +117 -0
  56. package/packages/mailx-send/mailsend/node_modules/@types/node/querystring.d.ts +152 -0
  57. package/packages/mailx-send/mailsend/node_modules/@types/node/readline/promises.d.ts +161 -0
  58. package/packages/mailx-send/mailsend/node_modules/@types/node/readline.d.ts +594 -0
  59. package/packages/mailx-send/mailsend/node_modules/@types/node/repl.d.ts +428 -0
  60. package/packages/mailx-send/mailsend/node_modules/@types/node/sea.d.ts +153 -0
  61. package/packages/mailx-send/mailsend/node_modules/@types/node/sqlite.d.ts +721 -0
  62. package/packages/mailx-send/mailsend/node_modules/@types/node/stream/consumers.d.ts +38 -0
  63. package/packages/mailx-send/mailsend/node_modules/@types/node/stream/promises.d.ts +90 -0
  64. package/packages/mailx-send/mailsend/node_modules/@types/node/stream/web.d.ts +622 -0
  65. package/packages/mailx-send/mailsend/node_modules/@types/node/stream.d.ts +1664 -0
  66. package/packages/mailx-send/mailsend/node_modules/@types/node/string_decoder.d.ts +67 -0
  67. package/packages/mailx-send/mailsend/node_modules/@types/node/test.d.ts +2163 -0
  68. package/packages/mailx-send/mailsend/node_modules/@types/node/timers/promises.d.ts +108 -0
  69. package/packages/mailx-send/mailsend/node_modules/@types/node/timers.d.ts +287 -0
  70. package/packages/mailx-send/mailsend/node_modules/@types/node/tls.d.ts +1319 -0
  71. package/packages/mailx-send/mailsend/node_modules/@types/node/trace_events.d.ts +197 -0
  72. package/packages/mailx-send/mailsend/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  73. package/packages/mailx-send/mailsend/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
  74. package/packages/mailx-send/mailsend/node_modules/@types/node/ts5.6/index.d.ts +97 -0
  75. package/packages/mailx-send/mailsend/node_modules/@types/node/tty.d.ts +208 -0
  76. package/packages/mailx-send/mailsend/node_modules/@types/node/url.d.ts +984 -0
  77. package/packages/mailx-send/mailsend/node_modules/@types/node/util.d.ts +2606 -0
  78. package/packages/mailx-send/mailsend/node_modules/@types/node/v8.d.ts +920 -0
  79. package/packages/mailx-send/mailsend/node_modules/@types/node/vm.d.ts +1000 -0
  80. package/packages/mailx-send/mailsend/node_modules/@types/node/wasi.d.ts +181 -0
  81. package/packages/mailx-send/mailsend/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  82. package/packages/mailx-send/mailsend/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  83. package/packages/mailx-send/mailsend/node_modules/@types/node/web-globals/events.d.ts +97 -0
  84. package/packages/mailx-send/mailsend/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
  85. package/packages/mailx-send/mailsend/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
  86. package/packages/mailx-send/mailsend/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  87. package/packages/mailx-send/mailsend/node_modules/@types/node/worker_threads.d.ts +784 -0
  88. package/packages/mailx-send/mailsend/node_modules/@types/node/zlib.d.ts +747 -0
  89. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/LICENSE +21 -0
  90. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/README.md +15 -0
  91. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/index.d.ts +82 -0
  92. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/addressparser/index.d.ts +31 -0
  93. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/base64/index.d.ts +22 -0
  94. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/dkim/index.d.ts +45 -0
  95. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/dkim/message-parser.d.ts +75 -0
  96. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/dkim/relaxed-body.d.ts +75 -0
  97. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/dkim/sign.d.ts +21 -0
  98. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/fetch/cookies.d.ts +54 -0
  99. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/fetch/index.d.ts +38 -0
  100. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/json-transport/index.d.ts +53 -0
  101. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mail-composer/index.d.ts +25 -0
  102. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mailer/index.d.ts +283 -0
  103. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mailer/mail-message.d.ts +32 -0
  104. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mime-funcs/index.d.ts +87 -0
  105. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mime-funcs/mime-types.d.ts +2 -0
  106. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mime-node/index.d.ts +224 -0
  107. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mime-node/last-newline.d.ts +9 -0
  108. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/qp/index.d.ts +23 -0
  109. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/sendmail-transport/index.d.ts +53 -0
  110. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/sendmail-transport/le-unix.d.ts +7 -0
  111. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/sendmail-transport/le-windows.d.ts +7 -0
  112. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/ses-transport/index.d.ts +146 -0
  113. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/shared/index.d.ts +58 -0
  114. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/smtp-connection/data-stream.d.ts +11 -0
  115. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/smtp-connection/http-proxy-client.d.ts +16 -0
  116. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/smtp-connection/index.d.ts +270 -0
  117. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/smtp-pool/index.d.ts +93 -0
  118. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/smtp-pool/pool-resource.d.ts +66 -0
  119. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/smtp-transport/index.d.ts +115 -0
  120. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/stream-transport/index.d.ts +59 -0
  121. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/well-known/index.d.ts +6 -0
  122. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/xoauth2/index.d.ts +114 -0
  123. package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/package.json +38 -0
  124. package/packages/mailx-send/mailsend/node_modules/nodemailer/.ncurc.js +9 -0
  125. package/packages/mailx-send/mailsend/node_modules/nodemailer/.prettierignore +8 -0
  126. package/packages/mailx-send/mailsend/node_modules/nodemailer/.prettierrc +12 -0
  127. package/packages/mailx-send/mailsend/node_modules/nodemailer/.prettierrc.js +10 -0
  128. package/packages/mailx-send/mailsend/node_modules/nodemailer/.release-please-config.json +9 -0
  129. package/packages/mailx-send/mailsend/node_modules/nodemailer/LICENSE +16 -0
  130. package/packages/mailx-send/mailsend/node_modules/nodemailer/README.md +86 -0
  131. package/packages/mailx-send/mailsend/node_modules/nodemailer/SECURITY.txt +22 -0
  132. package/packages/mailx-send/mailsend/node_modules/nodemailer/eslint.config.js +88 -0
  133. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/addressparser/index.js +383 -0
  134. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/base64/index.js +139 -0
  135. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/dkim/index.js +253 -0
  136. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
  137. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
  138. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/dkim/sign.js +117 -0
  139. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
  140. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/fetch/index.js +280 -0
  141. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/json-transport/index.js +82 -0
  142. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mail-composer/index.js +629 -0
  143. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mailer/index.js +441 -0
  144. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mailer/mail-message.js +316 -0
  145. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mime-funcs/index.js +625 -0
  146. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2113 -0
  147. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mime-node/index.js +1316 -0
  148. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
  149. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
  150. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
  151. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/nodemailer.js +157 -0
  152. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/punycode/index.js +460 -0
  153. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/qp/index.js +227 -0
  154. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
  155. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/ses-transport/index.js +234 -0
  156. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/shared/index.js +754 -0
  157. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
  158. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
  159. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/smtp-connection/index.js +1870 -0
  160. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/smtp-pool/index.js +652 -0
  161. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +259 -0
  162. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/smtp-transport/index.js +421 -0
  163. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
  164. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/well-known/index.js +47 -0
  165. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/well-known/services.json +611 -0
  166. package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/xoauth2/index.js +427 -0
  167. package/packages/mailx-send/mailsend/node_modules/nodemailer/package.json +47 -0
  168. package/packages/mailx-send/mailsend/node_modules/undici-types/LICENSE +21 -0
  169. package/packages/mailx-send/mailsend/node_modules/undici-types/README.md +6 -0
  170. package/packages/mailx-send/mailsend/node_modules/undici-types/agent.d.ts +31 -0
  171. package/packages/mailx-send/mailsend/node_modules/undici-types/api.d.ts +43 -0
  172. package/packages/mailx-send/mailsend/node_modules/undici-types/balanced-pool.d.ts +29 -0
  173. package/packages/mailx-send/mailsend/node_modules/undici-types/cache.d.ts +36 -0
  174. package/packages/mailx-send/mailsend/node_modules/undici-types/client.d.ts +108 -0
  175. package/packages/mailx-send/mailsend/node_modules/undici-types/connector.d.ts +34 -0
  176. package/packages/mailx-send/mailsend/node_modules/undici-types/content-type.d.ts +21 -0
  177. package/packages/mailx-send/mailsend/node_modules/undici-types/cookies.d.ts +28 -0
  178. package/packages/mailx-send/mailsend/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  179. package/packages/mailx-send/mailsend/node_modules/undici-types/dispatcher.d.ts +256 -0
  180. package/packages/mailx-send/mailsend/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  181. package/packages/mailx-send/mailsend/node_modules/undici-types/errors.d.ts +149 -0
  182. package/packages/mailx-send/mailsend/node_modules/undici-types/eventsource.d.ts +61 -0
  183. package/packages/mailx-send/mailsend/node_modules/undici-types/fetch.d.ts +209 -0
  184. package/packages/mailx-send/mailsend/node_modules/undici-types/file.d.ts +39 -0
  185. package/packages/mailx-send/mailsend/node_modules/undici-types/filereader.d.ts +54 -0
  186. package/packages/mailx-send/mailsend/node_modules/undici-types/formdata.d.ts +108 -0
  187. package/packages/mailx-send/mailsend/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  188. package/packages/mailx-send/mailsend/node_modules/undici-types/global-origin.d.ts +7 -0
  189. package/packages/mailx-send/mailsend/node_modules/undici-types/handlers.d.ts +15 -0
  190. package/packages/mailx-send/mailsend/node_modules/undici-types/header.d.ts +4 -0
  191. package/packages/mailx-send/mailsend/node_modules/undici-types/index.d.ts +71 -0
  192. package/packages/mailx-send/mailsend/node_modules/undici-types/interceptors.d.ts +17 -0
  193. package/packages/mailx-send/mailsend/node_modules/undici-types/mock-agent.d.ts +50 -0
  194. package/packages/mailx-send/mailsend/node_modules/undici-types/mock-client.d.ts +25 -0
  195. package/packages/mailx-send/mailsend/node_modules/undici-types/mock-errors.d.ts +12 -0
  196. package/packages/mailx-send/mailsend/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  197. package/packages/mailx-send/mailsend/node_modules/undici-types/mock-pool.d.ts +25 -0
  198. package/packages/mailx-send/mailsend/node_modules/undici-types/package.json +55 -0
  199. package/packages/mailx-send/mailsend/node_modules/undici-types/patch.d.ts +33 -0
  200. package/packages/mailx-send/mailsend/node_modules/undici-types/pool-stats.d.ts +19 -0
  201. package/packages/mailx-send/mailsend/node_modules/undici-types/pool.d.ts +39 -0
  202. package/packages/mailx-send/mailsend/node_modules/undici-types/proxy-agent.d.ts +28 -0
  203. package/packages/mailx-send/mailsend/node_modules/undici-types/readable.d.ts +65 -0
  204. package/packages/mailx-send/mailsend/node_modules/undici-types/retry-agent.d.ts +8 -0
  205. package/packages/mailx-send/mailsend/node_modules/undici-types/retry-handler.d.ts +116 -0
  206. package/packages/mailx-send/mailsend/node_modules/undici-types/util.d.ts +18 -0
  207. package/packages/mailx-send/mailsend/node_modules/undici-types/webidl.d.ts +228 -0
  208. package/packages/mailx-send/mailsend/node_modules/undici-types/websocket.d.ts +150 -0
  209. package/packages/mailx-server/index.js +1 -1
  210. package/packages/mailx-settings/cloud.js +12 -7
  211. package/packages/mailx-settings/index.js +22 -1
  212. package/client/.gitattributes +0 -10
  213. package/client/app.js.map +0 -1
  214. package/client/app.ts +0 -3190
  215. package/client/components/address-book.js.map +0 -1
  216. package/client/components/address-book.ts +0 -204
  217. package/client/components/alarms.js.map +0 -1
  218. package/client/components/alarms.ts +0 -276
  219. package/client/components/calendar-sidebar.js.map +0 -1
  220. package/client/components/calendar-sidebar.ts +0 -474
  221. package/client/components/calendar.js.map +0 -1
  222. package/client/components/calendar.ts +0 -211
  223. package/client/components/context-menu.js.map +0 -1
  224. package/client/components/context-menu.ts +0 -95
  225. package/client/components/folder-picker.js.map +0 -1
  226. package/client/components/folder-picker.ts +0 -127
  227. package/client/components/folder-tree.js.map +0 -1
  228. package/client/components/folder-tree.ts +0 -1069
  229. package/client/components/message-list.js.map +0 -1
  230. package/client/components/message-list.ts +0 -1129
  231. package/client/components/message-viewer.js.map +0 -1
  232. package/client/components/message-viewer.ts +0 -1257
  233. package/client/components/outbox-view.js.map +0 -1
  234. package/client/components/outbox-view.ts +0 -102
  235. package/client/components/tasks.js.map +0 -1
  236. package/client/components/tasks.ts +0 -234
  237. package/client/compose/compose.js.map +0 -1
  238. package/client/compose/compose.ts +0 -1231
  239. package/client/compose/editor.js.map +0 -1
  240. package/client/compose/editor.ts +0 -599
  241. package/client/compose/ghost-text.js.map +0 -1
  242. package/client/compose/ghost-text.ts +0 -140
  243. package/client/lib/android-bootstrap.js.map +0 -1
  244. package/client/lib/android-bootstrap.ts +0 -9
  245. package/client/lib/api-client.js.map +0 -1
  246. package/client/lib/api-client.ts +0 -439
  247. package/client/lib/local-service.js.map +0 -1
  248. package/client/lib/local-service.ts +0 -646
  249. package/client/lib/local-store.js.map +0 -1
  250. package/client/lib/local-store.ts +0 -283
  251. package/client/lib/message-state.js.map +0 -1
  252. package/client/lib/message-state.ts +0 -160
  253. package/client/tsconfig.json +0 -19
  254. package/packages/mailx-api/.gitattributes +0 -10
  255. package/packages/mailx-api/index.d.ts.map +0 -1
  256. package/packages/mailx-api/index.js.map +0 -1
  257. package/packages/mailx-api/index.ts +0 -283
  258. package/packages/mailx-api/tsconfig.json +0 -9
  259. package/packages/mailx-compose/.gitattributes +0 -10
  260. package/packages/mailx-compose/index.d.ts.map +0 -1
  261. package/packages/mailx-compose/index.js.map +0 -1
  262. package/packages/mailx-compose/index.ts +0 -85
  263. package/packages/mailx-compose/tsconfig.json +0 -9
  264. package/packages/mailx-host/.gitattributes +0 -10
  265. package/packages/mailx-host/index.d.ts +0 -21
  266. package/packages/mailx-host/index.d.ts.map +0 -1
  267. package/packages/mailx-host/index.js +0 -29
  268. package/packages/mailx-host/index.js.map +0 -1
  269. package/packages/mailx-host/index.ts +0 -38
  270. package/packages/mailx-host/package.json +0 -23
  271. package/packages/mailx-host/tsconfig.json +0 -9
  272. package/packages/mailx-host/types-shim.d.ts +0 -14
  273. package/packages/mailx-imap/.gitattributes +0 -10
  274. package/packages/mailx-imap/index.d.ts +0 -442
  275. package/packages/mailx-imap/index.d.ts.map +0 -1
  276. package/packages/mailx-imap/index.js +0 -3684
  277. package/packages/mailx-imap/index.js.map +0 -1
  278. package/packages/mailx-imap/index.ts +0 -3652
  279. package/packages/mailx-imap/package-lock.json +0 -131
  280. package/packages/mailx-imap/package.json +0 -28
  281. package/packages/mailx-imap/providers/gmail-api.d.ts +0 -8
  282. package/packages/mailx-imap/providers/gmail-api.d.ts.map +0 -1
  283. package/packages/mailx-imap/providers/gmail-api.js +0 -8
  284. package/packages/mailx-imap/providers/gmail-api.js.map +0 -1
  285. package/packages/mailx-imap/providers/gmail-api.ts +0 -8
  286. package/packages/mailx-imap/providers/outlook-api.ts +0 -7
  287. package/packages/mailx-imap/providers/types.d.ts +0 -9
  288. package/packages/mailx-imap/providers/types.d.ts.map +0 -1
  289. package/packages/mailx-imap/providers/types.js +0 -9
  290. package/packages/mailx-imap/providers/types.js.map +0 -1
  291. package/packages/mailx-imap/providers/types.ts +0 -9
  292. package/packages/mailx-imap/tsconfig.json +0 -9
  293. package/packages/mailx-imap/tsconfig.tsbuildinfo +0 -1
  294. package/packages/mailx-send/.gitattributes +0 -10
  295. package/packages/mailx-send/cli-queue.d.ts.map +0 -1
  296. package/packages/mailx-send/cli-queue.js.map +0 -1
  297. package/packages/mailx-send/cli-queue.ts +0 -62
  298. package/packages/mailx-send/cli-send.d.ts.map +0 -1
  299. package/packages/mailx-send/cli-send.js.map +0 -1
  300. package/packages/mailx-send/cli-send.ts +0 -83
  301. package/packages/mailx-send/cli.d.ts.map +0 -1
  302. package/packages/mailx-send/cli.js.map +0 -1
  303. package/packages/mailx-send/cli.ts +0 -126
  304. package/packages/mailx-send/index.d.ts.map +0 -1
  305. package/packages/mailx-send/index.js.map +0 -1
  306. package/packages/mailx-send/index.ts +0 -333
  307. package/packages/mailx-send/mailsend/cli.d.ts.map +0 -1
  308. package/packages/mailx-send/mailsend/cli.js.map +0 -1
  309. package/packages/mailx-send/mailsend/cli.ts +0 -81
  310. package/packages/mailx-send/mailsend/index.d.ts.map +0 -1
  311. package/packages/mailx-send/mailsend/index.js.map +0 -1
  312. package/packages/mailx-send/mailsend/index.ts +0 -333
  313. package/packages/mailx-send/mailsend/tsconfig.json +0 -21
  314. package/packages/mailx-send/package-lock.json +0 -65
  315. package/packages/mailx-send/tsconfig.json +0 -21
  316. package/packages/mailx-server/.gitattributes +0 -10
  317. package/packages/mailx-server/index.d.ts.map +0 -1
  318. package/packages/mailx-server/index.js.map +0 -1
  319. package/packages/mailx-server/index.ts +0 -429
  320. package/packages/mailx-server/tsconfig.json +0 -9
  321. package/packages/mailx-settings/.gitattributes +0 -10
  322. package/packages/mailx-settings/cloud.d.ts.map +0 -1
  323. package/packages/mailx-settings/cloud.js.map +0 -1
  324. package/packages/mailx-settings/cloud.ts +0 -388
  325. package/packages/mailx-settings/index.d.ts.map +0 -1
  326. package/packages/mailx-settings/index.js.map +0 -1
  327. package/packages/mailx-settings/index.ts +0 -892
  328. package/packages/mailx-settings/tsconfig.json +0 -9
  329. package/packages/mailx-store/.gitattributes +0 -10
  330. package/packages/mailx-store/db.d.ts.map +0 -1
  331. package/packages/mailx-store/db.js.map +0 -1
  332. package/packages/mailx-store/db.ts +0 -2007
  333. package/packages/mailx-store/file-store.d.ts.map +0 -1
  334. package/packages/mailx-store/file-store.js.map +0 -1
  335. package/packages/mailx-store/file-store.ts +0 -82
  336. package/packages/mailx-store/index.d.ts.map +0 -1
  337. package/packages/mailx-store/index.js.map +0 -1
  338. package/packages/mailx-store/index.ts +0 -7
  339. package/packages/mailx-store/tsconfig.json +0 -9
  340. package/packages/mailx-types/.gitattributes +0 -10
  341. package/packages/mailx-types/index.d.ts.map +0 -1
  342. package/packages/mailx-types/index.js.map +0 -1
  343. package/packages/mailx-types/index.ts +0 -498
  344. package/packages/mailx-types/tsconfig.json +0 -9
@@ -1,498 +0,0 @@
1
- /**
2
- * @bobfrankston/mailx-types
3
- * Shared type definitions for the mailx email client.
4
- * This is the contract between client and server.
5
- */
6
-
7
- // ── Account Configuration ──
8
-
9
- /** Supported authentication methods */
10
- export type AuthMethod = "password" | "oauth2";
11
-
12
- /** Mail account configuration */
13
- export interface AccountConfig {
14
- id: string; /** Unique account identifier (e.g., "iecc", "gmail-bob") */
15
- name: string; /** Sender name for From header (e.g., "Bob Frankston") */
16
- label?: string; /** UI label for account list (e.g., "Gmail"). Falls back to name if not set */
17
- email: string; /** Email address */
18
- imap: {
19
- host: string;
20
- port: number;
21
- tls: boolean;
22
- auth: AuthMethod;
23
- user: string;
24
- password?: string; /** For password auth */
25
- oauthClientId?: string; /** For OAuth2 */
26
- };
27
- smtp: {
28
- host: string;
29
- port: number;
30
- tls: boolean;
31
- auth: AuthMethod;
32
- user: string;
33
- password?: string;
34
- };
35
- enabled: boolean;
36
- primary?: boolean; /** Catch-all "this is my main account" — default source for Calendar / Tasks / Contacts when no per-feature override set. */
37
- primaryCalendar?: boolean; /** Per-feature override: use this account's Google Calendar. Falls back to `primary` if unset. */
38
- primaryTasks?: boolean; /** Per-feature override: use this account's Google Tasks. Falls back to `primary` if unset. */
39
- primaryContacts?: boolean; /** Per-feature override: use this account's Google Contacts. Falls back to `primary` if unset. */
40
- defaultSend?: boolean; /** Use this account's SMTP when From doesn't match any account */
41
- syncContacts?: boolean; /** Sync contacts even when account is disabled (contacts-only Gmail) */
42
- relayDomains?: string[]; /** Domains to skip in Delivered-To chain (e.g., ["m.connectivity.xyz"]) */
43
- deliveredToPrefix?: string[]; /** Prefixes to strip from Delivered-To to get clean alias (e.g., ["bobf-ma-", "bobf-"]) — order matters, longest first */
44
- identityDomains?: string[]; /** Domains where Delivered-To address should become the reply From (e.g., ["bob.ma", "bobf.frankston.com"]) */
45
- spam?: string; /** IMAP folder path for "Mark as spam" button (e.g., "_spam"). Button hidden when not set. */
46
- signature?: string; /** Legacy: HTML signature appended to all outgoing messages (new + reply + forward). Plain text or HTML allowed. Superseded by `sig`. */
47
- sig?: AccountSignature; /** Per-account signature object. Initially appended only to NEW messages; later options will cover replies/forwards. */
48
- }
49
-
50
- /** Signature configuration in accounts.jsonc. Initial shape carries `text`
51
- * only; `html: true` reserved for future support of raw HTML signatures. */
52
- export interface AccountSignature {
53
- text: string; /** Plain-text signature body. Newlines preserved. Appended to NEW messages with the standard "-- " RFC 3676 separator. */
54
- html?: boolean; /** Future flag: when true, `text` is treated as raw HTML rather than escaped plain text. Currently ignored. */
55
- }
56
-
57
- // ── Folder Types ──
58
-
59
- /** Standard IMAP special-use folder types */
60
- export type SpecialUse = "inbox" | "sent" | "drafts" | "trash" | "junk" | "archive" | "all";
61
-
62
- /** A mailbox folder */
63
- export interface Folder {
64
- id: number;
65
- accountId: string;
66
- path: string; /** IMAP path e.g., "INBOX", "INBOX/Projects" */
67
- name: string; /** Display name */
68
- specialUse: SpecialUse; /** Standard folder type, or null for custom */
69
- delimiter: string; /** IMAP hierarchy delimiter */
70
- totalCount: number;
71
- unreadCount: number;
72
- children: Folder[]; /** Nested subfolders */
73
- }
74
-
75
- // ── Message Types ──
76
-
77
- /** Email address with optional display name */
78
- export interface EmailAddress {
79
- name: string; /** Display name, may be empty */
80
- address: string; /** Email address */
81
- }
82
-
83
- /** Message envelope (headers only, for list display) */
84
- export interface MessageEnvelope {
85
- id: number; /** Local store ID */
86
- accountId: string;
87
- folderId: number;
88
- folderName?: string; /** Leaf folder name; populated by cross-folder search so the UI can tag each hit */
89
- uid: number; /** IMAP UID (server-side identity; changes on move, UIDVALIDITY bump) */
90
- uuid?: string; /** Stable local identity, minted once at first-sight; never changes */
91
- messageId: string; /** RFC Message-ID header */
92
- inReplyTo: string; /** For threading */
93
- references: string[]; /** For threading */
94
- threadId?: string; /** Computed thread id (root Message-ID of the conversation) */
95
- date: number; /** Epoch ms */
96
- subject: string;
97
- from: EmailAddress;
98
- to: EmailAddress[];
99
- cc: EmailAddress[];
100
- flags: string[]; /** IMAP flags: ["\\Seen", "\\Flagged"] */
101
- size: number;
102
- hasAttachments: boolean;
103
- preview: string; /** First ~200 chars of body text */
104
- bodyPath?: string; /** Local body location: "idb:..." or "gmail:<id>" */
105
- providerId?: string; /** Native server id (Gmail hex id, Outlook Graph id) — bypasses UID→id pagination on body fetch */
106
- pending?: boolean; /** True when a queued local action (move/flag/delete) hasn't been ACK'd by the server yet — UI renders pink */
107
- }
108
-
109
- /** Full message with body content */
110
- export interface Message extends MessageEnvelope {
111
- bodyHtml: string; /** HTML body */
112
- bodyText: string; /** Plain text body */
113
- attachments: Attachment[];
114
- }
115
-
116
- /** File attachment metadata */
117
- export interface Attachment {
118
- id: number;
119
- filename: string;
120
- mimeType: string;
121
- size: number;
122
- contentId: string; /** For inline attachments (cid:) */
123
- }
124
-
125
- // ── API Types ──
126
-
127
- /** Paginated list response */
128
- export interface PagedResult<T> {
129
- items: T[];
130
- total: number;
131
- page: number;
132
- pageSize: number;
133
- }
134
-
135
- /** Message list query parameters */
136
- export interface MessageQuery {
137
- accountId: string;
138
- folderId: number;
139
- page?: number;
140
- pageSize?: number;
141
- sort?: "date" | "from" | "subject";
142
- sortDir?: "asc" | "desc";
143
- search?: string;
144
- /** Restrict to messages with the \Flagged flag set (whole-folder, not
145
- * just the currently-rendered page — lets the "show flagged" filter
146
- * find stars on messages that haven't been paged in yet). */
147
- flaggedOnly?: boolean;
148
- }
149
-
150
- /** Compose/send a message */
151
- export interface ComposeMessage {
152
- from: string; /** Account ID to send from */
153
- to: EmailAddress[];
154
- cc?: EmailAddress[];
155
- bcc?: EmailAddress[];
156
- subject: string;
157
- bodyHtml: string;
158
- bodyText?: string;
159
- inReplyTo?: string; /** Message-ID of message being replied to */
160
- references?: string[];
161
- attachments?: { filename: string; data: string; mimeType: string }[];
162
- }
163
-
164
- // ── Queue Types ──
165
-
166
- export type QueueStatus = "pending" | "sending" | "sent" | "failed";
167
-
168
- export interface QueueItem {
169
- id: number;
170
- status: QueueStatus;
171
- createdAt: number;
172
- sendAfter: number; /** Epoch ms, for deferred send */
173
- attempts: number;
174
- lastAttempt: number;
175
- error: string;
176
- subject: string;
177
- to: EmailAddress[];
178
- }
179
-
180
- // ── WebSocket Event Types ──
181
-
182
- export type WsEvent =
183
- | { type: "newMessage"; accountId: string; folderId: number; message: MessageEnvelope }
184
- | { type: "messageDeleted"; accountId: string; folderId: number; uid: number }
185
- | { type: "messageMoved"; accountId: string; fromFolderId: number; toFolderId: number; uid: number }
186
- | { type: "folderCountsChanged"; accountId: string; counts: Record<number, { total: number; unread: number }> }
187
- | { type: "folderSynced"; accountId: string; entries: { folderId: number; syncedAt: number }[] }
188
- | { type: "syncProgress"; accountId: string; phase: string; progress: number }
189
- | { type: "queueUpdate"; pending: number; sending: number; failed: number }
190
- | { type: "connected" }
191
- | { type: "reload" }
192
- | { type: "error"; message: string }
193
- | { type: "accountError"; accountId: string; error: string; hint: string; isOAuth: boolean };
194
-
195
- // ── Settings Types ──
196
-
197
- export interface MailxSettings {
198
- accounts: AccountConfig[];
199
- ui: {
200
- theme: "system" | "dark" | "light";
201
- editor: "quill" | "tiptap";
202
- folderWidth: number;
203
- listViewerSplit: number; /** Percentage for message list height */
204
- fontSize: number;
205
- };
206
- sync: {
207
- intervalMinutes: number;
208
- historyDays: number; /** 0 = all history */
209
- prefetch: boolean; /** Download message bodies during sync (default true) */
210
- };
211
- store: {
212
- basePath: string; /** Where message bodies are stored */
213
- compressionBoundaryDays: number; /** Messages older than this get compressed */
214
- };
215
- autocomplete?: AutocompleteSettings;
216
- }
217
-
218
- // ── Autocomplete Types ──
219
-
220
- export interface AutocompleteSettings {
221
- enabled: boolean;
222
- provider: "ollama" | "claude" | "openai" | "off";
223
- ollamaUrl: string;
224
- ollamaModel: string;
225
- cloudApiKey: string;
226
- cloudModel: string;
227
- debounceMs: number;
228
- maxTokens: number;
229
- /** Per-feature opt-in for non-autocomplete AI helpers. All default false
230
- * per user preference (2026-04-21): AI features should be controlled by
231
- * a flag, initially OFF in settings. Provider config is shared with
232
- * autocomplete (provider, cloudApiKey, cloudModel, etc.). */
233
- translateEnabled?: boolean;
234
- proofreadEnabled?: boolean;
235
- }
236
-
237
- export interface AutocompleteRequest {
238
- subject: string;
239
- to: string;
240
- bodyText: string;
241
- cursorOffset: number;
242
- }
243
-
244
- export interface AutocompleteResponse {
245
- suggestion: string;
246
- }
247
-
248
- // ── AI Transform (translate / proofread / summarize) ──
249
-
250
- export interface AiTransformRequest {
251
- /** translate = render in `targetLang`; proofread = corrected version
252
- * with grammar/spelling fixes; summarize = short paragraph summary. */
253
- action: "translate" | "proofread" | "summarize";
254
- text: string;
255
- /** ISO-639-1 (or BCP-47) language code for translate. Defaults to "en". */
256
- targetLang?: string;
257
- }
258
-
259
- export interface AiTransformResponse {
260
- /** Transformed text. Empty when AI is disabled / provider error / feature
261
- * not enabled — caller should treat empty as "no result". */
262
- text: string;
263
- /** Optional reason for empty result, surfaced to UI status bar. */
264
- reason?: string;
265
- }
266
-
267
- // ── Store Interface ──
268
-
269
- /** Body storage backend interface -- implementations are swappable */
270
- export interface MessageStore {
271
- putMessage(accountId: string, folderId: number, uid: number, raw: Buffer): Promise<string>;
272
- getMessage(accountId: string, folderId: number, uid: number): Promise<Buffer>;
273
- deleteMessage(accountId: string, folderId: number, uid: number): Promise<void>;
274
- hasMessage(accountId: string, folderId: number, uid: number): Promise<boolean>;
275
- }
276
-
277
- // ── Shared Utilities ──
278
- // Pure functions used by both desktop (mailx-service) and Android (web-service).
279
- // Kept here to avoid duplication — both platforms import from mailx-types.
280
-
281
- /** Sanitize HTML for safe display — strips scripts, inline handlers, remote images, forms, iframes. */
282
- export function sanitizeHtml(html: string): { html: string; hasRemoteContent: boolean } {
283
- let hasRemoteContent = false;
284
- let clean = html.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, "");
285
- clean = clean.replace(/\s+on\w+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi, "");
286
- clean = clean.replace(/<img\b([^>]*)\bsrc\s*=\s*("[^"]*"|'[^']*')/gi, (match, before, src) => {
287
- const url = src.slice(1, -1);
288
- if (url.startsWith("data:") || url.startsWith("cid:")) return match;
289
- hasRemoteContent = true;
290
- return `<img${before}src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Crect fill='%23888' width='20' height='20' rx='3'/%3E%3Ctext x='10' y='14' text-anchor='middle' fill='white' font-size='12'%3E⊘%3C/text%3E%3C/svg%3E" data-blocked-src=${src} title="Remote image blocked"`;
291
- });
292
- clean = clean.replace(/<link\b[^>]*rel\s*=\s*["']stylesheet["'][^>]*>/gi, (match) => {
293
- hasRemoteContent = true;
294
- return `<!-- blocked: ${match.replace(/--/g, "")} -->`;
295
- });
296
- clean = clean.replace(/url\s*\(\s*(['"]?)(https?:\/\/[^)]+)\1\s*\)/gi, (_match, _q, url) => {
297
- hasRemoteContent = true;
298
- return `url("") /* blocked: ${url} */`;
299
- });
300
- clean = clean.replace(/<\/?form\b[^>]*>/gi, "");
301
- clean = clean.replace(/<iframe\b[^>]*>[\s\S]*?<\/iframe>/gi, "");
302
- return { html: clean, hasRemoteContent };
303
- }
304
-
305
- /** Encode text as RFC 2045 quoted-printable. */
306
- export function encodeQuotedPrintable(text: string): string {
307
- const encoder = new TextEncoder();
308
- const bytes = encoder.encode(text);
309
- let line = "";
310
- let result = "";
311
- for (let i = 0; i < bytes.length; i++) {
312
- const b = bytes[i];
313
- let encoded: string;
314
- if (b === 0x0D && bytes[i + 1] === 0x0A) {
315
- result += line + "\r\n";
316
- line = "";
317
- i++;
318
- continue;
319
- } else if (b === 0x0A) {
320
- result += line + "\r\n";
321
- line = "";
322
- continue;
323
- } else if ((b >= 33 && b <= 126 && b !== 61) || b === 9 || b === 32) {
324
- encoded = String.fromCharCode(b);
325
- } else {
326
- encoded = "=" + b.toString(16).toUpperCase().padStart(2, "0");
327
- }
328
- if (line.length + encoded.length > 75) {
329
- result += line + "=\r\n";
330
- line = "";
331
- }
332
- line += encoded;
333
- }
334
- result += line;
335
- return result;
336
- }
337
-
338
- /** Render an HTML document as a plain-text approximation suitable for the
339
- * text/plain alternative part of a multipart/alternative outgoing MIME
340
- * message. Not a full HTML-to-text engine — just enough to give non-HTML
341
- * clients (plain-text readers, spam filters scoring on text/plain, people
342
- * who turned HTML off) a readable fallback. Preserves line breaks for
343
- * `<br>` / `</p>` / `</div>` / `<li>`, strips all other tags, decodes the
344
- * common HTML entities, and collapses runs of whitespace.
345
- *
346
- * Spam filters (SpamAssassin, Rspamd) penalise HTML-only mail aggressively;
347
- * shipping a real text part typically drops the score by 1–2 points. Also
348
- * matches the behaviour of every other mainstream mail client — sending a
349
- * text/html part alone marks mailx as an outlier in mail logs. */
350
- export function htmlToPlainText(html: string): string {
351
- if (!html) return "";
352
- let s = html;
353
- // Drop <style> / <script> entirely (their contents aren't readable text).
354
- s = s.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, "");
355
- s = s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, "");
356
- // Block-level breaks — treat closing tags as line terminators so
357
- // paragraphs don't run together.
358
- s = s.replace(/<br\s*\/?\s*>/gi, "\n");
359
- s = s.replace(/<\/(p|div|li|tr|h[1-6]|blockquote|pre|section|article)\s*>/gi, "\n");
360
- // List-item leading bullet (rough but readable).
361
- s = s.replace(/<li\b[^>]*>/gi, " • ");
362
- // Anchor: keep href in parens after the text so URLs survive.
363
- s = s.replace(/<a\b[^>]*href\s*=\s*(['"])([^'"]*)\1[^>]*>([\s\S]*?)<\/a>/gi,
364
- (_m, _q, href, text) => {
365
- const t = text.replace(/<[^>]+>/g, "").trim();
366
- return t && t !== href ? `${t} (${href})` : href;
367
- });
368
- // Strip remaining tags.
369
- s = s.replace(/<[^>]+>/g, "");
370
- // Decode a pragmatic set of HTML entities — the rare ones survive as-is.
371
- s = s.replace(/&nbsp;/gi, " ")
372
- .replace(/&amp;/gi, "&")
373
- .replace(/&lt;/gi, "<")
374
- .replace(/&gt;/gi, ">")
375
- .replace(/&quot;/gi, "\"")
376
- .replace(/&#39;/gi, "'")
377
- .replace(/&apos;/gi, "'")
378
- .replace(/&mdash;/gi, "—")
379
- .replace(/&ndash;/gi, "–")
380
- .replace(/&hellip;/gi, "…")
381
- .replace(/&#(\d+);/g, (_m, n) => String.fromCodePoint(parseInt(n, 10)))
382
- .replace(/&#x([0-9a-f]+);/gi, (_m, h) => String.fromCodePoint(parseInt(h, 16)));
383
- // Normalise whitespace: collapse runs of spaces/tabs, trim per-line,
384
- // cap consecutive blank lines at 2.
385
- s = s.replace(/[ \t]+/g, " ")
386
- .split("\n").map(l => l.replace(/^[ \t]+|[ \t]+$/g, "")).join("\n")
387
- .replace(/\n{3,}/g, "\n\n")
388
- .trim();
389
- return s;
390
- }
391
-
392
- /** Parse search query into structured conditions.
393
- * Supports qualifiers: from:, to:, subject:, date:, has:attachment,
394
- * is:flagged, is:unread, is:read. Unqualified terms search across subject /
395
- * from / preview. Returns { conditions, params } for SQL WHERE clause with
396
- * LIKE plus structured predicates (flags_json LIKE, has_attachments=1, date
397
- * range comparisons).
398
- *
399
- * Date syntax (matches Gmail-ish conventions):
400
- * - date:2026-04-22 exact day
401
- * - date:2026-04 month
402
- * - date:>2026-04-01 after
403
- * - date:<2026-04-01 before
404
- * - date:2026-04-01..2026-04-30 range
405
- * - date:today / yesterday / last7 / last30
406
- */
407
- export function parseSearchQuery(query: string): { conditions: string[]; params: (string | number)[] } {
408
- const parts = query.match(/(?:[^\s"]+|"[^"]*")+/g) || [];
409
- const conditions: string[] = [];
410
- const params: (string | number)[] = [];
411
-
412
- const dayStart = (y: number, m: number, d: number) => new Date(y, m - 1, d).getTime();
413
- const parseDateSpec = (spec: string): { from?: number; to?: number } | null => {
414
- const now = new Date();
415
- const today0 = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
416
- if (spec === "today") return { from: today0, to: today0 + 86400_000 };
417
- if (spec === "yesterday") return { from: today0 - 86400_000, to: today0 };
418
- const lastN = spec.match(/^last(\d+)$/i);
419
- if (lastN) return { from: today0 - parseInt(lastN[1]) * 86400_000 };
420
- const rangeMatch = spec.match(/^(\d{4})-(\d{2})-(\d{2})\.\.(\d{4})-(\d{2})-(\d{2})$/);
421
- if (rangeMatch) return {
422
- from: dayStart(+rangeMatch[1], +rangeMatch[2], +rangeMatch[3]),
423
- to: dayStart(+rangeMatch[4], +rangeMatch[5], +rangeMatch[6]) + 86400_000,
424
- };
425
- const gtMatch = spec.match(/^>(\d{4})-(\d{2})-(\d{2})$/);
426
- if (gtMatch) return { from: dayStart(+gtMatch[1], +gtMatch[2], +gtMatch[3]) + 86400_000 };
427
- const ltMatch = spec.match(/^<(\d{4})-(\d{2})-(\d{2})$/);
428
- if (ltMatch) return { to: dayStart(+ltMatch[1], +ltMatch[2], +ltMatch[3]) };
429
- const monthMatch = spec.match(/^(\d{4})-(\d{2})$/);
430
- if (monthMatch) {
431
- const y = +monthMatch[1], m = +monthMatch[2];
432
- const from = dayStart(y, m, 1);
433
- const to = m === 12 ? dayStart(y + 1, 1, 1) : dayStart(y, m + 1, 1);
434
- return { from, to };
435
- }
436
- const dayMatch = spec.match(/^(\d{4})-(\d{2})-(\d{2})$/);
437
- if (dayMatch) {
438
- const from = dayStart(+dayMatch[1], +dayMatch[2], +dayMatch[3]);
439
- return { from, to: from + 86400_000 };
440
- }
441
- return null;
442
- };
443
-
444
- for (const part of parts) {
445
- const fromMatch = part.match(/^from:(.+)$/i);
446
- const toMatch = part.match(/^to:(.+)$/i);
447
- const subjectMatch = part.match(/^subject:(.+)$/i);
448
- const hasMatch = part.match(/^has:(.+)$/i);
449
- const isMatch = part.match(/^is:(.+)$/i);
450
- const dateMatch = part.match(/^date:(.+)$/i);
451
-
452
- if (fromMatch) {
453
- const term = `%${fromMatch[1].replace(/"/g, "")}%`;
454
- conditions.push("(from_name LIKE ? OR from_address LIKE ?)");
455
- params.push(term, term);
456
- } else if (toMatch) {
457
- const term = `%${toMatch[1].replace(/"/g, "")}%`;
458
- conditions.push("(to_json LIKE ? OR cc_json LIKE ?)");
459
- params.push(term, term);
460
- } else if (subjectMatch) {
461
- const term = `%${subjectMatch[1].replace(/"/g, "")}%`;
462
- conditions.push("subject LIKE ?");
463
- params.push(term);
464
- } else if (hasMatch) {
465
- const v = hasMatch[1].toLowerCase();
466
- if (v === "attachment" || v === "attachments") {
467
- conditions.push("has_attachments = 1");
468
- }
469
- // Unknown has: qualifier — silently drop; treating as a literal
470
- // search term would be confusing.
471
- } else if (isMatch) {
472
- const v = isMatch[1].toLowerCase();
473
- if (v === "flagged" || v === "starred") {
474
- conditions.push("flags_json LIKE ?"); params.push("%\\\\Flagged%");
475
- } else if (v === "unread") {
476
- conditions.push("flags_json NOT LIKE ?"); params.push("%\\\\Seen%");
477
- } else if (v === "read") {
478
- conditions.push("flags_json LIKE ?"); params.push("%\\\\Seen%");
479
- }
480
- } else if (dateMatch) {
481
- const spec = parseDateSpec(dateMatch[1]);
482
- if (spec) {
483
- if (spec.from !== undefined) {
484
- conditions.push("date >= ?"); params.push(spec.from);
485
- }
486
- if (spec.to !== undefined) {
487
- conditions.push("date < ?"); params.push(spec.to);
488
- }
489
- }
490
- } else {
491
- const term = `%${part}%`;
492
- conditions.push("(subject LIKE ? OR from_name LIKE ? OR from_address LIKE ? OR preview LIKE ?)");
493
- params.push(term, term, term, term);
494
- }
495
- }
496
-
497
- return { conditions, params };
498
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": ".",
5
- "rootDir": "."
6
- },
7
- "include": ["*.ts"],
8
- "exclude": ["node_modules", "prev", "cruft", "tests"]
9
- }