@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.
- package/LICENSE +382 -0
- package/README.md +50 -0
- package/dist/lib/blob/BlobStore.js +6 -0
- package/dist/lib/blob/BlobStore.js.map +1 -0
- package/dist/lib/blob/LocalFsBlobStore.js +101 -0
- package/dist/lib/blob/LocalFsBlobStore.js.map +1 -0
- package/dist/lib/blob/index.js +7 -0
- package/dist/lib/blob/index.js.map +1 -0
- package/dist/lib/index.js +12 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/jobs/AttachmentExtractionJob.js +124 -0
- package/dist/lib/jobs/AttachmentExtractionJob.js.map +1 -0
- package/dist/lib/jobs/CalendarReminderJob.js +132 -0
- package/dist/lib/jobs/CalendarReminderJob.js.map +1 -0
- package/dist/lib/jobs/EasDeviceStateCleanupJob.js +101 -0
- package/dist/lib/jobs/EasDeviceStateCleanupJob.js.map +1 -0
- package/dist/lib/jobs/ExternalShareExpirationJob.js +117 -0
- package/dist/lib/jobs/ExternalShareExpirationJob.js.map +1 -0
- package/dist/lib/jobs/MailboxQuotaRecalcJob.js +163 -0
- package/dist/lib/jobs/MailboxQuotaRecalcJob.js.map +1 -0
- package/dist/lib/jobs/MeetingSchedulingJob.js +106 -0
- package/dist/lib/jobs/MeetingSchedulingJob.js.map +1 -0
- package/dist/lib/jobs/QuarantineRetentionJob.js +97 -0
- package/dist/lib/jobs/QuarantineRetentionJob.js.map +1 -0
- package/dist/lib/jobs/ScanQueueJob.js +223 -0
- package/dist/lib/jobs/ScanQueueJob.js.map +1 -0
- package/dist/lib/jobs/SearchIndexJob.js +146 -0
- package/dist/lib/jobs/SearchIndexJob.js.map +1 -0
- package/dist/lib/jobs/index.js +10 -0
- package/dist/lib/jobs/index.js.map +1 -0
- package/dist/lib/jobs/mongo/AttachmentExtractionJobMongo.js +14 -0
- package/dist/lib/jobs/mongo/AttachmentExtractionJobMongo.js.map +1 -0
- package/dist/lib/jobs/mongo/CalendarReminderJobMongo.js +13 -0
- package/dist/lib/jobs/mongo/CalendarReminderJobMongo.js.map +1 -0
- package/dist/lib/jobs/mongo/EasDeviceStateCleanupJobMongo.js +13 -0
- package/dist/lib/jobs/mongo/EasDeviceStateCleanupJobMongo.js.map +1 -0
- package/dist/lib/jobs/mongo/ExternalShareExpirationJobMongo.js +13 -0
- package/dist/lib/jobs/mongo/ExternalShareExpirationJobMongo.js.map +1 -0
- package/dist/lib/jobs/mongo/MailboxQuotaRecalcJobMongo.js +15 -0
- package/dist/lib/jobs/mongo/MailboxQuotaRecalcJobMongo.js.map +1 -0
- package/dist/lib/jobs/mongo/MeetingSchedulingJobMongo.js +13 -0
- package/dist/lib/jobs/mongo/MeetingSchedulingJobMongo.js.map +1 -0
- package/dist/lib/jobs/mongo/QuarantineRetentionJobMongo.js +13 -0
- package/dist/lib/jobs/mongo/QuarantineRetentionJobMongo.js.map +1 -0
- package/dist/lib/jobs/mongo/ScanQueueJobMongo.js +18 -0
- package/dist/lib/jobs/mongo/ScanQueueJobMongo.js.map +1 -0
- package/dist/lib/jobs/mongo/SearchIndexJobMongo.js +14 -0
- package/dist/lib/jobs/mongo/SearchIndexJobMongo.js.map +1 -0
- package/dist/lib/jobs/mongo/index.js +10 -0
- package/dist/lib/jobs/mongo/index.js.map +1 -0
- package/dist/lib/jobs/mongo.js +2 -0
- package/dist/lib/jobs/mongo.js.map +1 -0
- package/dist/lib/jobs/sql/AttachmentExtractionJobSQL.js +14 -0
- package/dist/lib/jobs/sql/AttachmentExtractionJobSQL.js.map +1 -0
- package/dist/lib/jobs/sql/CalendarReminderJobSQL.js +13 -0
- package/dist/lib/jobs/sql/CalendarReminderJobSQL.js.map +1 -0
- package/dist/lib/jobs/sql/EasDeviceStateCleanupJobSQL.js +13 -0
- package/dist/lib/jobs/sql/EasDeviceStateCleanupJobSQL.js.map +1 -0
- package/dist/lib/jobs/sql/ExternalShareExpirationJobSQL.js +13 -0
- package/dist/lib/jobs/sql/ExternalShareExpirationJobSQL.js.map +1 -0
- package/dist/lib/jobs/sql/MailboxQuotaRecalcJobSQL.js +15 -0
- package/dist/lib/jobs/sql/MailboxQuotaRecalcJobSQL.js.map +1 -0
- package/dist/lib/jobs/sql/MeetingSchedulingJobSQL.js +13 -0
- package/dist/lib/jobs/sql/MeetingSchedulingJobSQL.js.map +1 -0
- package/dist/lib/jobs/sql/QuarantineRetentionJobSQL.js +13 -0
- package/dist/lib/jobs/sql/QuarantineRetentionJobSQL.js.map +1 -0
- package/dist/lib/jobs/sql/ScanQueueJobSQL.js +18 -0
- package/dist/lib/jobs/sql/ScanQueueJobSQL.js.map +1 -0
- package/dist/lib/jobs/sql/SearchIndexJobSQL.js +14 -0
- package/dist/lib/jobs/sql/SearchIndexJobSQL.js.map +1 -0
- package/dist/lib/jobs/sql/index.js +10 -0
- package/dist/lib/jobs/sql/index.js.map +1 -0
- package/dist/lib/jobs/sql.js +2 -0
- package/dist/lib/jobs/sql.js.map +1 -0
- package/dist/lib/models/index.js +2 -0
- package/dist/lib/models/index.js.map +1 -0
- package/dist/lib/models/mongo/AttachmentMongo.js +129 -0
- package/dist/lib/models/mongo/AttachmentMongo.js.map +1 -0
- package/dist/lib/models/mongo/CalendarEventMongo.js +172 -0
- package/dist/lib/models/mongo/CalendarEventMongo.js.map +1 -0
- package/dist/lib/models/mongo/CalendarShareLinkMongo.js +85 -0
- package/dist/lib/models/mongo/CalendarShareLinkMongo.js.map +1 -0
- package/dist/lib/models/mongo/ContactListMongo.js +60 -0
- package/dist/lib/models/mongo/ContactListMongo.js.map +1 -0
- package/dist/lib/models/mongo/ContactMongo.js +148 -0
- package/dist/lib/models/mongo/ContactMongo.js.map +1 -0
- package/dist/lib/models/mongo/DeviceSyncStateMongo.js +97 -0
- package/dist/lib/models/mongo/DeviceSyncStateMongo.js.map +1 -0
- package/dist/lib/models/mongo/FolderMongo.js +102 -0
- package/dist/lib/models/mongo/FolderMongo.js.map +1 -0
- package/dist/lib/models/mongo/IngestQueueEntryMongo.js +93 -0
- package/dist/lib/models/mongo/IngestQueueEntryMongo.js.map +1 -0
- package/dist/lib/models/mongo/MailboxMongo.js +105 -0
- package/dist/lib/models/mongo/MailboxMongo.js.map +1 -0
- package/dist/lib/models/mongo/MessageMongo.js +180 -0
- package/dist/lib/models/mongo/MessageMongo.js.map +1 -0
- package/dist/lib/models/mongo/NoteMongo.js +83 -0
- package/dist/lib/models/mongo/NoteMongo.js.map +1 -0
- package/dist/lib/models/mongo/QuarantineEntryMongo.js +99 -0
- package/dist/lib/models/mongo/QuarantineEntryMongo.js.map +1 -0
- package/dist/lib/models/mongo/ScanResultMongo.js +112 -0
- package/dist/lib/models/mongo/ScanResultMongo.js.map +1 -0
- package/dist/lib/models/mongo/SearchIndexStateMongo.js +83 -0
- package/dist/lib/models/mongo/SearchIndexStateMongo.js.map +1 -0
- package/dist/lib/models/mongo/TaskMongo.js +105 -0
- package/dist/lib/models/mongo/TaskMongo.js.map +1 -0
- package/dist/lib/models/mongo/index.js +16 -0
- package/dist/lib/models/mongo/index.js.map +1 -0
- package/dist/lib/models/mongo.js +2 -0
- package/dist/lib/models/mongo.js.map +1 -0
- package/dist/lib/models/sql/AttachmentSQL.js +129 -0
- package/dist/lib/models/sql/AttachmentSQL.js.map +1 -0
- package/dist/lib/models/sql/CalendarEventSQL.js +176 -0
- package/dist/lib/models/sql/CalendarEventSQL.js.map +1 -0
- package/dist/lib/models/sql/CalendarShareLinkSQL.js +85 -0
- package/dist/lib/models/sql/CalendarShareLinkSQL.js.map +1 -0
- package/dist/lib/models/sql/ContactListSQL.js +60 -0
- package/dist/lib/models/sql/ContactListSQL.js.map +1 -0
- package/dist/lib/models/sql/ContactSQL.js +148 -0
- package/dist/lib/models/sql/ContactSQL.js.map +1 -0
- package/dist/lib/models/sql/DeviceSyncStateSQL.js +97 -0
- package/dist/lib/models/sql/DeviceSyncStateSQL.js.map +1 -0
- package/dist/lib/models/sql/FolderSQL.js +106 -0
- package/dist/lib/models/sql/FolderSQL.js.map +1 -0
- package/dist/lib/models/sql/IngestQueueEntrySQL.js +97 -0
- package/dist/lib/models/sql/IngestQueueEntrySQL.js.map +1 -0
- package/dist/lib/models/sql/MailboxSQL.js +105 -0
- package/dist/lib/models/sql/MailboxSQL.js.map +1 -0
- package/dist/lib/models/sql/MessageSQL.js +184 -0
- package/dist/lib/models/sql/MessageSQL.js.map +1 -0
- package/dist/lib/models/sql/NoteSQL.js +83 -0
- package/dist/lib/models/sql/NoteSQL.js.map +1 -0
- package/dist/lib/models/sql/QuarantineEntrySQL.js +103 -0
- package/dist/lib/models/sql/QuarantineEntrySQL.js.map +1 -0
- package/dist/lib/models/sql/ScanResultSQL.js +116 -0
- package/dist/lib/models/sql/ScanResultSQL.js.map +1 -0
- package/dist/lib/models/sql/SearchIndexStateSQL.js +83 -0
- package/dist/lib/models/sql/SearchIndexStateSQL.js.map +1 -0
- package/dist/lib/models/sql/TaskSQL.js +109 -0
- package/dist/lib/models/sql/TaskSQL.js.map +1 -0
- package/dist/lib/models/sql/index.js +16 -0
- package/dist/lib/models/sql/index.js.map +1 -0
- package/dist/lib/models/sql.js +2 -0
- package/dist/lib/models/sql.js.map +1 -0
- package/dist/lib/models/types.js +108 -0
- package/dist/lib/models/types.js.map +1 -0
- package/dist/lib/mongo.js +8 -0
- package/dist/lib/mongo.js.map +1 -0
- package/dist/lib/push/MailPushRoute.js +42 -0
- package/dist/lib/push/MailPushRoute.js.map +1 -0
- package/dist/lib/push/index.js +6 -0
- package/dist/lib/push/index.js.map +1 -0
- package/dist/lib/routes/BaseAttachmentRoute.js +142 -0
- package/dist/lib/routes/BaseAttachmentRoute.js.map +1 -0
- package/dist/lib/routes/BaseCalendarShareLinkRoute.js +123 -0
- package/dist/lib/routes/BaseCalendarShareLinkRoute.js.map +1 -0
- package/dist/lib/routes/BaseFolderRoute.js +192 -0
- package/dist/lib/routes/BaseFolderRoute.js.map +1 -0
- package/dist/lib/routes/BaseMailIngestRoute.js +179 -0
- package/dist/lib/routes/BaseMailIngestRoute.js.map +1 -0
- package/dist/lib/routes/BaseMailboxRoute.js +187 -0
- package/dist/lib/routes/BaseMailboxRoute.js.map +1 -0
- package/dist/lib/routes/BaseMessageRoute.js +142 -0
- package/dist/lib/routes/BaseMessageRoute.js.map +1 -0
- package/dist/lib/routes/BaseScopedChildRoute.js +348 -0
- package/dist/lib/routes/BaseScopedChildRoute.js.map +1 -0
- package/dist/lib/routes/BaseSearchRoute.js +91 -0
- package/dist/lib/routes/BaseSearchRoute.js.map +1 -0
- package/dist/lib/routes/index.js +13 -0
- package/dist/lib/routes/index.js.map +1 -0
- package/dist/lib/routes/mongo/AttachmentRouteMongo.js +26 -0
- package/dist/lib/routes/mongo/AttachmentRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/CalendarEventRouteMongo.js +27 -0
- package/dist/lib/routes/mongo/CalendarEventRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/CalendarShareLinkRouteMongo.js +26 -0
- package/dist/lib/routes/mongo/CalendarShareLinkRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/ContactListRouteMongo.js +26 -0
- package/dist/lib/routes/mongo/ContactListRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/ContactRouteMongo.js +27 -0
- package/dist/lib/routes/mongo/ContactRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/FolderRouteMongo.js +26 -0
- package/dist/lib/routes/mongo/FolderRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/IngestQueueRouteMongo.js +33 -0
- package/dist/lib/routes/mongo/IngestQueueRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/MailIngestRouteMongo.js +14 -0
- package/dist/lib/routes/mongo/MailIngestRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/MailboxRouteMongo.js +39 -0
- package/dist/lib/routes/mongo/MailboxRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/MessageRouteMongo.js +27 -0
- package/dist/lib/routes/mongo/MessageRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/NoteRouteMongo.js +26 -0
- package/dist/lib/routes/mongo/NoteRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/QuarantineRouteMongo.js +35 -0
- package/dist/lib/routes/mongo/QuarantineRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/SearchRouteMongo.js +13 -0
- package/dist/lib/routes/mongo/SearchRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/TaskRouteMongo.js +27 -0
- package/dist/lib/routes/mongo/TaskRouteMongo.js.map +1 -0
- package/dist/lib/routes/mongo/index.js +15 -0
- package/dist/lib/routes/mongo/index.js.map +1 -0
- package/dist/lib/routes/mongo.js +2 -0
- package/dist/lib/routes/mongo.js.map +1 -0
- package/dist/lib/routes/sql/AttachmentRouteSQL.js +26 -0
- package/dist/lib/routes/sql/AttachmentRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/CalendarEventRouteSQL.js +27 -0
- package/dist/lib/routes/sql/CalendarEventRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/CalendarShareLinkRouteSQL.js +26 -0
- package/dist/lib/routes/sql/CalendarShareLinkRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/ContactListRouteSQL.js +26 -0
- package/dist/lib/routes/sql/ContactListRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/ContactRouteSQL.js +27 -0
- package/dist/lib/routes/sql/ContactRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/FolderRouteSQL.js +26 -0
- package/dist/lib/routes/sql/FolderRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/IngestQueueRouteSQL.js +29 -0
- package/dist/lib/routes/sql/IngestQueueRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/MailIngestRouteSQL.js +35 -0
- package/dist/lib/routes/sql/MailIngestRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/MailboxRouteSQL.js +64 -0
- package/dist/lib/routes/sql/MailboxRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/MessageRouteSQL.js +27 -0
- package/dist/lib/routes/sql/MessageRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/NoteRouteSQL.js +26 -0
- package/dist/lib/routes/sql/NoteRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/QuarantineRouteSQL.js +29 -0
- package/dist/lib/routes/sql/QuarantineRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/SearchRouteSQL.js +13 -0
- package/dist/lib/routes/sql/SearchRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/TaskRouteSQL.js +27 -0
- package/dist/lib/routes/sql/TaskRouteSQL.js.map +1 -0
- package/dist/lib/routes/sql/index.js +15 -0
- package/dist/lib/routes/sql/index.js.map +1 -0
- package/dist/lib/routes/sql.js +2 -0
- package/dist/lib/routes/sql.js.map +1 -0
- package/dist/lib/scan/AvScanProvider.js +2 -0
- package/dist/lib/scan/AvScanProvider.js.map +1 -0
- package/dist/lib/scan/ClamAvScanProvider.js +112 -0
- package/dist/lib/scan/ClamAvScanProvider.js.map +1 -0
- package/dist/lib/scan/RspamdSpamScanProvider.js +100 -0
- package/dist/lib/scan/RspamdSpamScanProvider.js.map +1 -0
- package/dist/lib/scan/ScanPipeline.js +118 -0
- package/dist/lib/scan/ScanPipeline.js.map +1 -0
- package/dist/lib/scan/SpamScanProvider.js +2 -0
- package/dist/lib/scan/SpamScanProvider.js.map +1 -0
- package/dist/lib/scan/index.js +10 -0
- package/dist/lib/scan/index.js.map +1 -0
- package/dist/lib/search/MongoTextSearchProvider.js +116 -0
- package/dist/lib/search/MongoTextSearchProvider.js.map +1 -0
- package/dist/lib/search/OpenSearchProvider.js +156 -0
- package/dist/lib/search/OpenSearchProvider.js.map +1 -0
- package/dist/lib/search/PostgresFullTextSearchProvider.js +139 -0
- package/dist/lib/search/PostgresFullTextSearchProvider.js.map +1 -0
- package/dist/lib/search/SearchProvider.js +6 -0
- package/dist/lib/search/SearchProvider.js.map +1 -0
- package/dist/lib/search/extraction/DocxTextExtractor.js +27 -0
- package/dist/lib/search/extraction/DocxTextExtractor.js.map +1 -0
- package/dist/lib/search/extraction/ExtractorRegistry.js +82 -0
- package/dist/lib/search/extraction/ExtractorRegistry.js.map +1 -0
- package/dist/lib/search/extraction/HtmlTextExtractor.js +20 -0
- package/dist/lib/search/extraction/HtmlTextExtractor.js.map +1 -0
- package/dist/lib/search/extraction/PdfTextExtractor.js +22 -0
- package/dist/lib/search/extraction/PdfTextExtractor.js.map +1 -0
- package/dist/lib/search/extraction/PlainTextExtractor.js +14 -0
- package/dist/lib/search/extraction/PlainTextExtractor.js.map +1 -0
- package/dist/lib/search/extraction/TextExtractor.js +6 -0
- package/dist/lib/search/extraction/TextExtractor.js.map +1 -0
- package/dist/lib/search/index.js +15 -0
- package/dist/lib/search/index.js.map +1 -0
- package/dist/lib/sql.js +8 -0
- package/dist/lib/sql.js.map +1 -0
- package/dist/lib/transport/MTAIngestAdapter.js +30 -0
- package/dist/lib/transport/MTAIngestAdapter.js.map +1 -0
- package/dist/lib/transport/MailTransport.js +6 -0
- package/dist/lib/transport/MailTransport.js.map +1 -0
- package/dist/lib/transport/PostfixSendmailTransport.js +61 -0
- package/dist/lib/transport/PostfixSendmailTransport.js.map +1 -0
- package/dist/lib/transport/index.js +8 -0
- package/dist/lib/transport/index.js.map +1 -0
- package/dist/lib/util/FolderUtils.js +50 -0
- package/dist/lib/util/FolderUtils.js.map +1 -0
- package/dist/lib/util/MailSendUtils.js +36 -0
- package/dist/lib/util/MailSendUtils.js.map +1 -0
- package/dist/lib/util/MailboxScopeUtils.js +23 -0
- package/dist/lib/util/MailboxScopeUtils.js.map +1 -0
- package/dist/lib/util/OptionalDeps.js +23 -0
- package/dist/lib/util/OptionalDeps.js.map +1 -0
- package/dist/lib/util/RecoverableRepoUtils.js +42 -0
- package/dist/lib/util/RecoverableRepoUtils.js.map +1 -0
- package/dist/lib/util/index.js +17 -0
- package/dist/lib/util/index.js.map +1 -0
- package/dist/types/blob/BlobStore.d.ts +54 -0
- package/dist/types/blob/LocalFsBlobStore.d.ts +23 -0
- package/dist/types/blob/index.d.ts +2 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/jobs/AttachmentExtractionJob.d.ts +34 -0
- package/dist/types/jobs/CalendarReminderJob.d.ts +37 -0
- package/dist/types/jobs/EasDeviceStateCleanupJob.d.ts +26 -0
- package/dist/types/jobs/ExternalShareExpirationJob.d.ts +34 -0
- package/dist/types/jobs/MailboxQuotaRecalcJob.d.ts +44 -0
- package/dist/types/jobs/MeetingSchedulingJob.d.ts +32 -0
- package/dist/types/jobs/QuarantineRetentionJob.d.ts +27 -0
- package/dist/types/jobs/ScanQueueJob.d.ts +41 -0
- package/dist/types/jobs/SearchIndexJob.d.ts +37 -0
- package/dist/types/jobs/index.d.ts +9 -0
- package/dist/types/jobs/mongo/AttachmentExtractionJobMongo.d.ts +6 -0
- package/dist/types/jobs/mongo/CalendarReminderJobMongo.d.ts +5 -0
- package/dist/types/jobs/mongo/EasDeviceStateCleanupJobMongo.d.ts +5 -0
- package/dist/types/jobs/mongo/ExternalShareExpirationJobMongo.d.ts +5 -0
- package/dist/types/jobs/mongo/MailboxQuotaRecalcJobMongo.d.ts +7 -0
- package/dist/types/jobs/mongo/MeetingSchedulingJobMongo.d.ts +5 -0
- package/dist/types/jobs/mongo/QuarantineRetentionJobMongo.d.ts +5 -0
- package/dist/types/jobs/mongo/ScanQueueJobMongo.d.ts +10 -0
- package/dist/types/jobs/mongo/SearchIndexJobMongo.d.ts +6 -0
- package/dist/types/jobs/mongo/index.d.ts +9 -0
- package/dist/types/jobs/mongo.d.ts +1 -0
- package/dist/types/jobs/sql/AttachmentExtractionJobSQL.d.ts +6 -0
- package/dist/types/jobs/sql/CalendarReminderJobSQL.d.ts +5 -0
- package/dist/types/jobs/sql/EasDeviceStateCleanupJobSQL.d.ts +5 -0
- package/dist/types/jobs/sql/ExternalShareExpirationJobSQL.d.ts +5 -0
- package/dist/types/jobs/sql/MailboxQuotaRecalcJobSQL.d.ts +7 -0
- package/dist/types/jobs/sql/MeetingSchedulingJobSQL.d.ts +5 -0
- package/dist/types/jobs/sql/QuarantineRetentionJobSQL.d.ts +5 -0
- package/dist/types/jobs/sql/ScanQueueJobSQL.d.ts +10 -0
- package/dist/types/jobs/sql/SearchIndexJobSQL.d.ts +6 -0
- package/dist/types/jobs/sql/index.d.ts +9 -0
- package/dist/types/jobs/sql.d.ts +1 -0
- package/dist/types/models/index.d.ts +1 -0
- package/dist/types/models/mongo/AttachmentMongo.d.ts +22 -0
- package/dist/types/models/mongo/CalendarEventMongo.d.ts +28 -0
- package/dist/types/models/mongo/CalendarShareLinkMongo.d.ts +16 -0
- package/dist/types/models/mongo/ContactListMongo.d.ts +13 -0
- package/dist/types/models/mongo/ContactMongo.d.ts +25 -0
- package/dist/types/models/mongo/DeviceSyncStateMongo.d.ts +18 -0
- package/dist/types/models/mongo/FolderMongo.d.ts +18 -0
- package/dist/types/models/mongo/IngestQueueEntryMongo.d.ts +17 -0
- package/dist/types/models/mongo/MailboxMongo.d.ts +18 -0
- package/dist/types/models/mongo/MessageMongo.d.ts +29 -0
- package/dist/types/models/mongo/NoteMongo.d.ts +16 -0
- package/dist/types/models/mongo/QuarantineEntryMongo.d.ts +18 -0
- package/dist/types/models/mongo/ScanResultMongo.d.ts +23 -0
- package/dist/types/models/mongo/SearchIndexStateMongo.d.ts +16 -0
- package/dist/types/models/mongo/TaskMongo.d.ts +19 -0
- package/dist/types/models/mongo/index.d.ts +15 -0
- package/dist/types/models/mongo.d.ts +1 -0
- package/dist/types/models/sql/AttachmentSQL.d.ts +22 -0
- package/dist/types/models/sql/CalendarEventSQL.d.ts +28 -0
- package/dist/types/models/sql/CalendarShareLinkSQL.d.ts +16 -0
- package/dist/types/models/sql/ContactListSQL.d.ts +13 -0
- package/dist/types/models/sql/ContactSQL.d.ts +25 -0
- package/dist/types/models/sql/DeviceSyncStateSQL.d.ts +18 -0
- package/dist/types/models/sql/FolderSQL.d.ts +18 -0
- package/dist/types/models/sql/IngestQueueEntrySQL.d.ts +17 -0
- package/dist/types/models/sql/MailboxSQL.d.ts +18 -0
- package/dist/types/models/sql/MessageSQL.d.ts +29 -0
- package/dist/types/models/sql/NoteSQL.d.ts +16 -0
- package/dist/types/models/sql/QuarantineEntrySQL.d.ts +18 -0
- package/dist/types/models/sql/ScanResultSQL.d.ts +23 -0
- package/dist/types/models/sql/SearchIndexStateSQL.d.ts +16 -0
- package/dist/types/models/sql/TaskSQL.d.ts +19 -0
- package/dist/types/models/sql/index.d.ts +15 -0
- package/dist/types/models/sql.d.ts +1 -0
- package/dist/types/models/types.d.ts +541 -0
- package/dist/types/mongo.d.ts +3 -0
- package/dist/types/push/MailPushRoute.d.ts +37 -0
- package/dist/types/push/index.d.ts +1 -0
- package/dist/types/routes/BaseAttachmentRoute.d.ts +24 -0
- package/dist/types/routes/BaseCalendarShareLinkRoute.d.ts +35 -0
- package/dist/types/routes/BaseFolderRoute.d.ts +58 -0
- package/dist/types/routes/BaseMailIngestRoute.d.ts +47 -0
- package/dist/types/routes/BaseMailboxRoute.d.ts +60 -0
- package/dist/types/routes/BaseMessageRoute.d.ts +27 -0
- package/dist/types/routes/BaseScopedChildRoute.d.ts +61 -0
- package/dist/types/routes/BaseSearchRoute.d.ts +23 -0
- package/dist/types/routes/index.d.ts +8 -0
- package/dist/types/routes/mongo/AttachmentRouteMongo.d.ts +6 -0
- package/dist/types/routes/mongo/CalendarEventRouteMongo.d.ts +6 -0
- package/dist/types/routes/mongo/CalendarShareLinkRouteMongo.d.ts +6 -0
- package/dist/types/routes/mongo/ContactListRouteMongo.d.ts +6 -0
- package/dist/types/routes/mongo/ContactRouteMongo.d.ts +6 -0
- package/dist/types/routes/mongo/FolderRouteMongo.d.ts +5 -0
- package/dist/types/routes/mongo/IngestQueueRouteMongo.d.ts +13 -0
- package/dist/types/routes/mongo/MailIngestRouteMongo.d.ts +6 -0
- package/dist/types/routes/mongo/MailboxRouteMongo.d.ts +8 -0
- package/dist/types/routes/mongo/MessageRouteMongo.d.ts +6 -0
- package/dist/types/routes/mongo/NoteRouteMongo.d.ts +6 -0
- package/dist/types/routes/mongo/QuarantineRouteMongo.d.ts +15 -0
- package/dist/types/routes/mongo/SearchRouteMongo.d.ts +5 -0
- package/dist/types/routes/mongo/TaskRouteMongo.d.ts +6 -0
- package/dist/types/routes/mongo/index.d.ts +14 -0
- package/dist/types/routes/mongo.d.ts +1 -0
- package/dist/types/routes/sql/AttachmentRouteSQL.d.ts +6 -0
- package/dist/types/routes/sql/CalendarEventRouteSQL.d.ts +6 -0
- package/dist/types/routes/sql/CalendarShareLinkRouteSQL.d.ts +6 -0
- package/dist/types/routes/sql/ContactListRouteSQL.d.ts +6 -0
- package/dist/types/routes/sql/ContactRouteSQL.d.ts +6 -0
- package/dist/types/routes/sql/FolderRouteSQL.d.ts +5 -0
- package/dist/types/routes/sql/IngestQueueRouteSQL.d.ts +9 -0
- package/dist/types/routes/sql/MailIngestRouteSQL.d.ts +23 -0
- package/dist/types/routes/sql/MailboxRouteSQL.d.ts +22 -0
- package/dist/types/routes/sql/MessageRouteSQL.d.ts +6 -0
- package/dist/types/routes/sql/NoteRouteSQL.d.ts +6 -0
- package/dist/types/routes/sql/QuarantineRouteSQL.d.ts +9 -0
- package/dist/types/routes/sql/SearchRouteSQL.d.ts +5 -0
- package/dist/types/routes/sql/TaskRouteSQL.d.ts +6 -0
- package/dist/types/routes/sql/index.d.ts +14 -0
- package/dist/types/routes/sql.d.ts +1 -0
- package/dist/types/scan/AvScanProvider.d.ts +22 -0
- package/dist/types/scan/ClamAvScanProvider.d.ts +17 -0
- package/dist/types/scan/RspamdSpamScanProvider.d.ts +16 -0
- package/dist/types/scan/ScanPipeline.d.ts +53 -0
- package/dist/types/scan/SpamScanProvider.d.ts +29 -0
- package/dist/types/scan/index.d.ts +5 -0
- package/dist/types/search/MongoTextSearchProvider.d.ts +22 -0
- package/dist/types/search/OpenSearchProvider.d.ts +24 -0
- package/dist/types/search/PostgresFullTextSearchProvider.d.ts +21 -0
- package/dist/types/search/SearchProvider.d.ts +62 -0
- package/dist/types/search/extraction/DocxTextExtractor.d.ts +14 -0
- package/dist/types/search/extraction/ExtractorRegistry.d.ts +19 -0
- package/dist/types/search/extraction/HtmlTextExtractor.d.ts +11 -0
- package/dist/types/search/extraction/PdfTextExtractor.d.ts +10 -0
- package/dist/types/search/extraction/PlainTextExtractor.d.ts +10 -0
- package/dist/types/search/extraction/TextExtractor.d.ts +17 -0
- package/dist/types/search/index.d.ts +10 -0
- package/dist/types/sql.d.ts +3 -0
- package/dist/types/transport/MTAIngestAdapter.d.ts +25 -0
- package/dist/types/transport/MailTransport.d.ts +29 -0
- package/dist/types/transport/PostfixSendmailTransport.d.ts +15 -0
- package/dist/types/transport/index.d.ts +3 -0
- package/dist/types/util/FolderUtils.d.ts +15 -0
- package/dist/types/util/MailSendUtils.d.ts +19 -0
- package/dist/types/util/MailboxScopeUtils.d.ts +19 -0
- package/dist/types/util/OptionalDeps.d.ts +9 -0
- package/dist/types/util/RecoverableRepoUtils.d.ts +24 -0
- package/dist/types/util/index.d.ts +12 -0
- package/package.json +122 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AvVerdict } from "../models/types.js";
|
|
2
|
+
/** The outcome of an `AvScanProvider.scanBuffer()` call. */
|
|
3
|
+
export interface AvScanResult {
|
|
4
|
+
verdict: AvVerdict;
|
|
5
|
+
/** The name of the malware signature matched, if `verdict` is `INFECTED`. */
|
|
6
|
+
signatureName?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Scans a buffer of content (a full raw MIME message, a decoded attachment, or an HTML body) for malicious
|
|
10
|
+
* content by delegating to an existing anti-virus engine (ClamAV) rather than implementing detection in this
|
|
11
|
+
* library. See `ClamAvScanProvider` for the default adapter. Selected via the `scan:av:provider` config key.
|
|
12
|
+
*
|
|
13
|
+
* Called on more than just file attachments — the full raw message and HTML bodies are scanned too, which is
|
|
14
|
+
* what covers embedded/malicious HTML (e.g. an exploit payload in an inline `<script>`), not just attachments.
|
|
15
|
+
*
|
|
16
|
+
* @author Jean-Philippe Steinmetz
|
|
17
|
+
*/
|
|
18
|
+
export interface AvScanProvider {
|
|
19
|
+
/** A short, unique name for this provider implementation (e.g. `"clamav"`). */
|
|
20
|
+
readonly name: string;
|
|
21
|
+
scanBuffer(content: Buffer, filename?: string): Promise<AvScanResult>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AvScanProvider, AvScanResult } from "./AvScanProvider.js";
|
|
2
|
+
/**
|
|
3
|
+
* `AvScanProvider` adapter for ClamAV, talking to `clamd` via the INSTREAM protocol (a length-prefixed chunk
|
|
4
|
+
* stream over a TCP or Unix socket) — chosen over shelling out to the `clamscan` CLI so scanning doesn't incur
|
|
5
|
+
* a process-spawn per call and works transparently against a remote `clamd` instance.
|
|
6
|
+
*
|
|
7
|
+
* @author Jean-Philippe Steinmetz
|
|
8
|
+
*/
|
|
9
|
+
export declare class ClamAvScanProvider implements AvScanProvider {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
private host;
|
|
12
|
+
private port;
|
|
13
|
+
private timeoutMs;
|
|
14
|
+
private logger;
|
|
15
|
+
scanBuffer(content: Buffer, filename?: string): Promise<AvScanResult>;
|
|
16
|
+
private instream;
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ScanEnvelope, SpamScanProvider, SpamScanResult } from "./SpamScanProvider.js";
|
|
2
|
+
/**
|
|
3
|
+
* `SpamScanProvider` adapter for rspamd, talking to its HTTP controller `checkv2` endpoint. Chosen over
|
|
4
|
+
* SpamAssassin's `spamc`/`spamd` line protocol for HTTP-native integration matching this library's HTTP-first
|
|
5
|
+
* design — a `SpamAssassinScanProvider` implementing the same interface via `spamc` is a straightforward
|
|
6
|
+
* drop-in alternative for a deployment that already runs SpamAssassin instead.
|
|
7
|
+
*
|
|
8
|
+
* @author Jean-Philippe Steinmetz
|
|
9
|
+
*/
|
|
10
|
+
export declare class RspamdSpamScanProvider implements SpamScanProvider {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
private url;
|
|
13
|
+
private timeoutMs;
|
|
14
|
+
private logger;
|
|
15
|
+
scoreMessage(raw: Buffer, envelope: ScanEnvelope): Promise<SpamScanResult>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { AvScanResult } from "./AvScanProvider.js";
|
|
2
|
+
import { ScanEnvelope, SpamScanResult } from "./SpamScanProvider.js";
|
|
3
|
+
/** The per-attachment AV outcome, keyed by the attachment's position in the parsed message. */
|
|
4
|
+
export interface ScanPipelineAttachmentResult {
|
|
5
|
+
filename?: string;
|
|
6
|
+
contentType: string;
|
|
7
|
+
content: Buffer;
|
|
8
|
+
contentId?: string;
|
|
9
|
+
isInline: boolean;
|
|
10
|
+
av: AvScanResult;
|
|
11
|
+
}
|
|
12
|
+
/** The combined outcome of running the full SPAM/AV pipeline against one raw message. */
|
|
13
|
+
export interface ScanPipelineResult {
|
|
14
|
+
spam: SpamScanResult;
|
|
15
|
+
/** The overall AV verdict for the message: the worst of the raw-message-level and every attachment's scan. */
|
|
16
|
+
av: AvScanResult;
|
|
17
|
+
attachments: ScanPipelineAttachmentResult[];
|
|
18
|
+
/** The message's HTML body with `<script>`/active content stripped, if it had one. */
|
|
19
|
+
sanitizedHtml?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Orchestrates SPAM scoring, AV scanning, and HTML sanitization for a single raw RFC 5322 message — the
|
|
23
|
+
* ingestion-time gate that every inbound message (via `MailIngestRoute`) and outbound send (via the webmail/
|
|
24
|
+
* EAS/MAPI "send" routes) passes through before delivery/relay. AV scanning covers the full raw message buffer
|
|
25
|
+
* *and* each decoded attachment (not just attachments), which is what catches embedded/malicious HTML.
|
|
26
|
+
*
|
|
27
|
+
* @author Jean-Philippe Steinmetz
|
|
28
|
+
*/
|
|
29
|
+
export declare class ScanPipeline {
|
|
30
|
+
private spamScanProvider?;
|
|
31
|
+
private avScanProvider?;
|
|
32
|
+
private allowedTags?;
|
|
33
|
+
private logger;
|
|
34
|
+
run(raw: Buffer, envelope: ScanEnvelope): Promise<ScanPipelineResult>;
|
|
35
|
+
private scanAttachments;
|
|
36
|
+
/**
|
|
37
|
+
* Strips `<script>` tags and other active/executable content from an HTML body. Defense in depth alongside
|
|
38
|
+
* clamd's own HTML/JS signature detection (run against the raw message above) and whatever sandboxing the
|
|
39
|
+
* eventual client renderer applies.
|
|
40
|
+
*/
|
|
41
|
+
private sanitize;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Combines a spam verdict and an AV verdict into where the message should be routed on ingestion.
|
|
45
|
+
*
|
|
46
|
+
* `AvVerdict.ERROR` and `SpamVerdict.SUSPECT` are the providers' own documented fail-closed outcomes for a
|
|
47
|
+
* scan-engine outage (see `ClamAvScanProvider.scanBuffer()`/`RspamdSpamScanProvider.scoreMessage()`) - treating
|
|
48
|
+
* them as equivalent to a clean/normal verdict here would silently deliver every message straight to the
|
|
49
|
+
* inbox, completely unscanned, for the entire duration of an AV/spam engine outage. `ERROR` quarantines
|
|
50
|
+
* (matching AV's own "treat like infected" intent); `SUSPECT` routes to Junk for human review rather than
|
|
51
|
+
* blind inbox delivery.
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveDeliveryVerdict(result: ScanPipelineResult): "deliver" | "junk" | "quarantine";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SpamVerdict } from "../models/types.js";
|
|
2
|
+
/** The envelope information a `SpamScanProvider` needs alongside the raw message content. */
|
|
3
|
+
export interface ScanEnvelope {
|
|
4
|
+
from: string;
|
|
5
|
+
to: string[];
|
|
6
|
+
/** The originating IP address of the SMTP client that submitted the message, if known. */
|
|
7
|
+
remoteIp?: string;
|
|
8
|
+
/** The HELO/EHLO hostname presented by the originating SMTP client, if known. */
|
|
9
|
+
helo?: string;
|
|
10
|
+
}
|
|
11
|
+
/** The outcome of a `SpamScanProvider.scoreMessage()` call. */
|
|
12
|
+
export interface SpamScanResult {
|
|
13
|
+
score: number;
|
|
14
|
+
verdict: SpamVerdict;
|
|
15
|
+
/** The symbolic names (e.g. rspamd symbols, SpamAssassin rule names) that contributed to the score. */
|
|
16
|
+
symbols: string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Scores a raw RFC 5322 message for spam likelihood by delegating to an existing, battle-tested spam-filtering
|
|
20
|
+
* engine (rspamd, SpamAssassin) rather than implementing detection heuristics in this library. See
|
|
21
|
+
* `RspamdSpamScanProvider` for the default adapter. Selected via the `scan:spam:provider` config key.
|
|
22
|
+
*
|
|
23
|
+
* @author Jean-Philippe Steinmetz
|
|
24
|
+
*/
|
|
25
|
+
export interface SpamScanProvider {
|
|
26
|
+
/** A short, unique name for this provider implementation (e.g. `"rspamd"`, `"spamassassin"`). */
|
|
27
|
+
readonly name: string;
|
|
28
|
+
scoreMessage(raw: Buffer, envelope: ScanEnvelope): Promise<SpamScanResult>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SearchDocument, SearchEntityType, SearchProvider, SearchQuery, SearchResultPage } from "./SearchProvider.js";
|
|
2
|
+
/**
|
|
3
|
+
* `SearchProvider` backed by MongoDB's native `$text` index — the embedded default for a Mongo-backed
|
|
4
|
+
* deployment that hasn't opted into a dedicated search engine. Documents are stored in a collection separate
|
|
5
|
+
* from the entities they're derived from (`mail_search_index`), keyed by `<entityType>:<entityUid>`.
|
|
6
|
+
*
|
|
7
|
+
* @author Jean-Philippe Steinmetz
|
|
8
|
+
*/
|
|
9
|
+
export declare class MongoTextSearchProvider implements SearchProvider {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
private connectionManager?;
|
|
12
|
+
private datasourceName;
|
|
13
|
+
private logger;
|
|
14
|
+
private collection?;
|
|
15
|
+
private init;
|
|
16
|
+
private docId;
|
|
17
|
+
private toStoredDoc;
|
|
18
|
+
index(doc: SearchDocument): Promise<void>;
|
|
19
|
+
bulkIndex(docs: SearchDocument[]): Promise<void>;
|
|
20
|
+
remove(entityType: SearchEntityType, entityUid: string): Promise<void>;
|
|
21
|
+
search(query: SearchQuery): Promise<SearchResultPage>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SearchDocument, SearchEntityType, SearchProvider, SearchQuery, SearchResultPage } from "./SearchProvider.js";
|
|
2
|
+
/**
|
|
3
|
+
* `SearchProvider` adapter for a dedicated OpenSearch cluster, via the optional peer dependency
|
|
4
|
+
* `@opensearch-project/opensearch` — the recommended provider for larger deployments where the embedded
|
|
5
|
+
* Mongo/Postgres default's relevance ranking and indexing throughput become a bottleneck. Selected via the
|
|
6
|
+
* `search:provider: "opensearch"` config key.
|
|
7
|
+
*
|
|
8
|
+
* @author Jean-Philippe Steinmetz
|
|
9
|
+
*/
|
|
10
|
+
export declare class OpenSearchProvider implements SearchProvider {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
private url;
|
|
13
|
+
private index_;
|
|
14
|
+
private username?;
|
|
15
|
+
private password?;
|
|
16
|
+
private logger;
|
|
17
|
+
private client?;
|
|
18
|
+
private init;
|
|
19
|
+
private docId;
|
|
20
|
+
index(doc: SearchDocument): Promise<void>;
|
|
21
|
+
bulkIndex(docs: SearchDocument[]): Promise<void>;
|
|
22
|
+
remove(entityType: SearchEntityType, entityUid: string): Promise<void>;
|
|
23
|
+
search(query: SearchQuery): Promise<SearchResultPage>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SearchDocument, SearchEntityType, SearchProvider, SearchQuery, SearchResultPage } from "./SearchProvider.js";
|
|
2
|
+
/**
|
|
3
|
+
* `SearchProvider` backed by Postgres's native full-text search (`tsvector`/`to_tsquery` with a GIN index) —
|
|
4
|
+
* the embedded default for a SQL-backed deployment that hasn't opted into a dedicated search engine. Documents
|
|
5
|
+
* are stored in a dedicated table separate from the entities they're derived from, keyed by
|
|
6
|
+
* `(entity_type, entity_uid)`.
|
|
7
|
+
*
|
|
8
|
+
* @author Jean-Philippe Steinmetz
|
|
9
|
+
*/
|
|
10
|
+
export declare class PostgresFullTextSearchProvider implements SearchProvider {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
private connectionManager?;
|
|
13
|
+
private datasourceName;
|
|
14
|
+
private logger;
|
|
15
|
+
private dataSource?;
|
|
16
|
+
private init;
|
|
17
|
+
index(doc: SearchDocument): Promise<void>;
|
|
18
|
+
bulkIndex(docs: SearchDocument[]): Promise<void>;
|
|
19
|
+
remove(entityType: SearchEntityType, entityUid: string): Promise<void>;
|
|
20
|
+
search(query: SearchQuery): Promise<SearchResultPage>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** The kind of entity a `SearchDocument` represents. */
|
|
2
|
+
export type SearchEntityType = "message" | "contact" | "calendarEvent" | "note" | "task";
|
|
3
|
+
/**
|
|
4
|
+
* A flattened, provider-agnostic representation of one searchable entity, built from a `Message`/`Contact`/
|
|
5
|
+
* `CalendarEvent`/`Note`/`Task` record (plus, for a message, its attachments' extracted text) and handed to a
|
|
6
|
+
* `SearchProvider` for indexing.
|
|
7
|
+
*/
|
|
8
|
+
export interface SearchDocument {
|
|
9
|
+
entityType: SearchEntityType;
|
|
10
|
+
entityUid: string;
|
|
11
|
+
mailboxUid: string;
|
|
12
|
+
subject?: string;
|
|
13
|
+
body?: string;
|
|
14
|
+
attachmentText?: string[];
|
|
15
|
+
participants?: string[];
|
|
16
|
+
dateForSort?: Date;
|
|
17
|
+
}
|
|
18
|
+
/** A search query issued against `BaseSearchRoute` / `SearchProvider.search()`. */
|
|
19
|
+
export interface SearchQuery {
|
|
20
|
+
mailboxUid: string;
|
|
21
|
+
text: string;
|
|
22
|
+
entityTypes?: SearchEntityType[];
|
|
23
|
+
limit?: number;
|
|
24
|
+
cursor?: string;
|
|
25
|
+
}
|
|
26
|
+
/** A single ranked hit returned by `SearchProvider.search()`. */
|
|
27
|
+
export interface SearchResult {
|
|
28
|
+
entityType: SearchEntityType;
|
|
29
|
+
entityUid: string;
|
|
30
|
+
score: number;
|
|
31
|
+
/** A short, provider-generated snippet highlighting the matched text, if supported. */
|
|
32
|
+
snippet?: string;
|
|
33
|
+
}
|
|
34
|
+
/** The page of results returned by `SearchProvider.search()`. */
|
|
35
|
+
export interface SearchResultPage {
|
|
36
|
+
results: SearchResult[];
|
|
37
|
+
/** Opaque cursor to pass back as `SearchQuery.cursor` to retrieve the next page, if more results exist. */
|
|
38
|
+
nextCursor?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Provides full-text indexing and search over mail/contacts/calendar/notes/tasks content, independent of the
|
|
42
|
+
* chosen persistence backend (Mongo/SQL have no native cross-entity relevance-ranked search of their own).
|
|
43
|
+
* Implementations are selected via the `search:provider` config key and are never queried through `RepoUtils`.
|
|
44
|
+
*
|
|
45
|
+
* Index updates are eventually consistent with respect to the primary datastore — see `SearchIndexState` and
|
|
46
|
+
* `SearchIndexJob` — so a just-created entity may briefly be readable via its own CRUD route before it becomes
|
|
47
|
+
* findable via search.
|
|
48
|
+
*
|
|
49
|
+
* @author Jean-Philippe Steinmetz
|
|
50
|
+
*/
|
|
51
|
+
export interface SearchProvider {
|
|
52
|
+
/** A short, unique name for this provider implementation (e.g. `"mongo"`, `"postgres"`, `"opensearch"`). */
|
|
53
|
+
readonly name: string;
|
|
54
|
+
/** Indexes (or re-indexes) a single document. */
|
|
55
|
+
index(doc: SearchDocument): Promise<void>;
|
|
56
|
+
/** Indexes (or re-indexes) a batch of documents in one call, for efficient backfill/reconciliation. */
|
|
57
|
+
bulkIndex(docs: SearchDocument[]): Promise<void>;
|
|
58
|
+
/** Removes a previously indexed document. A no-op if it was never indexed. */
|
|
59
|
+
remove(entityType: SearchEntityType, entityUid: string): Promise<void>;
|
|
60
|
+
/** Executes a search query, returning ranked results across the requested entity types. */
|
|
61
|
+
search(query: SearchQuery): Promise<SearchResultPage>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TextExtractor } from "./TextExtractor.js";
|
|
2
|
+
/**
|
|
3
|
+
* Extracts text from Word (`.docx`) attachment content via the optional peer dependency `mammoth`.
|
|
4
|
+
*
|
|
5
|
+
* Excel/PowerPoint (`.xlsx`/`.pptx`) are deliberately out of scope for the initial pragmatic subset — their
|
|
6
|
+
* text is largely tabular/slide-fragmented and extracts poorly with a generic converter. Revisit with a
|
|
7
|
+
* dedicated extractor if search relevance over spreadsheet/slide attachments becomes a real requirement.
|
|
8
|
+
*
|
|
9
|
+
* @author Jean-Philippe Steinmetz
|
|
10
|
+
*/
|
|
11
|
+
export declare class DocxTextExtractor implements TextExtractor {
|
|
12
|
+
readonly mimeTypes: string[];
|
|
13
|
+
extract(content: Buffer): Promise<string>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dispatches attachment content to the `TextExtractor` registered for its MIME type, applying a size cap and
|
|
3
|
+
* timeout so a single huge or pathological attachment cannot stall `AttachmentExtractionJob` indefinitely.
|
|
4
|
+
*
|
|
5
|
+
* @author Jean-Philippe Steinmetz
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExtractorRegistry {
|
|
8
|
+
private maxBytes;
|
|
9
|
+
private timeoutMs;
|
|
10
|
+
private logger;
|
|
11
|
+
private extractors;
|
|
12
|
+
private byMimeType;
|
|
13
|
+
/**
|
|
14
|
+
* Extracts text from `content` if a `TextExtractor` is registered for `mimeType` and `content` is within
|
|
15
|
+
* the configured size cap, otherwise returns `undefined` without error (an unsupported/oversized
|
|
16
|
+
* attachment simply isn't indexed by content — its filename is still searchable via the entity itself).
|
|
17
|
+
*/
|
|
18
|
+
extract(mimeType: string, content: Buffer): Promise<string | undefined>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TextExtractor } from "./TextExtractor.js";
|
|
2
|
+
/**
|
|
3
|
+
* Strips markup from HTML attachment/body content, keeping only its rendered text — used both for attachment
|
|
4
|
+
* text extraction and to derive `Message.bodyPreview` from an HTML body.
|
|
5
|
+
*
|
|
6
|
+
* @author Jean-Philippe Steinmetz
|
|
7
|
+
*/
|
|
8
|
+
export declare class HtmlTextExtractor implements TextExtractor {
|
|
9
|
+
readonly mimeTypes: string[];
|
|
10
|
+
extract(content: Buffer): Promise<string>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TextExtractor } from "./TextExtractor.js";
|
|
2
|
+
/**
|
|
3
|
+
* Extracts text from PDF attachment content via the optional peer dependency `pdf-parse`.
|
|
4
|
+
*
|
|
5
|
+
* @author Jean-Philippe Steinmetz
|
|
6
|
+
*/
|
|
7
|
+
export declare class PdfTextExtractor implements TextExtractor {
|
|
8
|
+
readonly mimeTypes: string[];
|
|
9
|
+
extract(content: Buffer): Promise<string>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TextExtractor } from "./TextExtractor.js";
|
|
2
|
+
/**
|
|
3
|
+
* Passes plain-text attachment content through unchanged (decoded as UTF-8).
|
|
4
|
+
*
|
|
5
|
+
* @author Jean-Philippe Steinmetz
|
|
6
|
+
*/
|
|
7
|
+
export declare class PlainTextExtractor implements TextExtractor {
|
|
8
|
+
readonly mimeTypes: string[];
|
|
9
|
+
extract(content: Buffer): Promise<string>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts plain text content from a single attachment's binary content, for full-text search indexing (see
|
|
3
|
+
* `SearchProvider`). Dispatched by MIME type via `ExtractorRegistry`. Runs as part of `AttachmentExtractionJob`
|
|
4
|
+
* (a background job), never inline on message ingestion — extraction can be slow and must not block SMTP-ACK
|
|
5
|
+
* or webmail send/save-draft latency.
|
|
6
|
+
*
|
|
7
|
+
* @author Jean-Philippe Steinmetz
|
|
8
|
+
*/
|
|
9
|
+
export interface TextExtractor {
|
|
10
|
+
/** The MIME types this extractor handles, e.g. `["application/pdf"]`. */
|
|
11
|
+
readonly mimeTypes: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Extracts plain text from `content`. Returns an empty string if no extractable text is found. Throws only
|
|
14
|
+
* for content that cannot be parsed at all (e.g. corrupt file) — an empty result is not an error.
|
|
15
|
+
*/
|
|
16
|
+
extract(content: Buffer): Promise<string>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./SearchProvider.js";
|
|
2
|
+
export * from "./MongoTextSearchProvider.js";
|
|
3
|
+
export * from "./PostgresFullTextSearchProvider.js";
|
|
4
|
+
export * from "./OpenSearchProvider.js";
|
|
5
|
+
export * from "./extraction/TextExtractor.js";
|
|
6
|
+
export * from "./extraction/PlainTextExtractor.js";
|
|
7
|
+
export * from "./extraction/HtmlTextExtractor.js";
|
|
8
|
+
export * from "./extraction/PdfTextExtractor.js";
|
|
9
|
+
export * from "./extraction/DocxTextExtractor.js";
|
|
10
|
+
export * from "./extraction/ExtractorRegistry.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Documents the HTTP contract an MTA (Postfix, Haraka, ...) integrates against to hand accepted internet mail
|
|
3
|
+
* to this library. This is not a pluggable interface implemented in code — it is the fixed shape that
|
|
4
|
+
* `BaseMailIngestRoute` (see `routes/mongo/MailIngestRouteMongo.ts` / `routes/sql/MailIngestRouteSQL.ts`)
|
|
5
|
+
* exposes, documented here as the integration target for whichever MTA a deployment chooses.
|
|
6
|
+
*
|
|
7
|
+
* Both endpoints are internal-only: bound to loopback/an internal network in the server's HTTP configuration,
|
|
8
|
+
* and additionally gated by a shared bearer secret (`mail:transport:ingest:secret`) checked against the
|
|
9
|
+
* `Authorization` header — never exposed to the public internet.
|
|
10
|
+
*
|
|
11
|
+
* ### `GET /internal/mta/resolve?rcpt=<address>`
|
|
12
|
+
* Called by the MTA's recipient-validation hook (e.g. Postfix `recipient_lookup` via a `tcp_table`/socketmap,
|
|
13
|
+
* or an LMTP handshake) before accepting a message for `rcpt`, so a message for a nonexistent mailbox is
|
|
14
|
+
* rejected at the SMTP conversation stage rather than accepted and later bounced (avoiding backscatter).
|
|
15
|
+
* Responds `200` if a `Mailbox` exists for `rcpt` (as a primary or alias address), `404` otherwise.
|
|
16
|
+
*
|
|
17
|
+
* ### `POST /internal/mta/deliver`
|
|
18
|
+
* Called by the MTA's content-filter/pipe once it has accepted a message. The request body is the raw,
|
|
19
|
+
* unparsed RFC 5322 message; envelope-from/envelope-to are carried as `X-Envelope-From`/`X-Envelope-To`
|
|
20
|
+
* headers. The handler does only the minimum synchronous work — persist the raw bytes to the `BlobStore` and
|
|
21
|
+
* create an `IngestQueueEntry` — then returns `202` immediately, deferring parsing/scanning/delivery to
|
|
22
|
+
* `ScanQueueJob`. This bounds SMTP-transaction latency and lets the MTA's own queue (not this library's) own
|
|
23
|
+
* retry/backpressure semantics.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MTA_INGEST_CONTRACT_DOC = "See MTAIngestAdapter.ts for the GET /internal/mta/resolve and POST /internal/mta/deliver contract.";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** A fully composed message ready to be relayed to the internet. */
|
|
2
|
+
export interface OutboundMessage {
|
|
3
|
+
/** The complete, fully composed RFC 5322 MIME source, including headers. */
|
|
4
|
+
raw: Buffer;
|
|
5
|
+
envelopeFrom: string;
|
|
6
|
+
envelopeTo: string[];
|
|
7
|
+
}
|
|
8
|
+
/** The outcome of a `MailTransport.send()` call. */
|
|
9
|
+
export interface TransportResult {
|
|
10
|
+
accepted: string[];
|
|
11
|
+
rejected: string[];
|
|
12
|
+
/** The `Message-ID` the relaying MTA recorded for this transaction, if reported. */
|
|
13
|
+
messageId?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Hands a fully composed outbound message to the local MTA (Postfix) for internet delivery — DKIM signing,
|
|
17
|
+
* SPF/DMARC alignment, retry/queueing, and everything else needed to speak SMTP to the rest of the internet is
|
|
18
|
+
* the MTA's responsibility, not this library's. See `PostfixSendmailTransport` for the default adapter.
|
|
19
|
+
*
|
|
20
|
+
* This library never opens an outbound SMTP connection itself; every "send" action in the webmail REST API,
|
|
21
|
+
* EAS, and MAPI layers ultimately calls a `MailTransport` implementation.
|
|
22
|
+
*
|
|
23
|
+
* @author Jean-Philippe Steinmetz
|
|
24
|
+
*/
|
|
25
|
+
export interface MailTransport {
|
|
26
|
+
/** A short, unique name for this transport implementation (e.g. `"postfix-sendmail"`). */
|
|
27
|
+
readonly name: string;
|
|
28
|
+
send(message: OutboundMessage): Promise<TransportResult>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MailTransport, OutboundMessage, TransportResult } from "./MailTransport.js";
|
|
2
|
+
/**
|
|
3
|
+
* `MailTransport` adapter that hands a fully composed message to the local Postfix (or any other locally
|
|
4
|
+
* installed MTA) via the `sendmail(1)` command-line interface — the simplest integration that works with
|
|
5
|
+
* essentially any Unix MTA, and lets Postfix (with an OpenDKIM milter) apply DKIM signing on the way out
|
|
6
|
+
* exactly as it would for mail submitted by any other local process.
|
|
7
|
+
*
|
|
8
|
+
* @author Jean-Philippe Steinmetz
|
|
9
|
+
*/
|
|
10
|
+
export declare class PostfixSendmailTransport implements MailTransport {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
private sendmailPath;
|
|
13
|
+
private logger;
|
|
14
|
+
send(message: OutboundMessage): Promise<TransportResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { JWTUser } from "@rapidrest/core";
|
|
2
|
+
import { RepoUtils } from "@rapidrest/service-core";
|
|
3
|
+
import { Folder, FolderType } from "../models/types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Finds the given mailbox's well-known folder of `type` (e.g. its Inbox, Junk, Sent Items), creating it — with
|
|
6
|
+
* the platform's conventional display name — if it does not already exist. Every well-known folder is
|
|
7
|
+
* provisioned lazily this way rather than all at once when a `Mailbox` is created, so a mailbox that never
|
|
8
|
+
* receives a piece of spam, for example, never has an empty Junk folder to show for it.
|
|
9
|
+
*
|
|
10
|
+
* @param folderRepo A `RepoUtils` bound to the caller's concrete `Folder` entity class (Mongo or SQL).
|
|
11
|
+
* @param folderClass The concrete `Folder` entity class `folderRepo` is bound to, used to construct a new row.
|
|
12
|
+
* @param mailboxUid The mailbox to find or create the folder within.
|
|
13
|
+
* @param type The well-known folder type to find or create. Must not be `FolderType.USER`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function findOrCreateWellKnownFolder<F extends Folder>(folderRepo: RepoUtils<F>, folderClass: any, mailboxUid: string, type: Exclude<FolderType, FolderType.USER>, user?: JWTUser): Promise<F>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BlobStore } from "../blob/BlobStore.js";
|
|
2
|
+
import { ScanPipeline } from "../scan/ScanPipeline.js";
|
|
3
|
+
/** The outcome of `scanAndRelay()` a caller needs to finish persisting a sent message. */
|
|
4
|
+
export interface ScanAndRelayResult {
|
|
5
|
+
/** The blob key `scanResult.sanitizedHtml` (if any) was stored under - see the identical reasoning in
|
|
6
|
+
* `ScanQueueJob.processEntry()`'s own doc comment on why this must never be folded into the raw body key. */
|
|
7
|
+
sanitizedHtmlBlobKey?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Runs `raw` through `ScanPipeline` and, if it passes, relays it via `mailTransport` - the scan-then-relay core
|
|
11
|
+
* shared by every "send a composed message" entry point in this library (`BaseMessageRoute.send()`'s REST
|
|
12
|
+
* endpoint and the EAS `SendMail`/`SmartForward`/`SmartReply` commands via `sendComposedMime()` below), so this
|
|
13
|
+
* gate is defined exactly once rather than duplicated per protocol.
|
|
14
|
+
*
|
|
15
|
+
* Throws `ApiError` (422) if the scan pipeline's verdict is anything other than "deliver", or (502) if the
|
|
16
|
+
* transport itself rejects the message outright - both cases callers should let propagate as the request's
|
|
17
|
+
* own failure, not attempt to recover from.
|
|
18
|
+
*/
|
|
19
|
+
export declare function scanAndRelay(raw: Buffer, envelopeFrom: string, envelopeTo: string[], scanPipeline: ScanPipeline, mailTransport: any, blobStore: BlobStore): Promise<ScanAndRelayResult>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { JWTUser } from "@rapidrest/core";
|
|
2
|
+
import { RepoUtils } from "@rapidrest/service-core";
|
|
3
|
+
import { Mailbox } from "../models/types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the `Mailbox` owned by `user` (a mailbox's `ownerUserUid` field, not an ACL lookup — this runs with
|
|
6
|
+
* `ignoreACL: true` deliberately, since it's used to derive the *scope* of what a query is allowed to touch,
|
|
7
|
+
* not to check permission on an already-identified record). Returns `undefined` if `user` is unauthenticated
|
|
8
|
+
* or owns no mailbox.
|
|
9
|
+
*
|
|
10
|
+
* See the doc comment on `findOrCreateWellKnownFolder`'s callers / `BaseMailboxScopedRoute` for why this
|
|
11
|
+
* exists: per-record ACLs in this platform inherit from their class-level ACL whenever no record-specific
|
|
12
|
+
* grant matches the caller, so a class-level grant broad enough to let any authenticated user list/read *some*
|
|
13
|
+
* records of a type also lets them list/read records they don't personally own, once class-level `LIST`/`READ`
|
|
14
|
+
* are opened up at all. The class-level ACL for every mailbox-owned entity in this library therefore denies
|
|
15
|
+
* `LIST`/`READ`/`COUNT`/`EXISTS` to `.*` entirely (see each entity's `@Protect` policy), and routes that need
|
|
16
|
+
* to list/count a caller's own records do so by explicitly scoping the query to their own mailbox and passing
|
|
17
|
+
* `ignoreACL: true` for that specific, safely-bounded query — the same pattern this function supports.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveCallerMailboxUid<M extends Mailbox>(mailboxRepo: RepoUtils<M>, user?: JWTUser): Promise<string | undefined>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamically imports an optional peer dependency, throwing a helpful `ApiError` naming the package and its
|
|
3
|
+
* install command if it is not installed. Mirrors `@rapidrest/auth`'s `importArgon2()`/`importOTPLib()`
|
|
4
|
+
* convention so every optional adapter in this library (PDF/DOCX text extraction, OpenSearch) fails the same,
|
|
5
|
+
* actionable way rather than with a raw `MODULE_NOT_FOUND` error.
|
|
6
|
+
*
|
|
7
|
+
* @param packageName The npm package name to import.
|
|
8
|
+
*/
|
|
9
|
+
export declare function importOptional<T = any>(packageName: string): Promise<T>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RecoverableBaseEntity, type RepoDeleteOptions, RepoUtils } from "@rapidrest/service-core";
|
|
2
|
+
/**
|
|
3
|
+
* Extends `RepoUtils` to close a gap in service-core's own soft-delete path: `RepoUtils.delete()`'s
|
|
4
|
+
* soft-delete branch (for a `RecoverableBaseEntity` subclass, when `purge` isn't requested) sets only
|
|
5
|
+
* `deleted: true` — unlike `update()`, it does not bump `dateModified`/`version` (confirmed by reading its
|
|
6
|
+
* source). EAS `Sync`'s per-folder watermark query (`find({dateModified: gt(lastSyncWatermark)})`, see
|
|
7
|
+
* `eas/EasSyncKeyUtils.ts`) needs a soft-deleted row to surface exactly the way an ordinary field change
|
|
8
|
+
* would, or a deletion would never be reported to a device that already synced the item.
|
|
9
|
+
*
|
|
10
|
+
* Stays entirely local to `@rapidrest/mail` (no service-core change): calls `super.delete()` unchanged for
|
|
11
|
+
* everything else (permission checks, ACL cleanup, cache invalidation, notifications, rollback hooks) and
|
|
12
|
+
* only adds one small follow-up write for the two fields service-core's own branch leaves alone. Wired in via
|
|
13
|
+
* the `repoUtilsClass` extension point every concrete Mongo/SQL route already declares (`ModelRoute.ts`'s
|
|
14
|
+
* `this._objectFactory.newInstance(this.repoUtilsClass || RepoUtils, ...)`), and by any job that builds a
|
|
15
|
+
* `RepoUtils` directly for one of the same entity classes.
|
|
16
|
+
*
|
|
17
|
+
* `RepoUtils.truncate()` has no soft-delete branch at all (it always hard-deletes, recoverable or not) — a
|
|
18
|
+
* bulk folder-empty is a documented, out-of-scope-for-this-override gap, not something this class fixes.
|
|
19
|
+
*
|
|
20
|
+
* @author Jean-Philippe Steinmetz
|
|
21
|
+
*/
|
|
22
|
+
export declare class RecoverableRepoUtils<T extends RecoverableBaseEntity> extends RepoUtils<T> {
|
|
23
|
+
delete(uid: string, options: RepoDeleteOptions): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public, backend-agnostic REST-layer helpers shared across this library's own routes and useful to any
|
|
3
|
+
* downstream protocol package (`@rapidmx/activesync`, `@rapidmx/mapi`, `@rapidmx/autodiscover`) that needs to
|
|
4
|
+
* resolve a caller's mailbox, walk a folder tree, send a composed message through the scan/relay pipeline, or
|
|
5
|
+
* soft-delete a `RecoverableBaseEntity` with a correctly bumped watermark. `OptionalDeps.ts`'s
|
|
6
|
+
* `importOptional()` is deliberately not re-exported here - it's an internal helper for this library's own
|
|
7
|
+
* optional peer dependencies (PDF/DOCX extraction, OpenSearch), not something a protocol package needs.
|
|
8
|
+
*/
|
|
9
|
+
export * from "./FolderUtils.js";
|
|
10
|
+
export * from "./MailSendUtils.js";
|
|
11
|
+
export * from "./MailboxScopeUtils.js";
|
|
12
|
+
export * from "./RecoverableRepoUtils.js";
|