@rapidmx/restapi 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (435) hide show
  1. package/LICENSE +382 -0
  2. package/README.md +50 -0
  3. package/dist/lib/blob/BlobStore.js +6 -0
  4. package/dist/lib/blob/BlobStore.js.map +1 -0
  5. package/dist/lib/blob/LocalFsBlobStore.js +101 -0
  6. package/dist/lib/blob/LocalFsBlobStore.js.map +1 -0
  7. package/dist/lib/blob/index.js +7 -0
  8. package/dist/lib/blob/index.js.map +1 -0
  9. package/dist/lib/index.js +12 -0
  10. package/dist/lib/index.js.map +1 -0
  11. package/dist/lib/jobs/AttachmentExtractionJob.js +124 -0
  12. package/dist/lib/jobs/AttachmentExtractionJob.js.map +1 -0
  13. package/dist/lib/jobs/CalendarReminderJob.js +132 -0
  14. package/dist/lib/jobs/CalendarReminderJob.js.map +1 -0
  15. package/dist/lib/jobs/EasDeviceStateCleanupJob.js +101 -0
  16. package/dist/lib/jobs/EasDeviceStateCleanupJob.js.map +1 -0
  17. package/dist/lib/jobs/ExternalShareExpirationJob.js +117 -0
  18. package/dist/lib/jobs/ExternalShareExpirationJob.js.map +1 -0
  19. package/dist/lib/jobs/MailboxQuotaRecalcJob.js +163 -0
  20. package/dist/lib/jobs/MailboxQuotaRecalcJob.js.map +1 -0
  21. package/dist/lib/jobs/MeetingSchedulingJob.js +106 -0
  22. package/dist/lib/jobs/MeetingSchedulingJob.js.map +1 -0
  23. package/dist/lib/jobs/QuarantineRetentionJob.js +97 -0
  24. package/dist/lib/jobs/QuarantineRetentionJob.js.map +1 -0
  25. package/dist/lib/jobs/ScanQueueJob.js +223 -0
  26. package/dist/lib/jobs/ScanQueueJob.js.map +1 -0
  27. package/dist/lib/jobs/SearchIndexJob.js +146 -0
  28. package/dist/lib/jobs/SearchIndexJob.js.map +1 -0
  29. package/dist/lib/jobs/index.js +10 -0
  30. package/dist/lib/jobs/index.js.map +1 -0
  31. package/dist/lib/jobs/mongo/AttachmentExtractionJobMongo.js +14 -0
  32. package/dist/lib/jobs/mongo/AttachmentExtractionJobMongo.js.map +1 -0
  33. package/dist/lib/jobs/mongo/CalendarReminderJobMongo.js +13 -0
  34. package/dist/lib/jobs/mongo/CalendarReminderJobMongo.js.map +1 -0
  35. package/dist/lib/jobs/mongo/EasDeviceStateCleanupJobMongo.js +13 -0
  36. package/dist/lib/jobs/mongo/EasDeviceStateCleanupJobMongo.js.map +1 -0
  37. package/dist/lib/jobs/mongo/ExternalShareExpirationJobMongo.js +13 -0
  38. package/dist/lib/jobs/mongo/ExternalShareExpirationJobMongo.js.map +1 -0
  39. package/dist/lib/jobs/mongo/MailboxQuotaRecalcJobMongo.js +15 -0
  40. package/dist/lib/jobs/mongo/MailboxQuotaRecalcJobMongo.js.map +1 -0
  41. package/dist/lib/jobs/mongo/MeetingSchedulingJobMongo.js +13 -0
  42. package/dist/lib/jobs/mongo/MeetingSchedulingJobMongo.js.map +1 -0
  43. package/dist/lib/jobs/mongo/QuarantineRetentionJobMongo.js +13 -0
  44. package/dist/lib/jobs/mongo/QuarantineRetentionJobMongo.js.map +1 -0
  45. package/dist/lib/jobs/mongo/ScanQueueJobMongo.js +18 -0
  46. package/dist/lib/jobs/mongo/ScanQueueJobMongo.js.map +1 -0
  47. package/dist/lib/jobs/mongo/SearchIndexJobMongo.js +14 -0
  48. package/dist/lib/jobs/mongo/SearchIndexJobMongo.js.map +1 -0
  49. package/dist/lib/jobs/mongo/index.js +10 -0
  50. package/dist/lib/jobs/mongo/index.js.map +1 -0
  51. package/dist/lib/jobs/mongo.js +2 -0
  52. package/dist/lib/jobs/mongo.js.map +1 -0
  53. package/dist/lib/jobs/sql/AttachmentExtractionJobSQL.js +14 -0
  54. package/dist/lib/jobs/sql/AttachmentExtractionJobSQL.js.map +1 -0
  55. package/dist/lib/jobs/sql/CalendarReminderJobSQL.js +13 -0
  56. package/dist/lib/jobs/sql/CalendarReminderJobSQL.js.map +1 -0
  57. package/dist/lib/jobs/sql/EasDeviceStateCleanupJobSQL.js +13 -0
  58. package/dist/lib/jobs/sql/EasDeviceStateCleanupJobSQL.js.map +1 -0
  59. package/dist/lib/jobs/sql/ExternalShareExpirationJobSQL.js +13 -0
  60. package/dist/lib/jobs/sql/ExternalShareExpirationJobSQL.js.map +1 -0
  61. package/dist/lib/jobs/sql/MailboxQuotaRecalcJobSQL.js +15 -0
  62. package/dist/lib/jobs/sql/MailboxQuotaRecalcJobSQL.js.map +1 -0
  63. package/dist/lib/jobs/sql/MeetingSchedulingJobSQL.js +13 -0
  64. package/dist/lib/jobs/sql/MeetingSchedulingJobSQL.js.map +1 -0
  65. package/dist/lib/jobs/sql/QuarantineRetentionJobSQL.js +13 -0
  66. package/dist/lib/jobs/sql/QuarantineRetentionJobSQL.js.map +1 -0
  67. package/dist/lib/jobs/sql/ScanQueueJobSQL.js +18 -0
  68. package/dist/lib/jobs/sql/ScanQueueJobSQL.js.map +1 -0
  69. package/dist/lib/jobs/sql/SearchIndexJobSQL.js +14 -0
  70. package/dist/lib/jobs/sql/SearchIndexJobSQL.js.map +1 -0
  71. package/dist/lib/jobs/sql/index.js +10 -0
  72. package/dist/lib/jobs/sql/index.js.map +1 -0
  73. package/dist/lib/jobs/sql.js +2 -0
  74. package/dist/lib/jobs/sql.js.map +1 -0
  75. package/dist/lib/models/index.js +2 -0
  76. package/dist/lib/models/index.js.map +1 -0
  77. package/dist/lib/models/mongo/AttachmentMongo.js +129 -0
  78. package/dist/lib/models/mongo/AttachmentMongo.js.map +1 -0
  79. package/dist/lib/models/mongo/CalendarEventMongo.js +172 -0
  80. package/dist/lib/models/mongo/CalendarEventMongo.js.map +1 -0
  81. package/dist/lib/models/mongo/CalendarShareLinkMongo.js +85 -0
  82. package/dist/lib/models/mongo/CalendarShareLinkMongo.js.map +1 -0
  83. package/dist/lib/models/mongo/ContactListMongo.js +60 -0
  84. package/dist/lib/models/mongo/ContactListMongo.js.map +1 -0
  85. package/dist/lib/models/mongo/ContactMongo.js +148 -0
  86. package/dist/lib/models/mongo/ContactMongo.js.map +1 -0
  87. package/dist/lib/models/mongo/DeviceSyncStateMongo.js +97 -0
  88. package/dist/lib/models/mongo/DeviceSyncStateMongo.js.map +1 -0
  89. package/dist/lib/models/mongo/FolderMongo.js +102 -0
  90. package/dist/lib/models/mongo/FolderMongo.js.map +1 -0
  91. package/dist/lib/models/mongo/IngestQueueEntryMongo.js +93 -0
  92. package/dist/lib/models/mongo/IngestQueueEntryMongo.js.map +1 -0
  93. package/dist/lib/models/mongo/MailboxMongo.js +105 -0
  94. package/dist/lib/models/mongo/MailboxMongo.js.map +1 -0
  95. package/dist/lib/models/mongo/MessageMongo.js +180 -0
  96. package/dist/lib/models/mongo/MessageMongo.js.map +1 -0
  97. package/dist/lib/models/mongo/NoteMongo.js +83 -0
  98. package/dist/lib/models/mongo/NoteMongo.js.map +1 -0
  99. package/dist/lib/models/mongo/QuarantineEntryMongo.js +99 -0
  100. package/dist/lib/models/mongo/QuarantineEntryMongo.js.map +1 -0
  101. package/dist/lib/models/mongo/ScanResultMongo.js +112 -0
  102. package/dist/lib/models/mongo/ScanResultMongo.js.map +1 -0
  103. package/dist/lib/models/mongo/SearchIndexStateMongo.js +83 -0
  104. package/dist/lib/models/mongo/SearchIndexStateMongo.js.map +1 -0
  105. package/dist/lib/models/mongo/TaskMongo.js +105 -0
  106. package/dist/lib/models/mongo/TaskMongo.js.map +1 -0
  107. package/dist/lib/models/mongo/index.js +16 -0
  108. package/dist/lib/models/mongo/index.js.map +1 -0
  109. package/dist/lib/models/mongo.js +2 -0
  110. package/dist/lib/models/mongo.js.map +1 -0
  111. package/dist/lib/models/sql/AttachmentSQL.js +129 -0
  112. package/dist/lib/models/sql/AttachmentSQL.js.map +1 -0
  113. package/dist/lib/models/sql/CalendarEventSQL.js +176 -0
  114. package/dist/lib/models/sql/CalendarEventSQL.js.map +1 -0
  115. package/dist/lib/models/sql/CalendarShareLinkSQL.js +85 -0
  116. package/dist/lib/models/sql/CalendarShareLinkSQL.js.map +1 -0
  117. package/dist/lib/models/sql/ContactListSQL.js +60 -0
  118. package/dist/lib/models/sql/ContactListSQL.js.map +1 -0
  119. package/dist/lib/models/sql/ContactSQL.js +148 -0
  120. package/dist/lib/models/sql/ContactSQL.js.map +1 -0
  121. package/dist/lib/models/sql/DeviceSyncStateSQL.js +97 -0
  122. package/dist/lib/models/sql/DeviceSyncStateSQL.js.map +1 -0
  123. package/dist/lib/models/sql/FolderSQL.js +106 -0
  124. package/dist/lib/models/sql/FolderSQL.js.map +1 -0
  125. package/dist/lib/models/sql/IngestQueueEntrySQL.js +97 -0
  126. package/dist/lib/models/sql/IngestQueueEntrySQL.js.map +1 -0
  127. package/dist/lib/models/sql/MailboxSQL.js +105 -0
  128. package/dist/lib/models/sql/MailboxSQL.js.map +1 -0
  129. package/dist/lib/models/sql/MessageSQL.js +184 -0
  130. package/dist/lib/models/sql/MessageSQL.js.map +1 -0
  131. package/dist/lib/models/sql/NoteSQL.js +83 -0
  132. package/dist/lib/models/sql/NoteSQL.js.map +1 -0
  133. package/dist/lib/models/sql/QuarantineEntrySQL.js +103 -0
  134. package/dist/lib/models/sql/QuarantineEntrySQL.js.map +1 -0
  135. package/dist/lib/models/sql/ScanResultSQL.js +116 -0
  136. package/dist/lib/models/sql/ScanResultSQL.js.map +1 -0
  137. package/dist/lib/models/sql/SearchIndexStateSQL.js +83 -0
  138. package/dist/lib/models/sql/SearchIndexStateSQL.js.map +1 -0
  139. package/dist/lib/models/sql/TaskSQL.js +109 -0
  140. package/dist/lib/models/sql/TaskSQL.js.map +1 -0
  141. package/dist/lib/models/sql/index.js +16 -0
  142. package/dist/lib/models/sql/index.js.map +1 -0
  143. package/dist/lib/models/sql.js +2 -0
  144. package/dist/lib/models/sql.js.map +1 -0
  145. package/dist/lib/models/types.js +108 -0
  146. package/dist/lib/models/types.js.map +1 -0
  147. package/dist/lib/mongo.js +8 -0
  148. package/dist/lib/mongo.js.map +1 -0
  149. package/dist/lib/push/MailPushRoute.js +42 -0
  150. package/dist/lib/push/MailPushRoute.js.map +1 -0
  151. package/dist/lib/push/index.js +6 -0
  152. package/dist/lib/push/index.js.map +1 -0
  153. package/dist/lib/routes/BaseAttachmentRoute.js +142 -0
  154. package/dist/lib/routes/BaseAttachmentRoute.js.map +1 -0
  155. package/dist/lib/routes/BaseCalendarShareLinkRoute.js +123 -0
  156. package/dist/lib/routes/BaseCalendarShareLinkRoute.js.map +1 -0
  157. package/dist/lib/routes/BaseFolderRoute.js +192 -0
  158. package/dist/lib/routes/BaseFolderRoute.js.map +1 -0
  159. package/dist/lib/routes/BaseMailIngestRoute.js +179 -0
  160. package/dist/lib/routes/BaseMailIngestRoute.js.map +1 -0
  161. package/dist/lib/routes/BaseMailboxRoute.js +187 -0
  162. package/dist/lib/routes/BaseMailboxRoute.js.map +1 -0
  163. package/dist/lib/routes/BaseMessageRoute.js +142 -0
  164. package/dist/lib/routes/BaseMessageRoute.js.map +1 -0
  165. package/dist/lib/routes/BaseScopedChildRoute.js +348 -0
  166. package/dist/lib/routes/BaseScopedChildRoute.js.map +1 -0
  167. package/dist/lib/routes/BaseSearchRoute.js +91 -0
  168. package/dist/lib/routes/BaseSearchRoute.js.map +1 -0
  169. package/dist/lib/routes/index.js +13 -0
  170. package/dist/lib/routes/index.js.map +1 -0
  171. package/dist/lib/routes/mongo/AttachmentRouteMongo.js +26 -0
  172. package/dist/lib/routes/mongo/AttachmentRouteMongo.js.map +1 -0
  173. package/dist/lib/routes/mongo/CalendarEventRouteMongo.js +27 -0
  174. package/dist/lib/routes/mongo/CalendarEventRouteMongo.js.map +1 -0
  175. package/dist/lib/routes/mongo/CalendarShareLinkRouteMongo.js +26 -0
  176. package/dist/lib/routes/mongo/CalendarShareLinkRouteMongo.js.map +1 -0
  177. package/dist/lib/routes/mongo/ContactListRouteMongo.js +26 -0
  178. package/dist/lib/routes/mongo/ContactListRouteMongo.js.map +1 -0
  179. package/dist/lib/routes/mongo/ContactRouteMongo.js +27 -0
  180. package/dist/lib/routes/mongo/ContactRouteMongo.js.map +1 -0
  181. package/dist/lib/routes/mongo/FolderRouteMongo.js +26 -0
  182. package/dist/lib/routes/mongo/FolderRouteMongo.js.map +1 -0
  183. package/dist/lib/routes/mongo/IngestQueueRouteMongo.js +33 -0
  184. package/dist/lib/routes/mongo/IngestQueueRouteMongo.js.map +1 -0
  185. package/dist/lib/routes/mongo/MailIngestRouteMongo.js +14 -0
  186. package/dist/lib/routes/mongo/MailIngestRouteMongo.js.map +1 -0
  187. package/dist/lib/routes/mongo/MailboxRouteMongo.js +39 -0
  188. package/dist/lib/routes/mongo/MailboxRouteMongo.js.map +1 -0
  189. package/dist/lib/routes/mongo/MessageRouteMongo.js +27 -0
  190. package/dist/lib/routes/mongo/MessageRouteMongo.js.map +1 -0
  191. package/dist/lib/routes/mongo/NoteRouteMongo.js +26 -0
  192. package/dist/lib/routes/mongo/NoteRouteMongo.js.map +1 -0
  193. package/dist/lib/routes/mongo/QuarantineRouteMongo.js +35 -0
  194. package/dist/lib/routes/mongo/QuarantineRouteMongo.js.map +1 -0
  195. package/dist/lib/routes/mongo/SearchRouteMongo.js +13 -0
  196. package/dist/lib/routes/mongo/SearchRouteMongo.js.map +1 -0
  197. package/dist/lib/routes/mongo/TaskRouteMongo.js +27 -0
  198. package/dist/lib/routes/mongo/TaskRouteMongo.js.map +1 -0
  199. package/dist/lib/routes/mongo/index.js +15 -0
  200. package/dist/lib/routes/mongo/index.js.map +1 -0
  201. package/dist/lib/routes/mongo.js +2 -0
  202. package/dist/lib/routes/mongo.js.map +1 -0
  203. package/dist/lib/routes/sql/AttachmentRouteSQL.js +26 -0
  204. package/dist/lib/routes/sql/AttachmentRouteSQL.js.map +1 -0
  205. package/dist/lib/routes/sql/CalendarEventRouteSQL.js +27 -0
  206. package/dist/lib/routes/sql/CalendarEventRouteSQL.js.map +1 -0
  207. package/dist/lib/routes/sql/CalendarShareLinkRouteSQL.js +26 -0
  208. package/dist/lib/routes/sql/CalendarShareLinkRouteSQL.js.map +1 -0
  209. package/dist/lib/routes/sql/ContactListRouteSQL.js +26 -0
  210. package/dist/lib/routes/sql/ContactListRouteSQL.js.map +1 -0
  211. package/dist/lib/routes/sql/ContactRouteSQL.js +27 -0
  212. package/dist/lib/routes/sql/ContactRouteSQL.js.map +1 -0
  213. package/dist/lib/routes/sql/FolderRouteSQL.js +26 -0
  214. package/dist/lib/routes/sql/FolderRouteSQL.js.map +1 -0
  215. package/dist/lib/routes/sql/IngestQueueRouteSQL.js +29 -0
  216. package/dist/lib/routes/sql/IngestQueueRouteSQL.js.map +1 -0
  217. package/dist/lib/routes/sql/MailIngestRouteSQL.js +35 -0
  218. package/dist/lib/routes/sql/MailIngestRouteSQL.js.map +1 -0
  219. package/dist/lib/routes/sql/MailboxRouteSQL.js +64 -0
  220. package/dist/lib/routes/sql/MailboxRouteSQL.js.map +1 -0
  221. package/dist/lib/routes/sql/MessageRouteSQL.js +27 -0
  222. package/dist/lib/routes/sql/MessageRouteSQL.js.map +1 -0
  223. package/dist/lib/routes/sql/NoteRouteSQL.js +26 -0
  224. package/dist/lib/routes/sql/NoteRouteSQL.js.map +1 -0
  225. package/dist/lib/routes/sql/QuarantineRouteSQL.js +29 -0
  226. package/dist/lib/routes/sql/QuarantineRouteSQL.js.map +1 -0
  227. package/dist/lib/routes/sql/SearchRouteSQL.js +13 -0
  228. package/dist/lib/routes/sql/SearchRouteSQL.js.map +1 -0
  229. package/dist/lib/routes/sql/TaskRouteSQL.js +27 -0
  230. package/dist/lib/routes/sql/TaskRouteSQL.js.map +1 -0
  231. package/dist/lib/routes/sql/index.js +15 -0
  232. package/dist/lib/routes/sql/index.js.map +1 -0
  233. package/dist/lib/routes/sql.js +2 -0
  234. package/dist/lib/routes/sql.js.map +1 -0
  235. package/dist/lib/scan/AvScanProvider.js +2 -0
  236. package/dist/lib/scan/AvScanProvider.js.map +1 -0
  237. package/dist/lib/scan/ClamAvScanProvider.js +112 -0
  238. package/dist/lib/scan/ClamAvScanProvider.js.map +1 -0
  239. package/dist/lib/scan/RspamdSpamScanProvider.js +100 -0
  240. package/dist/lib/scan/RspamdSpamScanProvider.js.map +1 -0
  241. package/dist/lib/scan/ScanPipeline.js +118 -0
  242. package/dist/lib/scan/ScanPipeline.js.map +1 -0
  243. package/dist/lib/scan/SpamScanProvider.js +2 -0
  244. package/dist/lib/scan/SpamScanProvider.js.map +1 -0
  245. package/dist/lib/scan/index.js +10 -0
  246. package/dist/lib/scan/index.js.map +1 -0
  247. package/dist/lib/search/MongoTextSearchProvider.js +116 -0
  248. package/dist/lib/search/MongoTextSearchProvider.js.map +1 -0
  249. package/dist/lib/search/OpenSearchProvider.js +156 -0
  250. package/dist/lib/search/OpenSearchProvider.js.map +1 -0
  251. package/dist/lib/search/PostgresFullTextSearchProvider.js +139 -0
  252. package/dist/lib/search/PostgresFullTextSearchProvider.js.map +1 -0
  253. package/dist/lib/search/SearchProvider.js +6 -0
  254. package/dist/lib/search/SearchProvider.js.map +1 -0
  255. package/dist/lib/search/extraction/DocxTextExtractor.js +27 -0
  256. package/dist/lib/search/extraction/DocxTextExtractor.js.map +1 -0
  257. package/dist/lib/search/extraction/ExtractorRegistry.js +82 -0
  258. package/dist/lib/search/extraction/ExtractorRegistry.js.map +1 -0
  259. package/dist/lib/search/extraction/HtmlTextExtractor.js +20 -0
  260. package/dist/lib/search/extraction/HtmlTextExtractor.js.map +1 -0
  261. package/dist/lib/search/extraction/PdfTextExtractor.js +22 -0
  262. package/dist/lib/search/extraction/PdfTextExtractor.js.map +1 -0
  263. package/dist/lib/search/extraction/PlainTextExtractor.js +14 -0
  264. package/dist/lib/search/extraction/PlainTextExtractor.js.map +1 -0
  265. package/dist/lib/search/extraction/TextExtractor.js +6 -0
  266. package/dist/lib/search/extraction/TextExtractor.js.map +1 -0
  267. package/dist/lib/search/index.js +15 -0
  268. package/dist/lib/search/index.js.map +1 -0
  269. package/dist/lib/sql.js +8 -0
  270. package/dist/lib/sql.js.map +1 -0
  271. package/dist/lib/transport/MTAIngestAdapter.js +30 -0
  272. package/dist/lib/transport/MTAIngestAdapter.js.map +1 -0
  273. package/dist/lib/transport/MailTransport.js +6 -0
  274. package/dist/lib/transport/MailTransport.js.map +1 -0
  275. package/dist/lib/transport/PostfixSendmailTransport.js +61 -0
  276. package/dist/lib/transport/PostfixSendmailTransport.js.map +1 -0
  277. package/dist/lib/transport/index.js +8 -0
  278. package/dist/lib/transport/index.js.map +1 -0
  279. package/dist/lib/util/FolderUtils.js +50 -0
  280. package/dist/lib/util/FolderUtils.js.map +1 -0
  281. package/dist/lib/util/MailSendUtils.js +36 -0
  282. package/dist/lib/util/MailSendUtils.js.map +1 -0
  283. package/dist/lib/util/MailboxScopeUtils.js +23 -0
  284. package/dist/lib/util/MailboxScopeUtils.js.map +1 -0
  285. package/dist/lib/util/OptionalDeps.js +23 -0
  286. package/dist/lib/util/OptionalDeps.js.map +1 -0
  287. package/dist/lib/util/RecoverableRepoUtils.js +42 -0
  288. package/dist/lib/util/RecoverableRepoUtils.js.map +1 -0
  289. package/dist/lib/util/index.js +17 -0
  290. package/dist/lib/util/index.js.map +1 -0
  291. package/dist/types/blob/BlobStore.d.ts +54 -0
  292. package/dist/types/blob/LocalFsBlobStore.d.ts +23 -0
  293. package/dist/types/blob/index.d.ts +2 -0
  294. package/dist/types/index.d.ts +7 -0
  295. package/dist/types/jobs/AttachmentExtractionJob.d.ts +34 -0
  296. package/dist/types/jobs/CalendarReminderJob.d.ts +37 -0
  297. package/dist/types/jobs/EasDeviceStateCleanupJob.d.ts +26 -0
  298. package/dist/types/jobs/ExternalShareExpirationJob.d.ts +34 -0
  299. package/dist/types/jobs/MailboxQuotaRecalcJob.d.ts +44 -0
  300. package/dist/types/jobs/MeetingSchedulingJob.d.ts +32 -0
  301. package/dist/types/jobs/QuarantineRetentionJob.d.ts +27 -0
  302. package/dist/types/jobs/ScanQueueJob.d.ts +41 -0
  303. package/dist/types/jobs/SearchIndexJob.d.ts +37 -0
  304. package/dist/types/jobs/index.d.ts +9 -0
  305. package/dist/types/jobs/mongo/AttachmentExtractionJobMongo.d.ts +6 -0
  306. package/dist/types/jobs/mongo/CalendarReminderJobMongo.d.ts +5 -0
  307. package/dist/types/jobs/mongo/EasDeviceStateCleanupJobMongo.d.ts +5 -0
  308. package/dist/types/jobs/mongo/ExternalShareExpirationJobMongo.d.ts +5 -0
  309. package/dist/types/jobs/mongo/MailboxQuotaRecalcJobMongo.d.ts +7 -0
  310. package/dist/types/jobs/mongo/MeetingSchedulingJobMongo.d.ts +5 -0
  311. package/dist/types/jobs/mongo/QuarantineRetentionJobMongo.d.ts +5 -0
  312. package/dist/types/jobs/mongo/ScanQueueJobMongo.d.ts +10 -0
  313. package/dist/types/jobs/mongo/SearchIndexJobMongo.d.ts +6 -0
  314. package/dist/types/jobs/mongo/index.d.ts +9 -0
  315. package/dist/types/jobs/mongo.d.ts +1 -0
  316. package/dist/types/jobs/sql/AttachmentExtractionJobSQL.d.ts +6 -0
  317. package/dist/types/jobs/sql/CalendarReminderJobSQL.d.ts +5 -0
  318. package/dist/types/jobs/sql/EasDeviceStateCleanupJobSQL.d.ts +5 -0
  319. package/dist/types/jobs/sql/ExternalShareExpirationJobSQL.d.ts +5 -0
  320. package/dist/types/jobs/sql/MailboxQuotaRecalcJobSQL.d.ts +7 -0
  321. package/dist/types/jobs/sql/MeetingSchedulingJobSQL.d.ts +5 -0
  322. package/dist/types/jobs/sql/QuarantineRetentionJobSQL.d.ts +5 -0
  323. package/dist/types/jobs/sql/ScanQueueJobSQL.d.ts +10 -0
  324. package/dist/types/jobs/sql/SearchIndexJobSQL.d.ts +6 -0
  325. package/dist/types/jobs/sql/index.d.ts +9 -0
  326. package/dist/types/jobs/sql.d.ts +1 -0
  327. package/dist/types/models/index.d.ts +1 -0
  328. package/dist/types/models/mongo/AttachmentMongo.d.ts +22 -0
  329. package/dist/types/models/mongo/CalendarEventMongo.d.ts +28 -0
  330. package/dist/types/models/mongo/CalendarShareLinkMongo.d.ts +16 -0
  331. package/dist/types/models/mongo/ContactListMongo.d.ts +13 -0
  332. package/dist/types/models/mongo/ContactMongo.d.ts +25 -0
  333. package/dist/types/models/mongo/DeviceSyncStateMongo.d.ts +18 -0
  334. package/dist/types/models/mongo/FolderMongo.d.ts +18 -0
  335. package/dist/types/models/mongo/IngestQueueEntryMongo.d.ts +17 -0
  336. package/dist/types/models/mongo/MailboxMongo.d.ts +18 -0
  337. package/dist/types/models/mongo/MessageMongo.d.ts +29 -0
  338. package/dist/types/models/mongo/NoteMongo.d.ts +16 -0
  339. package/dist/types/models/mongo/QuarantineEntryMongo.d.ts +18 -0
  340. package/dist/types/models/mongo/ScanResultMongo.d.ts +23 -0
  341. package/dist/types/models/mongo/SearchIndexStateMongo.d.ts +16 -0
  342. package/dist/types/models/mongo/TaskMongo.d.ts +19 -0
  343. package/dist/types/models/mongo/index.d.ts +15 -0
  344. package/dist/types/models/mongo.d.ts +1 -0
  345. package/dist/types/models/sql/AttachmentSQL.d.ts +22 -0
  346. package/dist/types/models/sql/CalendarEventSQL.d.ts +28 -0
  347. package/dist/types/models/sql/CalendarShareLinkSQL.d.ts +16 -0
  348. package/dist/types/models/sql/ContactListSQL.d.ts +13 -0
  349. package/dist/types/models/sql/ContactSQL.d.ts +25 -0
  350. package/dist/types/models/sql/DeviceSyncStateSQL.d.ts +18 -0
  351. package/dist/types/models/sql/FolderSQL.d.ts +18 -0
  352. package/dist/types/models/sql/IngestQueueEntrySQL.d.ts +17 -0
  353. package/dist/types/models/sql/MailboxSQL.d.ts +18 -0
  354. package/dist/types/models/sql/MessageSQL.d.ts +29 -0
  355. package/dist/types/models/sql/NoteSQL.d.ts +16 -0
  356. package/dist/types/models/sql/QuarantineEntrySQL.d.ts +18 -0
  357. package/dist/types/models/sql/ScanResultSQL.d.ts +23 -0
  358. package/dist/types/models/sql/SearchIndexStateSQL.d.ts +16 -0
  359. package/dist/types/models/sql/TaskSQL.d.ts +19 -0
  360. package/dist/types/models/sql/index.d.ts +15 -0
  361. package/dist/types/models/sql.d.ts +1 -0
  362. package/dist/types/models/types.d.ts +541 -0
  363. package/dist/types/mongo.d.ts +3 -0
  364. package/dist/types/push/MailPushRoute.d.ts +37 -0
  365. package/dist/types/push/index.d.ts +1 -0
  366. package/dist/types/routes/BaseAttachmentRoute.d.ts +24 -0
  367. package/dist/types/routes/BaseCalendarShareLinkRoute.d.ts +35 -0
  368. package/dist/types/routes/BaseFolderRoute.d.ts +58 -0
  369. package/dist/types/routes/BaseMailIngestRoute.d.ts +47 -0
  370. package/dist/types/routes/BaseMailboxRoute.d.ts +60 -0
  371. package/dist/types/routes/BaseMessageRoute.d.ts +27 -0
  372. package/dist/types/routes/BaseScopedChildRoute.d.ts +61 -0
  373. package/dist/types/routes/BaseSearchRoute.d.ts +23 -0
  374. package/dist/types/routes/index.d.ts +8 -0
  375. package/dist/types/routes/mongo/AttachmentRouteMongo.d.ts +6 -0
  376. package/dist/types/routes/mongo/CalendarEventRouteMongo.d.ts +6 -0
  377. package/dist/types/routes/mongo/CalendarShareLinkRouteMongo.d.ts +6 -0
  378. package/dist/types/routes/mongo/ContactListRouteMongo.d.ts +6 -0
  379. package/dist/types/routes/mongo/ContactRouteMongo.d.ts +6 -0
  380. package/dist/types/routes/mongo/FolderRouteMongo.d.ts +5 -0
  381. package/dist/types/routes/mongo/IngestQueueRouteMongo.d.ts +13 -0
  382. package/dist/types/routes/mongo/MailIngestRouteMongo.d.ts +6 -0
  383. package/dist/types/routes/mongo/MailboxRouteMongo.d.ts +8 -0
  384. package/dist/types/routes/mongo/MessageRouteMongo.d.ts +6 -0
  385. package/dist/types/routes/mongo/NoteRouteMongo.d.ts +6 -0
  386. package/dist/types/routes/mongo/QuarantineRouteMongo.d.ts +15 -0
  387. package/dist/types/routes/mongo/SearchRouteMongo.d.ts +5 -0
  388. package/dist/types/routes/mongo/TaskRouteMongo.d.ts +6 -0
  389. package/dist/types/routes/mongo/index.d.ts +14 -0
  390. package/dist/types/routes/mongo.d.ts +1 -0
  391. package/dist/types/routes/sql/AttachmentRouteSQL.d.ts +6 -0
  392. package/dist/types/routes/sql/CalendarEventRouteSQL.d.ts +6 -0
  393. package/dist/types/routes/sql/CalendarShareLinkRouteSQL.d.ts +6 -0
  394. package/dist/types/routes/sql/ContactListRouteSQL.d.ts +6 -0
  395. package/dist/types/routes/sql/ContactRouteSQL.d.ts +6 -0
  396. package/dist/types/routes/sql/FolderRouteSQL.d.ts +5 -0
  397. package/dist/types/routes/sql/IngestQueueRouteSQL.d.ts +9 -0
  398. package/dist/types/routes/sql/MailIngestRouteSQL.d.ts +23 -0
  399. package/dist/types/routes/sql/MailboxRouteSQL.d.ts +22 -0
  400. package/dist/types/routes/sql/MessageRouteSQL.d.ts +6 -0
  401. package/dist/types/routes/sql/NoteRouteSQL.d.ts +6 -0
  402. package/dist/types/routes/sql/QuarantineRouteSQL.d.ts +9 -0
  403. package/dist/types/routes/sql/SearchRouteSQL.d.ts +5 -0
  404. package/dist/types/routes/sql/TaskRouteSQL.d.ts +6 -0
  405. package/dist/types/routes/sql/index.d.ts +14 -0
  406. package/dist/types/routes/sql.d.ts +1 -0
  407. package/dist/types/scan/AvScanProvider.d.ts +22 -0
  408. package/dist/types/scan/ClamAvScanProvider.d.ts +17 -0
  409. package/dist/types/scan/RspamdSpamScanProvider.d.ts +16 -0
  410. package/dist/types/scan/ScanPipeline.d.ts +53 -0
  411. package/dist/types/scan/SpamScanProvider.d.ts +29 -0
  412. package/dist/types/scan/index.d.ts +5 -0
  413. package/dist/types/search/MongoTextSearchProvider.d.ts +22 -0
  414. package/dist/types/search/OpenSearchProvider.d.ts +24 -0
  415. package/dist/types/search/PostgresFullTextSearchProvider.d.ts +21 -0
  416. package/dist/types/search/SearchProvider.d.ts +62 -0
  417. package/dist/types/search/extraction/DocxTextExtractor.d.ts +14 -0
  418. package/dist/types/search/extraction/ExtractorRegistry.d.ts +19 -0
  419. package/dist/types/search/extraction/HtmlTextExtractor.d.ts +11 -0
  420. package/dist/types/search/extraction/PdfTextExtractor.d.ts +10 -0
  421. package/dist/types/search/extraction/PlainTextExtractor.d.ts +10 -0
  422. package/dist/types/search/extraction/TextExtractor.d.ts +17 -0
  423. package/dist/types/search/index.d.ts +10 -0
  424. package/dist/types/sql.d.ts +3 -0
  425. package/dist/types/transport/MTAIngestAdapter.d.ts +25 -0
  426. package/dist/types/transport/MailTransport.d.ts +29 -0
  427. package/dist/types/transport/PostfixSendmailTransport.d.ts +15 -0
  428. package/dist/types/transport/index.d.ts +3 -0
  429. package/dist/types/util/FolderUtils.d.ts +15 -0
  430. package/dist/types/util/MailSendUtils.d.ts +19 -0
  431. package/dist/types/util/MailboxScopeUtils.d.ts +19 -0
  432. package/dist/types/util/OptionalDeps.d.ts +9 -0
  433. package/dist/types/util/RecoverableRepoUtils.d.ts +24 -0
  434. package/dist/types/util/index.d.ts +12 -0
  435. package/package.json +122 -0
