UNPKG

node-mdaemon-api

Version:

Unofficial Node.js binding for MDaemon APIs

1,616 lines (1,569 loc) 101 kB
/** * Type definitions for node-mdaemon-api 25.0.3-alpha.41 * Project: Unofficial Node.js binding for MDaemon APIs * Definitions by: MTKA https://mtka.eu/ * * @module node-mdaemon-api */ declare module "node-mdaemon-api" { //#region module types export interface VersionInfo { build: number; full?: string; major: number; minor: number; release: number; tag?: string; } export interface ModuleInfo { fileName: string; isPrerelease: boolean; isFreeVersion: boolean; name: string; version: VersionInfo; } export interface MdApiResultBase { ErrorCode?: number; ErrorMessage?: string; Succeeded: boolean; } export interface MdApiResult<TData> extends MdApiResultBase { Data?: TData; } export type MdCalResultSimple = MdApiResultBase; export type MdCalResult<T> = MdApiResult<T>; export interface MdDocumentInfo { description: string; id: number; fileName: string; fileSize: number; modifiedBy: string; modifiedTime: string; path: string; } export interface MdInfo { is64bit: boolean; isBetaVersion: boolean; isCloudVersion: boolean; isDebugVersion: boolean; isLicenseActive: boolean; isPresent: boolean; isProVersion: boolean; isTrialVersion: boolean; userCount: number; version: VersionInfo; } export interface UserListItem { Email: string; FullName: string; } export interface GroupListItem { Description: string; GroupName: string; } /** * @see {@link https://help.mdaemon.com/mdaemon/en/semaphore_files.html} for further information. */ export interface MdSemaphores { /** Display alert pop-up to WC users */ alert(message: string): boolean; /** Clear the cached quota value for a user. Use '*' for all. */ clearQuotaCounts(address?: string): boolean; /** Create WATCHDOG.SEM */ createWatchdog(): boolean; /** Delete a user */ delUser(address: string): boolean; /** Create UPDATEAV.SEM */ initiateAntivirusDefinitionUpdate(): boolean; /** Create PROCBAD.SEM */ initiateBadQueueDelivery(): boolean; /** Create PROCHOLDING.SEM */ initiateHoldingQueueProcessing(): boolean; /** Create PROCDIG.SEM */ initiateListDigests(): boolean; /** Create PROCNOW.SEM */ initiateRemoteMailCheckAndDelivery(): boolean; /** Create PROCREM.SEM */ initiateRemoteQueueProcessing(): boolean; /** Create PROCRETR.SEM */ initiateRetryQueueProcessing(): boolean; /** Create UPDATESA.SEM */ initiateSpamFilterUpdate(): boolean; /** Create LOCKSEMS.SEM */ lockProcessing(): boolean; /** Create TRAY.SEM */ redrawTrayIcon(): boolean; /** Create GROUPS.SEM */ reloadAccountGroupsConfig(): boolean; /** Create ACTIVESYNCUSERS.SEM */ reloadActiveSyncUsersConfig(): boolean; /** Create ALIAS.SEM */ reloadAliasConfig(): boolean; /** Create RELOADCACHE.SEM */ reloadAllCachedConfig(): boolean; /** Create ARCHIVE.SEM */ reloadArchivingWhiteListConfig(): boolean; /** Create ATTACHMENTLINKING.SEM */ reloadAttachmentLinkingConfig(): boolean; /** Create PRUNE.SEM */ reloadAutoPruningConfig(): boolean; /** Create AUTORESPATTACHMENTS.SEM */ reloadAutoresponderApprovedAttachmentsConfig(): boolean; /** Create AUTORESPEXCEPT.SEM */ reloadAutoresponderExceptionConfig(): boolean; /** Create BADPASSWORD.SEM */ reloadBadPasswordConfig(): boolean; /** Create BATV.SEM */ reloadBatvConfig(): boolean; /** Create SUPPRESS.SEM */ reloadBlackListConfigAndClearCachedDomainConfig(): boolean; /** Create CATLIST.SEM */ reloadCatalogsConfig(): boolean; /** Create COLORS.SEM */ reloadColorizedLogsConfig(): boolean; /** Create CFILTER.SEM */ reloadContentFilterConfig(): boolean; /** Create CREDSMATCHWHITELIST.SEM */ reloadCredentialsMatchWhiteList(): boolean; /** Create NODNSBL.SEM */ reloadDNSBLWhiteListConfig(): boolean; /** Create DMARCCACHE.SEM */ reloadDmarcCache(): boolean; /** Create DMARC.SEM */ reloadDmarcConfig(): boolean; /** Create DMARCWHITELIST.SEM */ reloadDmarcWhiteList(): boolean; /** Create DNS.SEM */ reloadDnsConfig(): boolean; /** Create DOMAINSHARING.SEM */ reloadDomainSharingConfig(): boolean; /** Create DOMAINS.SEM */ reloadDomainsConfig(): boolean; /** Create GATEWAYS.SEM */ reloadGatewaysConfig(): boolean; /** Create GREYLIST.SEM */ reloadGreylistingConfig(): boolean; /** Create TRANSLAT.SEM */ reloadHeaderTranslationConfig(): boolean; /** Create HOSTSCREEN.SEM */ reloadHostScreenConfig(): boolean; /** Create IPSCREEN.SEM */ reloadIPScreenConfig(): boolean; /** Create IPSHIELD.SEM */ reloadIPShieldConfig(): boolean; /** Create INACTIVEEXCLUDE.SEM */ reloadInactiveAccountExceptionConfig(): boolean; /** Create LANDOMAINS.SEM */ reloadLanDomainsConfig(): boolean; /** Create LANIPS.SEM */ reloadLanIPsConfig(): boolean; /** Create LDAPCACHE.SEM */ reloadLdapAndGatewayUserConfig(): boolean; /** Create LOGSETTINGS.SEM */ reloadLoggingConfig(): boolean; /** Create GRPLIST.SEM */ reloadMailingListsConfig(): boolean; /** Create MXCACHE.SEM */ reloadMxCache(): boolean; /** Create NOPRIORITY.SEM */ reloadNoPriorityConfig(): boolean; /** Create PRIORITY.SEM */ reloadPriorityMailConfig(): boolean; /** Create PUBLICSUFFIX.SEM */ reloadPublicSuffixConfig(): boolean; /** Create REVERSEEXCEPT.SEM */ reloadReverseLookupsExceptionConfig(): boolean; /** Create SCHEDULE.SEM */ reloadScheduleConfig(): boolean; /** Create SMARTSPOOL.SEM */ reloadSmartSpoolingWhiteListConfig(): boolean; /** Create SPAMBOT.SEM */ reloadSpamBotDetectionConfig(): boolean; /** Create MDSPAMD.SEM */ reloadSpamFilterWhiteListAndSpamd(): boolean; /** Create SPAMHONEYPOTS.SEM */ reloadSpamHoneypotsConfig(): boolean; /** Create SPF.SEM */ reloadSpfDkimVbrConfig(): boolean; /** Create NOSTARTTLS.SEM */ reloadStartTLSWhiteListConfig(): boolean; /** Create REQUIRETLS.SEM */ reloadStartTlsRequiredConfig(): boolean; /** Create TARPIT.SEM */ reloadTarpitAndDynamicScreeningConfig(): boolean; /** Create TRUST.SEM */ reloadTrustedDomainsAndAddresses(): boolean; /** Create USERLIST.SEM */ reloadUserList(): boolean; /** Create RESTARTCF.SEM */ restartContentFilter(): boolean; /** Create RESTART.SEM */ restartMDaemon(): boolean; /** Create MINGER.SEM */ restartMingerServer(): boolean; /** Create RESTARTWC.SEM */ restartWorldClientServer(): boolean; /** Create ACLFIX.SEM */ runAclFileCleanup(): boolean; /** Create EXITNOW.SEM */ shutDownMDaemon(): boolean; /** Create BAYESLEARN.SEM */ startBayesianLearning(): boolean; /** Erase LOCKSEMS.SEM */ unlockProcessing(): boolean; /** Create DMARCUPDATE.SEM */ updateDmarcPublicSuffixConfig(): boolean; /** Check if WATCHDOG.SEM exists. */ watchdogExists(): boolean; } //#endregion //#region node-mdaemon-api own APIs /** * Predicate for domain names * * @param domainName name of the domain to check */ export function domainExistsSync(domainName: string): boolean; /** * Check asynchronously if a domain exists. * * @param domainName name of the domain to check * @param callback callback function called either on success, or on * failure. On failure, err contains the error and success is * undefined. On success, err is undefined and success is true. */ export function domainExists( domainName: string, callback: (err: Error | null, exists?: boolean ) => void): void; /** * @summary Check if a gateway exists * * @param gatewayName name of the gateway to be checked, * e.g. 'gw.example.com'. */ export function gatewayExistsSync(gatewayName: string): boolean; /** * @summary Get MDaemon information. * * @returns {MdInfo} */ export function getMdInfo(): MdInfo; /** * Get module information. * * @returns {ModuleInfo} */ export function getModuleInfo(): ModuleInfo; /** * @summary Synchronously authenticate against MDaemon user database. * * @param email e-mail address * @param password password * @param ip OPTIONAL IP address * @see MD_LogonUser */ export function loginSync( email: string, password: string, ip?: string ): boolean; /** * @summary Authenticate against MDaemon user database. * * @param email e-mail address * @param password password * @param callback callback function called either on success, or on * failure. On failure, err contains the error and success is * undefined. On success, err is undefined and success is true. * @param ip OPTIONAL IP address */ export function login( email: string, password: string, callback: (err: Error | null, success?: boolean) => void, ip?: string ): void; /** * Read a configuration file in MDaemon\App and convert it to a * plain ES object. * * @param fileName OPTIONAL default "MDaemon.ini" */ export function readSettingsSync(fileName?: string): object; /** * @summary It retrieves all possible information about a document, * given the path where it is located and its local ID. Asynchronous * API. * * @param Path the directory containing the document identified by ID * @param ID local identifier of the document * @param Callback * @param Requester OPTIONAL */ export function readDocumentInfo( Path: string, ID: number, Callback: (err: Error | null, documentInfo?: MdDocumentInfo) => void, Requester?: string): void; /** * @summary It retrieves all possible information about a document, * given the path where it is located and its local ID. Synchronous * API. * * The callback is called with err !== null, on error. Otherwise * documentInfo contains the data about document ID. * * @param Path the directory containing the document identified by ID * @param ID local identifier of the document * @param Requester OPTIONAL * * @returns {MdDocumentInfo} */ export function readDocumentInfoSync( Path: string, ID: number, Requester?: string): MdDocumentInfo | undefined; /** * @summary Synchronously read domain gateway names. * * @returns {string[]} */ export function readDomainGatewaysSync(): string[]; /** * @summary Read domain gateway names. * * @param callback */ export function readDomainGateways(callback: (err: Error | null, domainGateways?: string[]) => void): void; /** * @summary Synchronously get domain names managed by MDaemon. * @returns {string[]} */ export function readDomainsSync(): string[]; /** * @summary Get domain names managed by MDaemon. * @param callback */ export function readDomains(callback: (err: Error | null, domains?: string[]) => void): void; /** * Read a mailing list definition, if it exists. * * @param listName full name of the list: example@example.com * @param callback async callback */ export function readMailingList(listName: string, callback: (err: Error | null, listInfo?: MD_List) => void): void; /** * Read a mailing list definition, if it exists. * * @param listName full name of the list: example@example.com */ export function readMailingListSync(listName: string): MD_List | undefined; /** * Read a mailing list members, if the list exists. * * @param listName full name of the list: example@example.com */ export function readMailingListsSync(): string[]; /** * Read a mailing list's members, if the very list exists. * * @param listName full name of the list: example@example.com * @param includeQueries: OPTIONAL fill MD_ListMember.Flags */ export function readMailingListMembersSync( listName: string, includeQueries?: boolean ): MD_ListMember[]; /** * Read a mailing list's members, if the very list exists. * * @param listName full name of the list: example@example.com * @param callback async callback * @param includeQueries: OPTIONAL fill MD_ListMember.Flags */ export function readMailingListMembers( listName: string, callback: (err: Error | null, members?: MD_ListMember[]) => void, includeQueries?: boolean ): void; /** * * @param callback */ export function readMailingLists(callback: (err: Error | null, mailingLists?: string[]) => void): void; /** * */ export function readUserGroupsSync(): GroupListItem[]; /** * * @param callback */ export function readUserGroups(callback: (err: Error | null, userGroups?: GroupListItem[]) => void): void; /** * */ export function readUserTemplatesSync(): string[]; /** * * @param callback */ export function readUserTemplates(callback: (err: Error | null, userTemplates?: string[]) => void): void; /** * */ export function readUsersSync(): UserListItem[]; /** * * @param callback */ export function readUsers(callback: (err: Error | null, users?: UserListItem[]) => void): void; /** * Retrieve a user's role list. * Roles are 'user', 'admin', 'domainAdmin'. * * @param email * @param callback */ export function readUserRoles(email: string, callback: (err: Error | null, roles?: string[]) => void): void; /** * Retrieve a user's role list. * Roles are 'user', 'admin', 'domainAdmin'. * * @param email */ export function readUserRolesSync(email: string): string[]; /** * @summary True if MDaemon is present. False otherwise. * @readonly */ export const isReady: boolean; /** * Predicate that holds when handle is a bad handle. * * @param handle MDaemon handle or rule handle. */ export function isBadHandle(handle: Buffer): boolean; /** * @summary Full path where mdaemon.exe is stored. * @readonly * @example C:\MDAEMON\App */ export const mdAppPath: string; /** * @summary Module version * @readonly */ export const version: string; /** * @summary Object that contains as many keys as *.exe and *.dll * are present in mdAppPath. Each key has a VersionInfo value that * contains version information of the corresponding *.exe or *.dll. * @readonly */ export const versions: { [moduleName: string]: VersionInfo }; /** * @summary true if MDaemon's version major.minor match module's. * @readonly */ export const versionsMatch: boolean; /** * @summary Helpers to control MDaemon's SEM files. * @readonly */ export const sem: MdSemaphores; //#endregion //#region MDaemon APIs //#region MDaemon API Types export interface MD_AD { Attribute: string; BaseDN: string; BindFlags: number; ContactSearchFilter: string; PageSize: number; Password: string; SearchFilter: string; SearchFlags: number; SearchScope: number; UserName: string; } export interface MdAddrBookParams { CheckAddrBook: boolean; UpdateAddrBook: boolean; } export interface MD_AppPassword { ID: string; Name: string; Hash: string; LastUsedIP: string; CreatedTime: Date; LastUsedTime: Date; } export interface MD_AutoResponder { AddToList: string; Days: number; Enabled: boolean; EndTime: string; Exclude: string; PassMessage: boolean; Process: string; RemoveFromList: string; Script: string; StartTime: string; } export interface MdDomainFlags { ANTISPAM: boolean; ANTIVIRUS: boolean; BIND: boolean; RECURSEIMAP: boolean; } export interface MD_Domain { AdminList: string[]; DomainName: string; DomainPOP_Throttle: number; FQDN: string; Flags: MdDomainFlags; IMAP_Throttle: number; IP6: string; IP: string; InboundSMTP_Throttle: number; MaxDeletedIMAPMessageAge: number; MaxInactive: number; MaxLists: number; MaxMessageAge: number; MaxUsers: number; MultiPOP_Throttle: number; OutboundSMTP_Throttle: number; POP_Throttle: number; SuppressList: string[]; } export interface MD_Forwarding { AUTHLogon: string; AUTHPassword: string; Address: string; Host: string; Port: string; Schedule: MD_AutoResponder; SendAs: string; } export interface MdFlags { raw: number; } export interface MdGatewayFlags extends MdFlags { APPLYQUOTAS: boolean; ATRN: boolean; AUTH: boolean; AUTHALWAYSVALID: boolean; AUTOEXTRACT: boolean; AUTOSPOOL: boolean; ENABLEANTISPAM: boolean; ENABLEANTIVIRUS: boolean; ENABLED: boolean; ETRN: boolean; FILE: boolean; FWDTOADDR: boolean; FWDTOHOST: boolean; HONORIPS: boolean; IGNOREIPS: boolean; KEEPLOCALCOPY: boolean; LDAP: boolean; LOCKATRN: boolean; MINGER: boolean; REFERRALS: boolean; REQUIREAUTH: boolean; SENDWARNING: boolean; TREATASFOREIGN: boolean; USEANYHOST: boolean; USERETRYQ: boolean; USESPECIFICHOST: boolean; V3: boolean; } export interface MD_Gateway { AUTHLogon: string; AUTHPassword: string; CacheDirty: boolean; ETRNHost: string; ETRNPort: string; Email: string; FWDAddress: string; FWDHost: string; FWDPort: string; FWDSendAs: string; Flags: MdGatewayFlags; GatewayName: string; IPList: string[]; LDAPBaseEntry: string; LDAPHost: string; LDAPPort: string; LDAPRootDN: string; LDAPRootPass: string; LDAPSearchFilter: string; LDAPSearchScope: number; MBF: string; MailDir: string; MaxDiskSpace: string; MaxMessageCount: string; Password: string; SendWarningFrom: string; SendWarningTo: string; SharedSecret: string; } export interface MD_Group { ADGroupName: string; DNDSchedule: MD_AutoResponder; Description: string; DisableComAgent: boolean; DisableInstantMessaging: boolean; GroupName: string; Priority: number; TemplateName: string; } export interface MdMultiPOPItemFlags extends MdFlags { ENABLED: boolean; REMOVEMAIL: boolean; USEAPOP: boolean; USEOAUTH: boolean; } export interface MD_MultiPOPItem { HostName: string; UserName: string; Password: string; Flags: MdMultiPOPItemFlags; } export interface MD_ODBC { DSN: string; DigestQuery: string; EmailFieldMapping: string; FirstNameFieldMapping: string; LastNameFieldMapping: string; NormalQuery: string; Pass: string; PostOnlyQuery: string; ReadOnlyQuery: string; Table: string; User: string; } export const enum MdMessagePriority { URGENT = 10, HIGH = 25, AUTH = 35, NORMAL = 50, LOW = 75, BULK = 80, RETRY = 90, } export interface MD_MessageInfo { AttachmentFilePath?: string; BodyFilePath?: string; CharSet?: string; ContentType?: string; From: string; MessageBody: string; Priority?: MdMessagePriority; RawFilePrefix?: string; RemoveAttachment?: boolean; Subject: string; To: string; } export interface MD_UserInfo { AccessType: string; AllowChangeViaEmail: boolean; AllowTFA: boolean; ApplyDomainSignature: boolean; ApplyQuotas: boolean; AttachmentLinking: boolean; AutoDecode: boolean; AutoResponder: MD_AutoResponder; CanModifyGAB: boolean; CheckAddrBook: boolean; Comments: string; CreatePlaceholderEvents: boolean; DeclineConflictingRequests: boolean; DeclineRecurringRequests: boolean; Domain: string; DontExpirePassword: boolean; Email: string; EnableAIMessageFeatures: boolean; EnableComAgent: boolean; EnableInstantMessaging: boolean; EnableMultiPOP: boolean; EnableSubaddressing: boolean; ExemptFromAuthMatch: boolean; ExtractInbound: boolean; ExtractOutbound: boolean; Forwarding: MD_Forwarding; FullName: string; Groups: string; HideFromEveryone: boolean; IsDisabled: boolean; IsDomainAdmin: boolean; IsForwarding: boolean; IsFrozen: boolean; KeepForwardedMail: boolean; MailDir: string; MailFormat: string; Mailbox: string; MaxDeletedIMAPMessageAge: number; MaxDiskSpace: number; MaxInactive: number; MaxMessageAge: number; MaxMessageCount: number; MaxSentPerDay: number; MultiPOPMaxMessageAge: number; MultiPOPMaxMessageSize: number; MustChangePassword: boolean; NTAccount: string; Password: string; PasswordEx: string; ProcessCalendarRequests: boolean; RecurseIMAP: boolean; RequireTFA: boolean; RestrictIMAPAccess: boolean; RestrictPOPAccess: boolean; RestrictSMTPAccess: boolean; RestrictWAAccess: boolean; RestrictWCAccess: boolean; SecurePassword: string; TemplateFlags: number; TemplateName: string; UpdateAddrBook: boolean; UseDefaultPruning: boolean; UserDefined: string; WebConfig: number; } export type MdDatabase = 'ACCOUNTTEMPLATESDB' | 'ACLSHLOOKUPDB' | 'ACTIVEDSDB' | 'ADGROUPSDB' | 'ALIASDB' | 'ASSCHEDULEDB' | 'ATTACHMENTLINKINGDB' | 'AUTHDB' | 'AUTORESPATTACHMENTSDB' | 'AUTORESPEXCEPTDB' | 'AVEXPIREDB' | // deprecated 'AVMESSAGEDB' | // deprecated 'AVSCHEDULEDB' | 'BADPASSWORDDB' | 'BATVEXCEPTDB' | 'BESPOLICYDB' | // deprecated 'BISCONFIGDB' | 'BISSERVERSDB' | // deprecated 'BISSUBSCRIBEDB' | 'CALENDARDB' | 'CALREMINDDB' | 'CENSORDB' | 'CFADMDB' | 'CFBOUNCEDB' | 'CFCOMPRESSDB' | 'CFDELFILESDB' | 'CFDOMAINEXCDB' | 'CFEXCLUDESDB' | 'CFILTERDB' | 'CFRECDB' | 'CFRULESDB' | 'CFRULESTATSDB' | 'CFSAUPDATEDB' | 'CFSNDDB' | 'CFSYSRULESDB' | 'CFVIRADMDB' | 'CFVIRRECDB' | 'CFVIRSNDDB' | 'CFVIRUPDATEDB' | 'CFVIRWRNDB' | 'CREDSMATCHWHITELISTDB' | 'DELERRDB' | // deprecated 'DELUNLESSDB' | 'DELWARNDB' | // deprecated 'DKSIGNLISTDB' | 'DKVRFYEXCEPTDB' | 'DMARCCACHEDB' | 'DMARCWHITELISTDB' | 'DNSBLDB' | 'DOMAINDB' | 'DOMAINPOPDB' | 'DOMAINSHARINGDB' | 'DPOPXTRADB' | 'DSALLOWEDDOMAINSDB' | 'DVUNLESSDB' | 'DYNAMICSCREENDB' | 'FROMMODWHITELISTDB' | 'FWDDB' | 'FWDUNLESSDB' | 'GATEWAYDB' | 'GREYLISTDB' | 'GROUPSDB' | 'GUARDIANDB' | 'GUICOUNTSDB' | 'GWUSERLISTDB' | 'HELOLOOKUPWLDB' | 'HELPDB' | 'HIJACKWHITELISTDB' | 'HOSTAUTHDB' | 'HOSTSCREENDB' | 'IPCACHEDB' | 'IPSCREENDB' | 'IPSHIELDDB' | 'LANDOMAINSDB' | 'LANIPSDB' | 'LDAPCACHEDB' | 'LDAPDB' | 'LISTPRUNEDB' | 'LOCALDATADB' | 'LOCATIONSDB' | // deprecated 'LOGCOLORSDB' | 'MAILLOOKUPWLDB' | 'MDAEMONINIDB' | 'MDCAVDB' | 'MDOPDB' | 'MDPGPDB' | 'MIMETYPEDB' | 'MSGIDDB' | 'MTEDB' | 'MULTIPOPDB' | 'MXCACHEDB' | 'NEARQUOTADB' | 'NOARCHIVEDB' | 'NOATTACHMENTLINKINGDB' | 'NOCACHEDB' | 'NOCOMMANDDB' | 'NODNSBLDB' | 'NOGREYLISTDB' | 'NOLOGFROMIPDB' | 'NOPRIORITYDB' | 'NOSMARTSPOOLDB' | 'NOSPAMBOTDB' | 'NOSTARTTLSDB' | 'NOSUCHUSERDB' | 'NOTARPITDB' | // deprecated 'OAUTHDB' | 'OCSETTINGSDB' | 'OVERQUOTADB' | 'PFDATADB' | 'PLUGINSDB' | 'POLICYDB' | 'POPLOCKDB' | 'PRIORITYDB' | 'PUBLICSUFFIXDB' | 'PWEXPIREWARNINGDB' | 'QCOUNTSDB' | 'QUEUEDUPDATESDB' | 'QUOTACOUNTSDB' |// deprecated 'RCPTBLACKLISTDB' | 'RECALLDB' | 'RECEIPTDB' | 'RECENTDB' | 'RELAYDB' | // deprecated 'REMINDERSDB' | 'REQUIRESTARTTLSDB' | 'REQUIRETLSWLDB' | 'REVERSEEXCEPTDB' | 'RFC822TMPDB' | 'SCHEDULEDB' | 'SECUREPASSWORDSDB' | 'SENDERBLACKLISTDB' | 'SPAMBOTIPDB' | 'SPAMBOTSENDERDB' | 'SPAMHONEYPOTSDB' | 'SPFCACHEDB' | 'SPFDKAPPROVEDDB' | 'SPFEXCEPTDB' | 'TARPITCONNECTDB' | 'TASKREMINDDB' | 'TFAEXCEPTIONIPSDB' | 'TRANSEXCPTDB' | 'TRANSLATEDB' | 'TRUSTEDHOSTSDB' | 'TRUSTEDIPSDB' | 'UNSUBUSERDB' | 'USERLISTDB' | 'USERSDELETEDTODAYDB' | 'VARIABLEDB' | // deprecated 'VBRDB' | 'WEBACCESSDB' | // deprecated 'WORLDCLIENTDOMAINDB' | 'WORLDCLIENTINIDB'; export type MdVerifyUserInfoLevel = 'ACCOUNT' | 'MAILDIR' | 'FWD' | 'QUOTAS' | 'WEBCONFIG' | 'OPTIONS' | 'MULTIPOP' | 'AUTORESP' | 'ALL'; export interface MdPruningFlags { MaxDeletedIMAPMessageAge?: number; MaxInactive?: number; MaxMessageAge?: number; RecurseIMAP?: boolean; UseDomainDefaults?: boolean; } export const enum MdSpoolMessageResult { NOERROR = 0, MISSINGRAWPATH = 1, CANTGENRAWFILENAME = 2, CANTLOCKRAWFILE = 3, CANTCREATERAWFILE = 4, CANTACCESSBODYFILE = 5, } export const enum MdVerifyMessageInfoResult { NOERROR = 0, MISSINGTO = 1, MISSINGFROM = 2, MISSINGBODY = 3, MISSINGBODYFILE = 4, MISSINGATTACHMENTFILE = 5, } export const enum MdVerifyDomainInfoResult { NOERROR = 0, NODOMAINNAME = 1, INVALIDDOMAINNAME = 2, } export const enum MdVerifyUserInfoResult { NOERROR = 0, INVALIDMAILBOX = 1, INVALIDDOMAIN = 2, NONLOCALDOMAIN = 4, POSTMASTER = 5, MBXHASDOMAIN = 6, INVALIDFULLNAME = 7, INVALIDPASSWORD = 8, INVALIDMAILDIR = 9, } /** * MDaemon uses only a subset of folder classes. * * See https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxosfld/68a85898-84fe-43c4-b166-4711c13cdd61 */ export type MdFolderClass = "IPF.Appointment" | /* Calendar */ "IPF.Contact" | /* Contacts */ "IPF.Task" | /* Tasks */ "IPF.StickyNote" | /* Notes */ "IPF.Document" | /* Documents */ "IPF.Journal" | "IPF.Hidden" | "IPF.Note"; export interface MD_MeetingAttendee { Email: string; Response: number; SendInvite: boolean; SentInvite: boolean; Type: number; } export interface MD_Reminder { Id: number; Owner: string; Path: string; SendEmail: boolean; Time: Date; Type: number; Uuid: string; } export interface MD_OccurrenceChange { NewBusyStatus: number; NewCategories: string; NewComment: string; NewCommentHtml: string; NewEnd: Date; NewIsReminderSet: boolean; NewLocation: string; NewReminderMinutes: number; NewStart: Date; NewSubject: string; OriginalDate: Date; } export interface MD_TimeZone { Bias: number; DaylightBias: number; DaylightDate: Date; StandardDate: Date; } export interface MD_RecurrencePattern { ChangedOccurrences: MD_OccurrenceChange[]; DayOfMonth: number; DayOfWeekMask: number; DeletedOccurrences: Date[]; End: Date; Instance: number; Interval: number; MonthOfYear: number; Occurrences: number; Start: Date; SubType: number; TimeZone?: MD_TimeZone; Type: number; ui: number; } export interface MD_PIMAttachment { Data: Blob | null; Filename: string; LocalFilePath: string; MimeType: string; Type: number; } export interface MD_ContactPublicKey { Key: string; // The Key must always be in PEM format which is BASE64 encoded } export interface MD_ContactGroupItem { Email: string; FullName: string; Guid: string; } export interface MD_CalItem { AdditionalReminderCount: number; AdditionalReminders: number[]; // in minutes AttachmentCount: number; Attachments: MD_PIMAttachment[]; AttendeeCount: number; Attendees: MD_MeetingAttendee[]; BusyStatus: number; Categories: string[]; CodePage: number; Comment: string; CommentHtml: string; Creator: string; DAVDataFile: string; EventEnd: Date; EventStart: Date; Flags: number; Id: number; IntendedBusyStatus: number; IsAllDay: boolean; IsAppointmentLocation: boolean; IsPrivate: boolean; IsReadOnly: boolean; IsRecurring: boolean; IsReminderSet: boolean; IsTentativePlaceholder: boolean; Label: number; Location: string; Method: number; ModifiedTime: Date; Planner: string; Priority: number; Recurrence: MD_RecurrencePattern; ReminderMinutes: number; Sequence: number; Subject: string; TNEFFile: string; iCalUid: string; } export interface MdContactItemFlags extends MdFlags { } export interface MD_ContactItem { AccountName: string; Anniversary: Date; AttachmentCount: number; Attachments: MD_PIMAttachment[]; BBPIN: string; Birthday: Date; BusAddress: string; BusAssistant: string; BusAssistantPhone: string; BusCity: string; BusCompany: string; BusCountry: string; BusDepartment: string; BusFax: string; BusIPPhone: string; BusMainPhone: string; BusManager: string; BusOffice: string; BusPager: string; BusPhone2: string; BusPhone: string; BusRadio: string; BusState: string; BusTitle: string; BusWebAddress: string; BusZipCode: string; CarPhoneNumber: string; Categories: string; Children: string; CodePage: number; Comment: string; CommentHtml: string; ContactType: number; CustomerId: string; DAVDataFile: string; EmailAddress2: string; EmailAddress3: string; EmailAddress: string; FileAs: string; FirstName: string; Flags: MdContactItemFlags; FolderID: number; FullName: string; GovernmentId: string; GroupItemCount: number; GroupItems: MD_ContactGroupItem[]; Guid: string; HomeAddress: string; HomeCity: string; HomeCountry: string; HomeFax: string; HomeMobile: string; HomePhone2: string; HomePhone: string; HomeState: string; HomeWebAddress: string; HomeZipCode: string; IMAddress2: string; IMAddress3: string; IMAddress: string; ImapUID: number; IsGroup: boolean; IsReadOnly: boolean; LastName: string; MMSAddress: string; MiddleName: string; Mobile2: string; ModifiedTime: Date; NickName: string; OtherAddress: string; OtherCity: string; OtherCountry: string; OtherPhone: string; OtherState: string; OtherZipCode: string; Picture: string; PublicKeys: MD_ContactPublicKey[]; PublicKeysCount: number; Revision: number; Spouse: string; Suffix: string; TNEFFile: string; Title: string; YomiCompanyName: string; YomiFirstName: string; YomiLastName: string; vCardUid: string; } export interface MdNoteItemFlags extends MdFlags { } export interface MD_NoteItem { AttachmentCount: number; Attachments: MD_PIMAttachment[]; Body: string; BodyHtml: string; Categories: string[]; CodePage: number; Color: number; // 0=blue;1=green;2=pink;3=yellow;4=white Contacts: string[]; Creator: string; DateCreated: Date; Flags: MdNoteItemFlags; Height: number; Id: number; IsPrivate: boolean; IsReadOnly: boolean; Left: number; ModifiedTime: Date; TNEFFile: string; Top: number; Width: number; } export interface MdTaskItemFlags extends MdFlags { NOINVITES: boolean; NOTNEF: boolean; SINGLE_OCCURRENCE: boolean; SYNC_USING_UTC: boolean; } export interface MD_TaskItem { ActHours: number; AttachmentCount: number; Attachments: MD_PIMAttachment; Billing: string; Categories: string; CodePage: number; Comment: string; CommentHtml: string; Companies: string; Complete: number; CompletedDate: Date; Creator: string; DAVDataFile: string; DueDate: Date; EstHours: number; Flags: MdTaskItemFlags; Id: number; IsPrivate: boolean; IsReadOnly: boolean; IsRecurring: boolean; Mileage: string; ModifiedTime: Date; Priority: number; Recurrence: MD_RecurrencePattern; Reminder: Date; Revision: number; Sequence: number; StartDate: Date; Status: number; Subject: string; TNEFFile: string; iCalUid: string; } export interface MD_RuleCondition { Header: string; MatchText: string; Relation: 'ISEQUALTO' | 'ISNOTEQUALTO' | 'CONTAINS' | 'DOESNOTCONTAIN' | 'STARTSWITH' | 'ENDSWITH' | 'EXISTS' | 'DOESNOTEXIST' | 'ISGREATERTHAN' | 'ISLESSTHAN'; } export interface MD_Rule { Conditions: Array<MD_RuleCondition>; Email: string; Folder: string; LogicOperator?: 'AND' | 'OR'; // NumConditions > 1 NumConditions: number; } export interface MD_ImapFolderInfo { FolderName: string; FolderPath: string; FolderOwner: string; FolderType: MdFolderClass; } //#endregion MDaemon API types //#region Alias APIs export function MD_CreateAlias(Email: string, Alias: string): boolean; export function MD_DeleteAlias(Alias: string, Email: string): boolean; export function MD_DeleteAllAliases(Email: string): boolean; export function MD_InvalidateAliases(): void; export function MD_IsValidAlias(Alias: string): boolean; /** * UNDOCUMENTED. * * @param Alias Alias to translate. * @param Level Depth (0, -1, -2, -3, ...); default -1 * @returns Either the Level-th translation, or the input. */ export function MD_TranslateAlias(Alias: string, Level?: number): string; //#endregion //#region Application level APIs /** * UNDOCUMENTED * * @param UnknownString */ export function MD_AttachmentLinkingDelete(UnknownString: string): number; /** * UNDOCUMENTED * * @param unknown */ export function MD_ClearSettingsCache(unknown: number): void; /** * UNDOCUMENTED * * @param RootPath * @param Importance 0..99; negative numbers coalesce to 50; numbers greater than 99 coalesce to 99 * @param Prefix * @param Extension OPTIONAL (default ".msg") */ export function MD_CreateFileName(RootPath: string, Importance: number, Prefix: string, Extension?: string): string | undefined; /** * UNDOCUMENTED * * @param Filename name of CSV export file * @param UnkownFlag OPTIONAL default false */ export function MD_ExportAllUsers(Filename: string, UnkownFlag?: boolean): void; export function MD_GetAppDir(): string; /** * UNDOCUMENTED */ export function MD_GetLicensesUsed(): number; /** * UNDOCUMENTED * * @param Family OPTIONAL "AF_INET" (default) or "AF_INET6" */ export function MD_GetMyIPAddresses(Family?: 'AF_INET' | 'AF_INET6'): Array<string>; /** * UNDOCUMENTED */ export function MD_GetSharedListMemberInfo(): MD_ListMember; /** * UNDOCUMENTED */ export function MD_GetSharedUserInfo(): MD_UserInfo; /** * UNDOCUMENTED */ export function MD_InvalidateBadPasswords(): void; /** * UNDOCUMENTED */ export function MD_InvalidateLANIPs(): void; /** * UNDOCUMENTED */ export function MD_IsAVLicenseTooSmall(UserCount: number): boolean; /** * UNDOCUMENTED */ export function MD_IsCloudVersion(): boolean; /** * UNDOCUMENTED * * @param Password */ export function MD_IsDynamicPasswordStr(Password: string): boolean; /** * UNDOCUMENTED */ export function MD_IsProVersion(): boolean; /** * UNDOCUMENTED * * @param Password */ export function MD_IsSecurePasswordStr(Password: string): boolean; /** * UNDOCUMENTED * * @param Address */ export function MD_IsSystemAddress(Address: string): boolean; /** * UNDOCUMENTED */ export function MD_IsTrialVersion(): boolean; /** * UNDOCUMENTED */ export function MD_IsLicenseActive(): boolean; /** * UNDOCUMENTED * * @param Msg * @param wParam * @param lParam */ export function MD_PostAppMessage(Msg: number, wParam: BigInt, lParam: BigInt): void; export function MD_RegisterWindow(hWnd: Buffer): boolean; export function MD_ReloadUsers(): void; /** * UNDOCUMENTED * * @param Msg * @param wParam * @param lParam */ export function MD_SendAppMessage(Msg: number, wParam: BigInt, lParam: BigInt): void; /** * UNDOCUMENTED * * @param GhostCount */ export function MD_SetGhostCount(GhostCount: number): void; /** * UNDOCUMENTED * * @param Flag */ export function MD_SetNotificationFlag(Flag: number): void; /** * UNDOCUMENTED * * @param UnknownString */ export function MD_StripSubAddressedPath(UnknownString: string): string; /** * Unregister a window handle with MDUSER.DLL. * * @param hWnd handle to unregister */ export function MD_UnregisterWindow(hWnd: Buffer): boolean; /** * @summary Get the total number of mailboxes managed by MDaemon in * all domains. * * @returns {number} */ export function MD_UserCount(): number; /** * UNDOCUMENTED */ export function MD_UserLicenseFull(): boolean; //#endregion //#region AppPassword APIs /** * UNDOCUMENTED * * @param hUser * @param AppPassword * * @returns password, if OK; otherwise undefined. */ export function MD_AppPasswordCreate(hUser: Buffer, AppPassword: MD_AppPassword): string | undefined; /** * UNDOCUMENTED * * @param hUser * @param ID */ export function MD_AppPasswordDelete(hUser: Buffer, ID: string): boolean; /** * UNDOCUMENTED * * @param hUser */ export function MD_AppPasswordDeleteAll(hUser: Buffer): boolean; /** * UNDOCUMENTED * * @param hUser */ export function MD_AppPasswordGetAll(hUser: Buffer): Array<MD_AppPassword> | undefined; /** * UNDOCUMENTED * * @param hUser * @param ID */ export function MD_AppPasswordGetByID(hUser: Buffer, ID: string): MD_AppPassword | undefined; /** * UNDOCUMENTED * * @param hUser */ export function MD_AppPasswordGetCount(hUser: Buffer): number | undefined; /** * UNDOCUMENTED * * @param hUser * @param ID * @param NewName */ export function MD_AppPasswordRename(hUser: Buffer, ID: string, NewName: string): boolean; /** * UNDOCUMENTED * * @param hUser */ export function MD_GetRequireAppPassword(hUser: Buffer): boolean; /** * UNDOCUMENTED * * @param hUser * @param Value */ export function MD_SetRequireAppPassword(hUser: Buffer, Value?: boolean): boolean; /** * UNDOCUMENTED * * @param hUser * @param Password * @param IP * * @returns AppPassword ID, if validated; otherwise undefined. */ export function MD_AppPasswordValidate(hUser: Buffer, Password: string, IP: string): string | undefined; //#endregion //#region Authentication APIs /** * Authenticate a user (by e-mail) * * @param Email full e-mail address * @param Password secret * @param IP optional origin * @returns true on successfull authentication; false otherwise */ export function MD_LogonUser(Email: string, Password: string, IP?: string): boolean; /** * Verify a user exists. * * @param address full e-mail address * @returns true if address exists; false otherwise */ export function MD_UserExists(address: string): boolean; export function MD_ValidateUser( hUser: Buffer, Password: string ): boolean; export function MD_VerifyUserInfo( UserInfo: MD_UserInfo, Level?: MdVerifyUserInfoLevel[] ): MdVerifyUserInfoResult; //#endregion //#region Calendar APIs export function MD_CalGetCalItem(Id: number, Path: string, Requester?: string): MdApiResult<MD_CalItem>; export function MD_CalGetDefaultFolder(hUser: Buffer): string; export function MD_CalInitCalItem(): MD_CalItem; export function MD_CalInitCalItem2(Month: number, Day: number, Year: number, Hour: number, Minute: number): MD_CalItem; //#endregion //#region Clustering APIs export function MD_ClusterGetEnabled(): boolean; export function MD_ClusterGetLocalNodeId(): number; export function MD_ClusterGetLocalServerGUID(): string | undefined; export function MD_ClusterGetLocalServerId(): number; export function MD_ClusterGetNodeId(ComputerName: string): number; export function MD_ClusterGetPrimaryComputerName(): string; export function MD_ClusterGetServerGUID(ComputerName: string): string | undefined; export function MD_ClusterGetServerId(ComputerName: string): number; export function MD_ClusterLocalNodeIsPrimary(): boolean; //#endregion //#region Contacts APIs export function MD_ContactDeleteAllItems(Path: string): MdApiResultBase; export function MD_ContactGetAllItems(Path: string): MdApiResult<MD_ContactItem[]>; export function MD_ContactGetBlackListFolder(hUser: Buffer): string; export function MD_ContactGetDefaultFolder(hUser: Buffer): string; export function MD_ContactGetDomainAllowedSendersFolder(DomainName: string): string | undefined; export function MD_ContactGetPublicFolder(hUser: Buffer): string; export function MD_ContactGetWhiteListFolder(hUser: Buffer): string; export function MD_ContactInitItem(): MD_ContactItem; export function MD_ContactPubAllowedSendersCheck(Path: string, Sender: string): boolean; //#endregion //#region Document APIs export function MD_DocumentDeleteDocument(Path: string, Id: number, Requester?: string): boolean; export function MD_DocumentGetDefaultFolder(hUser: Buffer): string; export function MD_DocumentGetDescription(Path: string, Id: number, Requester?: string): string | undefined; export function MD_DocumentGetFileName(Path: string, Id: number, Requester?: string): string | undefined; export function MD_DocumentGetFileSize(Path: string, Id: number, Requester?: string): BigInt | undefined export function MD_DocumentGetModifiedBy(Path: string, Id: number, Requester?: string): string | undefined export function MD_DocumentGetModifiedTime(Path: string, Id: number, Requester?: string): Date | undefined export interface MdDocumentCopyDocumentOptions { MoveInsteadOfCopy?: boolean; OverwriteExisting?: boolean; Requester?: string; } export function MD_DocumentCopyDocument( SrcPath: string, Id: number, DestPath: string, Options?: MdDocumentCopyDocumentOptions ): boolean; export interface MdDocumentCopyFileIntoFolderOptions { Description?: string; OverwriteExisting?: boolean; Requester?: string; } export function MD_DocumentCopyFileIntoFolder( InputFile: string, DestPath: string, NewFileName: string, ModifiedBy: string, Options?: MdDocumentCopyFileIntoFolderOptions ): boolean; export interface MdGetMultipleItemsResponse extends MdApiResultBase { IDs?: number[], ItemCount: number, Page: number, Path: string, Sort: 'ASC' | 'DESC', } export function MD_DocumentGetMultipleItems( Page: number, ItemCount: number, Sort: 'ASC' | 'DESC', Path: string, Search?: string, Requester?: string ): MdGetMultipleItemsResponse; export function MD_DocumentRenameDocument( Path: string, I