export type TyMailDomain = `@${string}.${string}`; export type TyMailAddress = `${string}${TyMailDomain}`; export type TyParticipant = { address?: TyMailAddress; // "leodevbro@gmail.com" name?: string; // "Levan Katsadze" group?: any[]; }; export type TyParticipationFamilyInfo = { html: string; // 'Levan Katsadze <leodevbro@gmail.com>' text: string; // general info // '"Levan Katsadze" ' value?: TyParticipant[]; }; export type TyGmailMailHeadersAsObj = { "x-gm-thrid"?: string; // "1786467213154837659" "x-gmail-labels"?: string; // "Sent,Opened" "mime-version"?: string; // "1.0" references?: string[]; // ["", "", ] "in-reply-to"?: string; // "" "content-type"?: { value: string; // "multipart/alternative" params: { boundary: string; // "000000000000100d3c060dafb0ca" }; }; subject?: string; // "Re: Find the most frequent sender - gmail" // "message-id": undefined | null | `${"<"}${string}${">"}`; // "" date?: Date; // Date object which can be converted to ISO format string: "2023-12-30T01:01:24.000Z", // from?: TyParticipationFamilyInfo; to?: TyParticipationFamilyInfo; "delivered-to"?: TyParticipationFamilyInfo; cc?: TyParticipationFamilyInfo; bcc?: TyParticipationFamilyInfo; }; export type TyKeyOfMboxMailHeaders = keyof TyGmailMailHeadersAsObj; export type TyValueOfMboxMailHeaders = TyGmailMailHeadersAsObj[TyKeyOfMboxMailHeaders]; type TyDeepHintsOfHeadersMap = { get: < TKey extends TyKeyOfMboxMailHeaders, TVal = TyGmailMailHeadersAsObj[TKey], >( key: TKey, ) => TVal; }; export type TyMboxMailHeaders = TyDeepHintsOfHeadersMap & Map; type TyParticipationData = Pick< TyGmailMailHeadersAsObj, "from" | "to" | "cc" | "bcc" // | "delivered-to" >; export type TyFamilyKind = keyof TyParticipationData; type TyMajorData = Pick; export type TyMainInfoForMail = TyParticipationData & TyMajorData; // zen/Zen means normalized, simplified, cleaned, to avoid runtime errors export type TyZenParticipant = { address: string; // "leodevbro@gmail.com" | "()" as empty name: string; // "Levan Katsadze" | "()" as empty }; // zen/Zen means normalized, simplified, cleaned, to avoid runtime errors export type TyZenParticipationData = { from: TyZenParticipant[]; zenTo: TyZenParticipant[]; // combination of "to" and "delivered-to" cc: TyZenParticipant[]; bcc: TyZenParticipant[]; }; export type TyZenFamilyKind = keyof TyZenParticipationData; export type TyZenMainInfoForMail = TyZenParticipationData & TyMajorData;