@@ -0,0 +1,541 @@
1
+ import { BaseEntity, RecoverableBaseEntity } from "@rapidrest/service-core";
2
+ /**
3
+ * The kind of well-known folder a `Folder` represents. `USER` is any folder created by the mailbox owner
4
+ * (or a client) rather than one of the special system folders every mailbox is provisioned with.
5
+ */
6
+ export declare enum FolderType {
7
+ INBOX = "inbox",
8
+ SENT_ITEMS = "sent_items",
9
+ DRAFTS = "drafts",
10
+ DELETED_ITEMS = "deleted_items",
11
+ OUTBOX = "outbox",
12
+ JUNK = "junk",
13
+ CALENDAR = "calendar",
14
+ CONTACTS = "contacts",
15
+ TASKS = "tasks",
16
+ NOTES = "notes",
17
+ USER = "user"
18
+ }
19
+ /**
20
+ * Defines a single mailbox belonging to a `User`. A mailbox is the root of a user's Folder hierarchy and the
21
+ * unit that MAPI/EAS clients log on to.
22
+ *
23
+ * @author Jean-Philippe Steinmetz
24
+ */
25
+ export interface Mailbox extends BaseEntity {
26
+ /**
27
+ * The unique identifier of the `User` (from `@rapidrest/auth`) that owns this mailbox, if any. `undefined`
28
+ * for a true shared mailbox (the Exchange "shared mailbox" concept, e.g. `support@example.com`) that has
29
+ * no single owner — access to one of those is granted entirely via delegate `ACLRecord`s on the mailbox's
30
+ * own `AccessControlList` instead. Creating an ownerless mailbox is a trusted-role-only action; a regular
31
+ * self-service `create()` call always still makes the caller the owner. See `BaseMailboxRoute` for how
32
+ * `find()`/`count()` resolve visibility (owned + shared + trusted-caller-sees-all) entirely from the ACL
33
+ * system rather than from this field.
34
+ */
35
+ ownerUserUid?: string;
36
+ /** The primary SMTP address that mail addressed to this mailbox is delivered under. */
37
+ primarySmtpAddress: string;
38
+ /** Additional SMTP addresses that also deliver to this mailbox. */
39
+ aliasAddresses: string[];
40
+ /** The display name shown to recipients (e.g. in the `From` header) for mail sent from this mailbox. */
41
+ displayName: string;
42
+ /** The IANA timezone identifier (e.g. `America/Los_Angeles`) used to render dates/times for this mailbox. */
43
+ timezone: string;
44
+ /** The maximum total size, in bytes, of all messages/attachments this mailbox may store. */
45
+ quotaBytes: number;
46
+ /** The current total size, in bytes, of all messages/attachments stored in this mailbox. */
47
+ usedBytes: number;
48
+ }
49
+ /**
50
+ * Defines a single folder within a `Mailbox`. Folders form a hierarchy via `parentFolderUid` and hold
51
+ * `Message`, `CalendarEvent`, `Contact`, `Task`, or `Note` records depending on `type`.
52
+ *
53
+ * Extends `RecoverableBaseEntity` (soft delete, `deleted: boolean`) rather than plain `BaseEntity` so EAS
54
+ * `FolderSync` can report a removed folder to an already-synced device — see `RecoverableRepoUtils` (in
55
+ * `util/`) and `eas/EasSyncKeyUtils.ts` for the mechanism this backs.
56
+ *
57
+ * @author Jean-Philippe Steinmetz
58
+ */
59
+ export interface Folder extends RecoverableBaseEntity {
60
+ /** The unique identifier of the `Mailbox` this folder belongs to. */
61
+ mailboxUid: string;
62
+ /** The display name of the folder. */
63
+ name: string;
64
+ /** The kind of well-known folder this is, or `USER` for an ordinary user-created folder. */
65
+ type: FolderType;
66
+ /** The unique identifier of the parent folder, or `undefined` if this is a top-level folder. */
67
+ parentFolderUid?: string;
68
+ /** The number of unread items contained directly in this folder. */
69
+ unreadCount: number;
70
+ /** The total number of items contained directly in this folder. */
71
+ totalCount: number;
72
+ /**
73
+ * A monotonically increasing counter bumped on every change (add/change/delete of a contained item, or of
74
+ * the folder itself) to this folder's contents. EAS `SyncKey` and MAPI ICS-style folder sync state are both
75
+ * derived from this value.
76
+ */
77
+ syncKeyVersion: number;
78
+ }
79
+ /** The kind of address a `Recipient` represents on a `Message`. */
80
+ export declare enum RecipientType {
81
+ TO = "to",
82
+ CC = "cc",
83
+ BCC = "bcc"
84
+ }
85
+ /** An embedded recipient (or sender) address on a `Message`. */
86
+ export interface Recipient {
87
+ address: string;
88
+ displayName?: string;
89
+ type: RecipientType;
90
+ }
91
+ /** The read/answered/flagged state of a `Message`. */
92
+ export interface MessageFlags {
93
+ read: boolean;
94
+ flagged: boolean;
95
+ answered: boolean;
96
+ forwarded: boolean;
97
+ }
98
+ export declare enum MessageImportance {
99
+ LOW = "low",
100
+ NORMAL = "normal",
101
+ HIGH = "high"
102
+ }
103
+ /**
104
+ * Defines a single email message stored in a `Folder`. The raw MIME source and sanitized HTML body are not
105
+ * stored inline on this record — they live in the configured `BlobStore`, referenced by
106
+ * `bodyBlobKey`/`sanitizedHtmlBlobKey`.
107
+ *
108
+ * Extends `RecoverableBaseEntity` (soft delete, `deleted: boolean`) rather than plain `BaseEntity` — see the
109
+ * identical note on `Folder`.
110
+ *
111
+ * @author Jean-Philippe Steinmetz
112
+ */
113
+ export interface Message extends RecoverableBaseEntity {
114
+ /** The unique identifier of the `Folder` this message currently resides in. */
115
+ folderUid: string;
116
+ /**
117
+ * The unique identifier of the `Mailbox` this message belongs to.
118
+ *
119
+ * ARCHITECTURE NOTE (the sharing model for this whole library): only two entities get a real per-record
120
+ * `AccessControlList` (`@Protect(..., true)`) — `Mailbox` (the root) and `Folder` (whose ACL's `parentUid`
121
+ * points at its owning mailbox's ACL, so a mailbox-wide grant flows down to every folder in it by default,
122
+ * while a single folder — e.g. one Calendar — can still be shared independently on its own ACL, which is
123
+ * what makes it possible to share just a calendar with someone without sharing the whole mailbox).
124
+ *
125
+ * Every other entity in this library is a "folder child" with no ACL of its own: `Message`,
126
+ * `CalendarEvent`, `Task`, `Note`, `Contact`, `Attachment`, and `CalendarShareLink` all carry a denormalized
127
+ * `folderUid` and are `@Protect(..., false)` — permissions on an individual message/event/etc. are never
128
+ * granted or revoked independently of the folder it lives in, so giving each of them their own ACL document
129
+ * would be both unnecessary (nothing ever differs per-record) and expensive at scale (one ACL document per
130
+ * message vs. one per folder). `ContactList` has no folder to belong to and instead carries a denormalized
131
+ * `mailboxUid`, checked directly against the mailbox's ACL. Every route for these folder/mailbox-scoped
132
+ * entities checks `ACLUtils.hasPermission(user, record.folderUid | record.mailboxUid, action)` against the
133
+ * owning folder's or mailbox's ACL (which `hasPermission` resolves by uid, following its own `parentUid`
134
+ * chain), then performs the actual `RepoUtils` operation with `ignoreACL: true` since permission was
135
+ * already established. See `BaseScopedChildRoute` for the shared implementation, and `BaseFolderRoute` for
136
+ * `Folder`'s own hybrid pattern (real ACL, but `find`/`count`/`create` still need explicit mailbox-scoped
137
+ * permission checks the same way, since a folder doesn't exist yet at create time and class-level `LIST` is
138
+ * denied for privacy the same reason it is everywhere else in this library).
139
+ *
140
+ * `mailboxUid` itself remains on `Message` (redundant with its `Folder`'s own `mailboxUid`) purely as a
141
+ * denormalized convenience for queries that scan a whole mailbox without caring about folder boundaries
142
+ * (e.g. `MailboxQuotaRecalcJob`) — it plays no role in permission checks.
143
+ */
144
+ mailboxUid: string;
145
+ /** The RFC 5322 `Message-ID` header value, used to deduplicate and thread messages. */
146
+ messageId: string;
147
+ subject: string;
148
+ from: Recipient;
149
+ recipients: Recipient[];
150
+ sentDate: Date;
151
+ receivedDate: Date;
152
+ /** The key under which the raw MIME source is stored in the `BlobStore`, unmodified from ingestion/send. */
153
+ bodyBlobKey: string;
154
+ /**
155
+ * The key under which the message's HTML body is stored, AFTER `ScanPipeline`'s sanitization pass has run
156
+ * (script/active-content stripped) — set once scanning completes, absent for a not-yet-scanned draft or a
157
+ * message with no HTML body at all. A renderer displaying message content should always prefer this over
158
+ * re-deriving HTML from `bodyBlobKey`'s raw MIME directly, which is never sanitized.
159
+ */
160
+ sanitizedHtmlBlobKey?: string;
161
+ /** A short plain-text preview of the message body, generated at ingestion time. */
162
+ bodyPreview: string;
163
+ flags: MessageFlags;
164
+ importance: MessageImportance;
165
+ /** The RFC 5322 `In-Reply-To` header value, if this message is a reply. */
166
+ inReplyTo?: string;
167
+ /** The RFC 5322 `References` header value(s), for building conversation threads. */
168
+ references: string[];
169
+ hasAttachments: boolean;
170
+ /** The unique identifier of this message's `ScanResult`, once scanning has completed. */
171
+ scanResultUid?: string;
172
+ /** The timestamp this message was last (re)indexed for full-text search, if ever. */
173
+ searchIndexedAt?: Date;
174
+ }
175
+ /**
176
+ * Defines a single file attached to a `Message`. The binary content is stored in the configured `BlobStore`,
177
+ * referenced by `blobKey`.
178
+ *
179
+ * @author Jean-Philippe Steinmetz
180
+ */
181
+ export interface Attachment extends BaseEntity {
182
+ /** The unique identifier of the `Message` this attachment belongs to. */
183
+ messageUid: string;
184
+ /**
185
+ * The unique identifier of the `Folder` the owning `Message` resides in. Denormalized from that `Message`
186
+ * so permission checks (see the architecture note on `Message.mailboxUid`) don't require a lookup through
187
+ * it first — an attachment is only ever readable by whoever can read its message, i.e. whoever has
188
+ * permission on that message's folder.
189
+ */
190
+ folderUid: string;
191
+ /** The unique identifier of the `Mailbox` this attachment belongs to. Denormalized purely for convenience
192
+ * queries that scan a whole mailbox (e.g. `MailboxQuotaRecalcJob`); plays no role in permission checks. */
193
+ mailboxUid: string;
194
+ filename: string;
195
+ mimeType: string;
196
+ sizeBytes: number;
197
+ /** The key under which the attachment's binary content is stored in the `BlobStore`. */
198
+ blobKey: string;
199
+ /** The MIME `Content-ID`, present when this attachment is referenced inline by the message's HTML body. */
200
+ contentId?: string;
201
+ /** `true` if this attachment is displayed inline in the message body rather than listed separately. */
202
+ isInline: boolean;
203
+ /** The key under which this attachment's extracted plain text is stored in the `BlobStore`, once extracted. */
204
+ extractedTextBlobKey?: string;
205
+ /** The unique identifier of this attachment's `ScanResult`, once scanning has completed. */
206
+ scanResultUid?: string;
207
+ }
208
+ export declare enum ContactAddressKind {
209
+ HOME = "home",
210
+ WORK = "work",
211
+ OTHER = "other"
212
+ }
213
+ export interface ContactEmail {
214
+ address: string;
215
+ type: ContactAddressKind;
216
+ }
217
+ export interface ContactPhone {
218
+ phoneNumber: string;
219
+ type: ContactAddressKind;
220
+ }
221
+ export interface ContactPostalAddress {
222
+ street?: string;
223
+ city?: string;
224
+ state?: string;
225
+ postalCode?: string;
226
+ country?: string;
227
+ type: ContactAddressKind;
228
+ }
229
+ /**
230
+ * Defines a single address book entry. Contacts are also the source of truth for MAPI NSPI and EAS GAL
231
+ * (Global Address List) lookups against a mailbox's own address book.
232
+ *
233
+ * Extends `RecoverableBaseEntity` (soft delete, `deleted: boolean`) rather than plain `BaseEntity` — see the
234
+ * identical note on `Folder`.
235
+ *
236
+ * @author Jean-Philippe Steinmetz
237
+ */
238
+ export interface Contact extends RecoverableBaseEntity {
239
+ /** The unique identifier of the `Mailbox` this contact belongs to. */
240
+ mailboxUid: string;
241
+ /** The unique identifier of the `Folder` (of type `CONTACTS`) this contact resides in. */
242
+ folderUid: string;
243
+ /** The unique identifier of the `ContactList` this contact is a member of, if any. */
244
+ contactListUid?: string;
245
+ displayName: string;
246
+ givenName?: string;
247
+ surname?: string;
248
+ emails: ContactEmail[];
249
+ phones: ContactPhone[];
250
+ addresses: ContactPostalAddress[];
251
+ company?: string;
252
+ jobTitle?: string;
253
+ notes?: string;
254
+ /** The key under which the contact's photo is stored in the `BlobStore`, if one has been set. */
255
+ photoBlobKey?: string;
256
+ /** The unique identifier of an external directory entry (e.g. GAL) this contact was sourced from, if any. */
257
+ sourceUid?: string;
258
+ }
259
+ /**
260
+ * Defines a named grouping (address book / distribution list) of `Contact` records within a `Mailbox`.
261
+ *
262
+ * @author Jean-Philippe Steinmetz
263
+ */
264
+ export interface ContactList extends BaseEntity {
265
+ mailboxUid: string;
266
+ name: string;
267
+ }
268
+ export declare enum AttendeeRole {
269
+ REQUIRED = "required",
270
+ OPTIONAL = "optional",
271
+ RESOURCE = "resource"
272
+ }
273
+ export declare enum AttendeeResponseStatus {
274
+ NEEDS_ACTION = "needsAction",
275
+ ACCEPTED = "accepted",
276
+ DECLINED = "declined",
277
+ TENTATIVE = "tentative"
278
+ }
279
+ /** An embedded attendee of a `CalendarEvent`. */
280
+ export interface Attendee {
281
+ address: string;
282
+ displayName?: string;
283
+ role: AttendeeRole;
284
+ responseStatus: AttendeeResponseStatus;
285
+ isOrganizer: boolean;
286
+ }
287
+ export declare enum RecurrenceFrequency {
288
+ DAILY = "daily",
289
+ WEEKLY = "weekly",
290
+ MONTHLY = "monthly",
291
+ YEARLY = "yearly"
292
+ }
293
+ /** An embedded RFC 5545 (`RRULE`)-style recurrence definition on a `CalendarEvent`. */
294
+ export interface RecurrenceRule {
295
+ freq: RecurrenceFrequency;
296
+ interval: number;
297
+ byDay?: string[];
298
+ byMonthDay?: number[];
299
+ byMonth?: number[];
300
+ count?: number;
301
+ until?: Date;
302
+ /** Specific occurrence dates removed from the recurrence set. */
303
+ exceptions: Date[];
304
+ }
305
+ export declare enum CalendarEventStatus {
306
+ TENTATIVE = "tentative",
307
+ CONFIRMED = "confirmed",
308
+ CANCELLED = "cancelled"
309
+ }
310
+ export declare enum BusyStatus {
311
+ FREE = "free",
312
+ BUSY = "busy",
313
+ TENTATIVE = "tentative",
314
+ OUT_OF_OFFICE = "oof"
315
+ }
316
+ /**
317
+ * Defines a single calendar event/meeting stored in a `Folder` of type `CALENDAR`. External sharing and
318
+ * scheduling permissions for the containing folder are governed by the platform's `AccessControlList` (see
319
+ * `ACLAction`), not by any field on this type — see the architecture plan for the `"read"`/`"freebusy"`/
320
+ * `"edit"`/`"delegate"` action convention.
321
+ *
322
+ * Extends `RecoverableBaseEntity` (soft delete, `deleted: boolean`) rather than plain `BaseEntity` — see the
323
+ * identical note on `Folder`.
324
+ *
325
+ * @author Jean-Philippe Steinmetz
326
+ */
327
+ export interface CalendarEvent extends RecoverableBaseEntity {
328
+ /** The unique identifier of the `Folder` (of type `CALENDAR`) this event resides in. */
329
+ folderUid: string;
330
+ /** The unique identifier of the `Mailbox` this event belongs to. */
331
+ mailboxUid: string;
332
+ title: string;
333
+ location?: string;
334
+ startDate: Date;
335
+ endDate: Date;
336
+ allDay: boolean;
337
+ /** The IANA timezone identifier the event's start/end times were authored in. */
338
+ timezone: string;
339
+ organizer: Recipient;
340
+ attendees: Attendee[];
341
+ recurrenceRule?: RecurrenceRule;
342
+ /** For a single occurrence of a recurring event that has been individually modified, its original start date. */
343
+ recurrenceId?: Date;
344
+ status: CalendarEventStatus;
345
+ busyStatus: BusyStatus;
346
+ /** The number of minutes before `startDate` that a reminder should be dispatched, if any. */
347
+ reminderMinutesBeforeStart?: number;
348
+ /** A stable identifier (RFC 5545 `UID`) for this event, shared across all clients/protocols and iTIP messages. */
349
+ icalUid: string;
350
+ /** The iTIP revision counter (RFC 5546 `SEQUENCE`), incremented on every scheduling-relevant change. */
351
+ sequence: number;
352
+ }
353
+ /**
354
+ * Supports anonymous, unauthenticated external access to a `CalendarEvent` folder's free/busy information (or
355
+ * broader access, per `permittedActions`) via a shareable link. A calendar's sharing is otherwise just ordinary
356
+ * `AccessControlList` management on its `Folder` (see `BaseFolderRoute`/`BaseScopedChildRoute`'s doc comments)
357
+ * — this entity exists solely to add what a bare ACL record can't: a uniquely generated, revocable/expiring
358
+ * credential a link recipient doesn't have to authenticate to use. `token` is granted directly as a real
359
+ * `ACLRecord` (`{userOrRoleId: token, actions: permittedActions}`) on the shared folder's own
360
+ * `AccessControlList` by `BaseCalendarShareLinkRoute` (revoked the same way on delete/expiry) — an anonymous
361
+ * request presenting it via `?shareToken=` is resolved into a synthetic identity checked by the exact same
362
+ * `ACLUtils.hasPermission()` call every other caller goes through (see `BaseScopedChildRoute`'s
363
+ * `resolveEffectiveUser()`). There is no separate lookup route or bespoke permission model for it.
364
+ *
365
+ * @author Jean-Philippe Steinmetz
366
+ */
367
+ export interface CalendarShareLink extends BaseEntity {
368
+ /**
369
+ * The unique, unguessable token embedded in the shared URL, minted server-side (see
370
+ * `BaseCalendarShareLinkRoute.create()`) and immutable thereafter. Doubles as the `userOrRoleId` of the
371
+ * `ACLRecord` this link grants on its `folderUid`'s `AccessControlList`.
372
+ */
373
+ token: string;
374
+ /**
375
+ * The unique identifier of the `Folder` (of type `CALENDAR`) being shared. Managing this share link itself
376
+ * (create/list/delete, by someone with access to the calendar) is permission-checked against this folder's
377
+ * `AccessControlList`, the same as every other folder-scoped child entity in this library — see the
378
+ * architecture note on `Message.mailboxUid`.
379
+ */
380
+ folderUid: string;
381
+ /** The actions (see `ACLAction`) granted to holders of this link, e.g. `["freebusy"]` or `["read"]`. */
382
+ permittedActions: string[];
383
+ /** The date/time after which this link is no longer valid. */
384
+ expiresAt?: Date;
385
+ createdByUserUid: string;
386
+ }
387
+ export declare enum TaskPriority {
388
+ LOW = "low",
389
+ NORMAL = "normal",
390
+ HIGH = "high"
391
+ }
392
+ /**
393
+ * Defines a single to-do item stored in a `Folder` of type `TASKS`.
394
+ *
395
+ * Extends `RecoverableBaseEntity` (soft delete, `deleted: boolean`) rather than plain `BaseEntity` — see the
396
+ * identical note on `Folder`.
397
+ *
398
+ * @author Jean-Philippe Steinmetz
399
+ */
400
+ export interface Task extends RecoverableBaseEntity {
401
+ mailboxUid: string;
402
+ folderUid: string;
403
+ title: string;
404
+ body?: string;
405
+ dueDate?: Date;
406
+ completed: boolean;
407
+ priority: TaskPriority;
408
+ reminderDate?: Date;
409
+ }
410
+ /**
411
+ * Defines a single free-form note stored in a `Folder` of type `NOTES`.
412
+ *
413
+ * @author Jean-Philippe Steinmetz
414
+ */
415
+ export interface Note extends BaseEntity {
416
+ mailboxUid: string;
417
+ folderUid: string;
418
+ title: string;
419
+ body: string;
420
+ /** An optional display color hint (e.g. a hex code) for the note, as commonly supported by note UIs. */
421
+ color?: string;
422
+ }
423
+ /** The kind of record a `ScanResult` was produced for. */
424
+ export declare enum ScanTargetType {
425
+ MESSAGE = "message",
426
+ ATTACHMENT = "attachment"
427
+ }
428
+ export declare enum SpamVerdict {
429
+ CLEAN = "clean",
430
+ SUSPECT = "suspect",
431
+ SPAM = "spam"
432
+ }
433
+ export declare enum AvVerdict {
434
+ CLEAN = "clean",
435
+ INFECTED = "infected",
436
+ ERROR = "error"
437
+ }
438
+ /**
439
+ * Defines the recorded outcome of running the SPAM/AV `ScanPipeline` against a `Message` or `Attachment`.
440
+ *
441
+ * @author Jean-Philippe Steinmetz
442
+ */
443
+ export interface ScanResult extends BaseEntity {
444
+ targetType: ScanTargetType;
445
+ /** The unique identifier of the `Message` or `Attachment` (per `targetType`) that was scanned. */
446
+ targetUid: string;
447
+ spamScore: number;
448
+ spamVerdict: SpamVerdict;
449
+ /** The symbolic names (e.g. rspamd symbols) that contributed to the spam verdict. */
450
+ spamSymbols: string[];
451
+ avVerdict: AvVerdict;
452
+ /** The name of the malware signature matched, if `avVerdict` is `INFECTED`. */
453
+ avSignatureName?: string;
454
+ scannedAt: Date;
455
+ /** The version identifiers of the spam/AV engines used, for auditability as signatures update over time. */
456
+ providerVersions: {
457
+ spam?: string;
458
+ av?: string;
459
+ };
460
+ }
461
+ export declare enum QuarantineReason {
462
+ INFECTED = "infected",
463
+ SPAM_POLICY = "spam_policy",
464
+ OTHER = "other"
465
+ }
466
+ /**
467
+ * Defines a single message held out of normal delivery pending review, because it was found infected or
468
+ * because organizational policy quarantines spam above a configured threshold rather than delivering to Junk.
469
+ * A quarantined message never appears in any `Folder` or client sync until released.
470
+ *
471
+ * @author Jean-Philippe Steinmetz
472
+ */
473
+ export interface QuarantineEntry extends BaseEntity {
474
+ /** The unique identifier of the `Mailbox` the message was addressed to. */
475
+ mailboxUid: string;
476
+ /** The unique identifier of the `Message` record, if one was ever created for this delivery attempt. */
477
+ originalMessageUid?: string;
478
+ reason: QuarantineReason;
479
+ scanResultUid: string;
480
+ /** The key under which the original raw MIME source is stored in the `BlobStore`. */
481
+ rawBlobKey: string;
482
+ releasedAt?: Date;
483
+ releasedByUserUid?: string;
484
+ }
485
+ /**
486
+ * Tracks whether a given entity's content is currently reflected in a specific `SearchProvider`'s index,
487
+ * decoupling "committed to the primary datastore" from "visible in search" (the two are only eventually
488
+ * consistent, reconciled by `SearchIndexJob`).
489
+ *
490
+ * @author Jean-Philippe Steinmetz
491
+ */
492
+ export interface SearchIndexState extends BaseEntity {
493
+ entityType: string;
494
+ entityUid: string;
495
+ /** The name of the `SearchProvider` implementation this state row applies to. */
496
+ provider: string;
497
+ indexedAt: Date;
498
+ /** A content hash used to detect whether re-indexing is needed after this state was last recorded. */
499
+ contentHash: string;
500
+ }
501
+ export declare enum IngestStatus {
502
+ PENDING = "pending",
503
+ SCANNING = "scanning",
504
+ DELIVERED = "delivered",
505
+ FAILED = "failed"
506
+ }
507
+ /**
508
+ * A staging record for one raw message accepted by the MTA (Postfix) and handed to `MailIngestRoute`, before
509
+ * scanning/parsing/delivery has run. Kept separate from `QuarantineEntry` (which holds messages that *failed*
510
+ * scanning) so the two lifecycles — "not yet scanned" vs. "scanned and held" — aren't conflated. Drained by
511
+ * `ScanQueueJob`, which runs the `ScanPipeline` and then either delivers the message to a `Folder`, files it in
512
+ * `QuarantineEntry`, or (on repeated processing failure) marks this entry `FAILED` for operator review.
513
+ *
514
+ * @author Jean-Philippe Steinmetz
515
+ */
516
+ export interface IngestQueueEntry extends BaseEntity {
517
+ /** The resolved `Mailbox` this message is addressed to. */
518
+ mailboxUid: string;
519
+ envelopeFrom: string;
520
+ envelopeTo: string[];
521
+ /** The key under which the raw MIME source is stored in the `BlobStore`. */
522
+ rawBlobKey: string;
523
+ status: IngestStatus;
524
+ errorMessage?: string;
525
+ }
526
+ /**
527
+ * Tracks the EAS sync state of a single paired mobile device against a `Mailbox`.
528
+ *
529
+ * @author Jean-Philippe Steinmetz
530
+ */
531
+ export interface DeviceSyncState extends BaseEntity {
532
+ mailboxUid: string;
533
+ deviceId: string;
534
+ deviceType: string;
535
+ /** The EAS provisioning policy key most recently acknowledged by the device. */
536
+ policyKey?: string;
537
+ /** The per-folder EAS `SyncKey` cursor, keyed by `Folder.uid`. */
538
+ folderSyncKeys: Record<string, string>;
539
+ lastSyncAt?: Date;
540
+ provisioned: boolean;
541
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./models/mongo.js";
2
+ export * from "./routes/mongo.js";
3
+ export * from "./jobs/mongo.js";
@@ -0,0 +1,37 @@
1
+ import { BasePushRoute } from "@rapidrest/service-core";
2
+ /**
3
+ * Real-time push notifications for the webmail client, built entirely on `service-core`'s own
4
+ * `BasePushRoute` (WebSocket connect/subscribe/unsubscribe, Redis pub/sub fan-out) — no mail-specific override
5
+ * is needed, since `BasePushRoute`'s channel model already matches this library's own permission model exactly.
6
+ *
7
+ * **Channels are bare entity uids** — a `Mailbox.uid` or a `Folder.uid`, the same uid `ACLUtils.hasPermission()`
8
+ * is checked against everywhere else in this library — NOT a prefixed name like `"mailbox:<uid>"`.
9
+ * `BasePushRoute.connect()`'s SUBSCRIBE handler calls `aclUtils.hasPermission(user, channel, ACLAction.READ)`
10
+ * with the client-supplied channel value verbatim, so a client subscribes directly to the `uid` of whichever
11
+ * `Mailbox`/`Folder` it wants live updates for — that uid resolves to the real `AccessControlList` document the
12
+ * same way every other read in this library does, including the `parentUid` inheritance chain (subscribing to
13
+ * a `Mailbox` uid a caller can read does NOT also deliver that mailbox's folders' events - each `Folder` is a
14
+ * separate channel a client subscribes to independently, matching how `Folder`'s own ACL is a separate document
15
+ * from its owning `Mailbox`'s).
16
+ *
17
+ * Publishing is done via `NotificationUtils.sendMessage(uids, type, action, data)` (`@Inject(NotificationUtils)`
18
+ * in the base route classes) at the mutation call sites — see `BaseScopedChildRoute`/`BaseFolderRoute`/
19
+ * `ScanQueueJob` for where this library calls it. A message arrives at a subscribed client as
20
+ * `{type: "MESSAGE", channel, data: {type, action, data}}` (the outer envelope from `BasePushRoute`'s Redis
21
+ * subscription forwarding, the inner `{type, action, data}` from `NotificationUtils.sendMessage()`).
22
+ *
23
+ * !!Note!! like `BasePushRoute` itself, this class is not automatically registered with a server — the
24
+ * consuming application must apply `@Route("/push")` (or any other chosen base path) to its own subclass:
25
+ * ```ts
26
+ * import { MailPushRoute } from "@rapidrest/mail";
27
+ * import { RouteDecorators } from "@rapidrest/service-core";
28
+ * const { Route } = RouteDecorators;
29
+ *
30
+ * @Route("/push")
31
+ * export class PushRoute extends MailPushRoute {}
32
+ * ```
33
+ *
34
+ * @author Jean-Philippe Steinmetz
35
+ */
36
+ export declare class MailPushRoute extends BasePushRoute {
37
+ }
@@ -0,0 +1 @@
1
+ export * from "./MailPushRoute.js";
@@ -0,0 +1,24 @@
1
+ import { type JWTUser } from "@rapidrest/core";
2
+ import { HttpRequest, HttpResponse } from "@rapidrest/service-core";
3
+ import { BaseScopedChildRoute } from "./BaseScopedChildRoute.js";
4
+ import { Attachment, Message } from "../models/types.js";
5
+ /**
6
+ * Extends `BaseScopedChildRoute` (scoped by `folderUid` — see the architecture note on `Message.mailboxUid`)
7
+ * for `Attachment` with `upload`/`download` endpoints that move binary content through the configured
8
+ * `BlobStore` — `Attachment` records never carry binary content inline, only metadata plus a `blobKey`.
9
+ * Ordinary `create` is deliberately NOT used for uploading an attachment's content (it would require the
10
+ * client to already have a `blobKey`, which only this route can mint) — `upload` replaces it as the way a new
11
+ * attachment record is created.
12
+ *
13
+ * @author Jean-Philippe Steinmetz
14
+ */
15
+ export declare abstract class BaseAttachmentRoute<T extends Attachment, M extends Message = Message> extends BaseScopedChildRoute<T> {
16
+ protected readonly scopeProperty: string;
17
+ /** The class of the owning `Message` entity, supplied by the Mongo/SQL concrete subclass. */
18
+ protected abstract messageClass: any;
19
+ private messageRepo?;
20
+ private blobStore?;
21
+ private getMessageRepo;
22
+ upload(req: HttpRequest, user?: JWTUser): Promise<T>;
23
+ download(id: string, res: HttpResponse, user?: JWTUser): Promise<void>;
24
+ }
@@ -0,0 +1,35 @@
1
+ import { type JWTUser } from "@rapidrest/core";
2
+ import { HttpRequest, type UpdateObject } from "@rapidrest/service-core";
3
+ import { BaseScopedChildRoute } from "./BaseScopedChildRoute.js";
4
+ import { CalendarShareLink } from "../models/types.js";
5
+ /**
6
+ * Extends `BaseScopedChildRoute` (scoped by `folderUid`) for `CalendarShareLink` with the two pieces of
7
+ * bookkeeping that make anonymous share-link consumption work with NO separate route or lookup of its own
8
+ * (see `BaseScopedChildRoute`'s doc comment and its local `resolveEffectiveUser()` helper for the read side of
9
+ * this mechanism):
10
+ *
11
+ * 1. `create()`/`update()` always mint (or preserve) `token` server-side, discarding any value the client
12
+ * supplied for it — `token` is the sole credential an anonymous caller presents, so its unguessability can't
13
+ * depend on the client, and it must never change after creation (a client "updating" it would orphan the ACL
14
+ * record already granted under the old value).
15
+ * 2. `create()`/`update()`/`delete()` keep a real `ACLRecord` for the link's token in sync on the shared
16
+ * folder's `AccessControlList` (`{userOrRoleId: token, actions: permittedActions}`) — granted on create,
17
+ * re-granted (upserted, picking up any `permittedActions`/`folderUid` change) on update, and revoked on
18
+ * delete. `ExternalShareExpirationJob` does the same revocation for links it GCs after they expire.
19
+ *
20
+ * @author Jean-Philippe Steinmetz
21
+ */
22
+ export declare abstract class BaseCalendarShareLinkRoute<T extends CalendarShareLink> extends BaseScopedChildRoute<T> {
23
+ /** Grants (or re-grants, upserting) `link.token` access to `link.folderUid`'s ACL, matching `link`'s
24
+ * current `permittedActions`. A no-op if the folder has no ACL document (should never happen in practice —
25
+ * every `Folder` is seeded with one on creation — but this is a background-adjacent write, not a
26
+ * request the caller is blocked on, so failing open rather than throwing keeps a missing/corrupt folder
27
+ * ACL from turning "create a share link" into a 500. */
28
+ private grantShareTokenAccess;
29
+ /** Removes any ACL record for `token` from `folderUid`'s ACL. A no-op if the folder has no ACL document or
30
+ * no matching record - same fail-open rationale as `grantShareTokenAccess()`. */
31
+ private revokeShareTokenAccess;
32
+ create(obj: T | T[], req: HttpRequest, user?: JWTUser): Promise<T | T[]>;
33
+ update(id: string, obj: UpdateObject<T>, req?: HttpRequest, user?: JWTUser): Promise<T>;
34
+ delete(id: string, version: string | undefined, purge: string | undefined, req: HttpRequest, user?: JWTUser): Promise<void>;
35
+ }