@mikkelscheike/email-provider-links
Version:
TypeScript library for email provider detection with 93 providers (207 domains), concurrent DNS resolution, optimized performance, 94.65% test coverage, and enterprise security for login and password reset flows
86 lines • 2.39 kB
TypeScript
/**
* Provider Data Schema
*
* This represents the compressed format for provider data
* designed to reduce file size and improve parsing performance.
*/
/**
* Provider interface
* Uses compact field names for smaller JSON size
*/
/**
* Provider types:
* - public_provider: Regular email providers (Gmail, Yahoo, etc.)
* - custom_provider: Business email services (Google Workspace, Microsoft 365)
* - proxy_service: Email proxy services (Cloudflare, etc.)
*/
export type ProviderType = 'public_provider' | 'custom_provider' | 'proxy_service';
export interface Provider {
/** Provider ID (short identifier) */
id: string;
/** Provider display name */
companyProvider: string;
/** Login/webmail URL (or null if not available) */
loginUrl: string | null;
/** Email domains (omitted if empty) */
domains?: string[];
/** DNS detection patterns (flattened) */
mx?: string[];
txt?: string[];
/** Provider type */
type: ProviderType;
/** Alias rules for username part */
alias?: {
dots?: {
ignore: boolean;
strip: boolean;
};
plus?: {
ignore: boolean;
strip: boolean;
};
case?: {
ignore: boolean;
strip: boolean;
};
};
}
/**
* Providers file structure
*/
export interface ProvidersData {
/** Schema version for future migrations */
version: string;
/** Compressed providers array */
providers: Provider[];
/** Metadata */
meta: {
count: number;
domains: number;
generated: string;
};
}
/**
* Common TXT pattern prefixes that can be compressed
*/
export declare const TXT_PATTERN_COMPRESSION: {
readonly 'v=spf1 include:': "spf:";
readonly 'v=spf1 ': "spf1:";
readonly 'google-site-verification=': "gsv:";
readonly 'MS=ms': "ms";
readonly 'zoho-verification=': "zv:";
readonly 'mailgun-verification=': "mv:";
};
/**
* Compress TXT patterns by removing common prefixes
*/
export declare function compressTxtPattern(pattern: string): string;
/**
* Decompress TXT patterns by restoring prefixes
*/
export declare function decompressTxtPattern(compressed: string): string;
/**
* Validation schema for providers
*/
export declare function validateProvider(provider: Provider): string[];
//# sourceMappingURL=schema.d.ts.map