@emailcheck/email-validator-js 2.14.2 → 3.0.1-beta.1
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/README.md +279 -18
- package/dist/adapters/lru-adapter.d.ts +2 -2
- package/dist/adapters/redis-adapter.d.ts +4 -4
- package/dist/batch-verifier.d.ts +5 -0
- package/dist/cache-interface.d.ts +23 -15
- package/dist/cache.d.ts +7 -5
- package/dist/check-if-email-exists.d.ts +205 -0
- package/dist/domain-suggester.d.ts +6 -6
- package/dist/{validator.d.ts → email-validator.d.ts} +2 -2
- package/dist/email-verifier-types.d.ts +225 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.esm.js +779 -266
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +783 -268
- package/dist/index.js.map +1 -1
- package/dist/mx-resolver.d.ts +2 -0
- package/dist/name-detector.d.ts +6 -6
- package/dist/serverless/adapters/aws-lambda.cjs.js.map +1 -1
- package/dist/serverless/adapters/aws-lambda.esm.js.map +1 -1
- package/dist/serverless/adapters/cloudflare.cjs.js.map +1 -1
- package/dist/serverless/adapters/cloudflare.esm.js.map +1 -1
- package/dist/serverless/adapters/vercel.cjs.js.map +1 -1
- package/dist/serverless/adapters/vercel.esm.js.map +1 -1
- package/dist/serverless/index.cjs.js.map +1 -1
- package/dist/serverless/index.d.ts +1 -1
- package/dist/serverless/index.esm.js.map +1 -1
- package/dist/serverless/{core.cjs.js → verifier.cjs.js} +1 -1
- package/dist/serverless/verifier.cjs.js.map +1 -0
- package/dist/serverless/{core.esm.js → verifier.esm.js} +1 -1
- package/dist/serverless/verifier.esm.js.map +1 -0
- package/dist/smtp-verifier.d.ts +7 -0
- package/dist/types.d.ts +170 -28
- package/dist/whois.d.ts +3 -3
- package/package.json +19 -19
- package/dist/batch.d.ts +0 -5
- package/dist/dns.d.ts +0 -2
- package/dist/serverless/core.cjs.js.map +0 -1
- package/dist/serverless/core.esm.js.map +0 -1
- package/dist/smtp.d.ts +0 -2
- /package/dist/serverless/{core.d.ts → verifier.d.ts} +0 -0
- /package/dist/serverless/{core.min.js → verifier.min.js} +0 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import type { Cache } from './cache-interface';
|
|
2
|
+
import { CheckIfEmailExistsCoreParams, CheckIfEmailExistsCoreResult, CheckIfEmailExistsSmtpOptions, EmailProvider, type EmailSyntaxResult, HeadlessOptions, MxLookupResult, SmtpVerificationResult, YahooApiOptions } from './email-verifier-types';
|
|
3
|
+
export declare const checkIfEmailExistsConstants: {
|
|
4
|
+
gmailDomains: string[];
|
|
5
|
+
yahooDomains: string[];
|
|
6
|
+
hotmailDomains: string[];
|
|
7
|
+
defaultTimeout: number;
|
|
8
|
+
defaultSmtpPort: number;
|
|
9
|
+
defaultFromEmail: string;
|
|
10
|
+
defaultHelloName: string;
|
|
11
|
+
};
|
|
12
|
+
export { EmailProvider, SmtpVerificationResult, MxLookupResult, CheckIfEmailExistsCoreResult, CheckIfEmailExistsSmtpOptions, YahooApiOptions, HeadlessOptions, CheckIfEmailExistsCoreParams, };
|
|
13
|
+
/**
|
|
14
|
+
* Extended interface for our implementation
|
|
15
|
+
*/
|
|
16
|
+
export interface CheckIfEmailExistsCoreParamsExtended extends CheckIfEmailExistsCoreParams {
|
|
17
|
+
cache?: Cache | null;
|
|
18
|
+
smtpTimeout?: number;
|
|
19
|
+
fromEmail?: string;
|
|
20
|
+
helloName?: string;
|
|
21
|
+
smtpOptions?: CheckIfEmailExistsSmtpOptions;
|
|
22
|
+
enableProviderOptimizations?: boolean;
|
|
23
|
+
useYahooApi?: boolean;
|
|
24
|
+
useYahooHeadless?: boolean;
|
|
25
|
+
yahooApiOptions?: YahooApiOptions;
|
|
26
|
+
headlessOptions?: HeadlessOptions;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Enhanced syntax validation with RFC 5321 compliance
|
|
30
|
+
*/
|
|
31
|
+
export declare function validateEmailSyntax(email: string): EmailSyntaxResult;
|
|
32
|
+
/**
|
|
33
|
+
* Provider detection functions matching the original Rust implementation
|
|
34
|
+
*/
|
|
35
|
+
export declare function isGmail(host: string): boolean;
|
|
36
|
+
export declare function isYahoo(host: string): boolean;
|
|
37
|
+
export declare function isHotmailB2C(host: string): boolean;
|
|
38
|
+
export declare function isHotmailB2B(host: string): boolean;
|
|
39
|
+
export declare function isProofpoint(host: string): boolean;
|
|
40
|
+
export declare function isMimecast(host: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Provider detection from MX host (matching original implementation)
|
|
43
|
+
*/
|
|
44
|
+
export declare function getProviderFromMxHost(host: string): EmailProvider;
|
|
45
|
+
/**
|
|
46
|
+
* Get provider type for known email providers (legacy function)
|
|
47
|
+
*/
|
|
48
|
+
export declare function getProviderType(domain: string): EmailProvider;
|
|
49
|
+
/**
|
|
50
|
+
* Enhanced MX record lookup with caching support
|
|
51
|
+
*/
|
|
52
|
+
export declare function queryMxRecords(domain: string, options?: {
|
|
53
|
+
timeout?: number;
|
|
54
|
+
cache?: Cache | null;
|
|
55
|
+
}): Promise<MxLookupResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Enhanced SMTP verification with provider-specific logic and catch-all detection
|
|
58
|
+
*/
|
|
59
|
+
export declare function verifySmtpConnection(email: string, domain: string, mxHost: string, options?: {
|
|
60
|
+
timeout?: number;
|
|
61
|
+
fromEmail?: string;
|
|
62
|
+
helloName?: string;
|
|
63
|
+
port?: number;
|
|
64
|
+
retries?: number;
|
|
65
|
+
useStartTls?: boolean;
|
|
66
|
+
proxy?: any;
|
|
67
|
+
}, providerType?: EmailProvider): Promise<SmtpVerificationResult>;
|
|
68
|
+
/**
|
|
69
|
+
* Main function to check if an email
|
|
70
|
+
*/
|
|
71
|
+
export declare function checkIfEmailExistsCore(params: CheckIfEmailExistsCoreParamsExtended): Promise<CheckIfEmailExistsCoreResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Yahoo API verification using HTTP requests to Yahoo signup endpoints
|
|
74
|
+
* This replicates the functionality from the original Rust implementation's yahoo/api.rs
|
|
75
|
+
*/
|
|
76
|
+
declare function verifyYahooApi(email: string, options?: YahooApiOptions): Promise<{
|
|
77
|
+
isValid: boolean;
|
|
78
|
+
isDeliverable: boolean;
|
|
79
|
+
error?: string;
|
|
80
|
+
details?: any;
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Generic headless browser automation for email verification
|
|
84
|
+
* Based on the original Rust implementation's headless functionality
|
|
85
|
+
*/
|
|
86
|
+
interface HeadlessBrowserResult {
|
|
87
|
+
success: boolean;
|
|
88
|
+
email_exists?: boolean;
|
|
89
|
+
screenshot?: string;
|
|
90
|
+
error?: string;
|
|
91
|
+
details?: any;
|
|
92
|
+
}
|
|
93
|
+
declare class HeadlessBrowser {
|
|
94
|
+
private webdriverEndpoint;
|
|
95
|
+
private timeout;
|
|
96
|
+
private retryAttempts;
|
|
97
|
+
constructor(options?: HeadlessOptions);
|
|
98
|
+
/**
|
|
99
|
+
* Create a new browser session
|
|
100
|
+
*/
|
|
101
|
+
private createSession;
|
|
102
|
+
/**
|
|
103
|
+
* Navigate to a URL
|
|
104
|
+
*/
|
|
105
|
+
private navigate;
|
|
106
|
+
/**
|
|
107
|
+
* Take a screenshot
|
|
108
|
+
*/
|
|
109
|
+
private takeScreenshot;
|
|
110
|
+
/**
|
|
111
|
+
* Execute JavaScript in the browser
|
|
112
|
+
*/
|
|
113
|
+
private executeScript;
|
|
114
|
+
/**
|
|
115
|
+
* Find an element
|
|
116
|
+
*/
|
|
117
|
+
private findElement;
|
|
118
|
+
/**
|
|
119
|
+
* Type text into an element
|
|
120
|
+
*/
|
|
121
|
+
private typeText;
|
|
122
|
+
/**
|
|
123
|
+
* Click an element
|
|
124
|
+
*/
|
|
125
|
+
private clickElement;
|
|
126
|
+
/**
|
|
127
|
+
* Wait for an element to be present
|
|
128
|
+
*/
|
|
129
|
+
private waitForElement;
|
|
130
|
+
/**
|
|
131
|
+
* Delete the browser session
|
|
132
|
+
*/
|
|
133
|
+
private deleteSession;
|
|
134
|
+
/**
|
|
135
|
+
* Generic headless verification method
|
|
136
|
+
*/
|
|
137
|
+
verifyEmail(email: string, verificationSteps: Array<{
|
|
138
|
+
url: string;
|
|
139
|
+
actions: Array<{
|
|
140
|
+
type: 'navigate' | 'waitFor' | 'type' | 'click' | 'execute';
|
|
141
|
+
selector?: string;
|
|
142
|
+
text?: string;
|
|
143
|
+
script?: string;
|
|
144
|
+
using?: string;
|
|
145
|
+
timeout?: number;
|
|
146
|
+
}>;
|
|
147
|
+
successIndicators?: string[];
|
|
148
|
+
errorIndicators?: string[];
|
|
149
|
+
}>, screenshot?: boolean): Promise<HeadlessBrowserResult>;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Yahoo headless verification using browser automation
|
|
153
|
+
*/
|
|
154
|
+
declare function verifyYahooHeadless(email: string, options?: HeadlessOptions): Promise<HeadlessBrowserResult>;
|
|
155
|
+
/**
|
|
156
|
+
* Gmail headless verification using browser automation
|
|
157
|
+
*/
|
|
158
|
+
declare function verifyGmailHeadless(email: string, options?: HeadlessOptions): Promise<HeadlessBrowserResult>;
|
|
159
|
+
/**
|
|
160
|
+
* Provider-specific SMTP error parsing and analysis
|
|
161
|
+
* Based on the original Rust implementation's error parsing modules
|
|
162
|
+
*/
|
|
163
|
+
export interface ParsedSmtpError {
|
|
164
|
+
type: 'disabled' | 'full_inbox' | 'unknown' | 'invalid' | 'catch_all' | 'rate_limited' | 'blocked';
|
|
165
|
+
severity: 'permanent' | 'temporary' | 'unknown';
|
|
166
|
+
message: string;
|
|
167
|
+
originalMessage: string;
|
|
168
|
+
providerSpecific?: {
|
|
169
|
+
code?: string;
|
|
170
|
+
action?: string;
|
|
171
|
+
details?: string;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
declare class SmtpErrorParser {
|
|
175
|
+
/**
|
|
176
|
+
* Parse SMTP error messages with provider-specific context
|
|
177
|
+
*/
|
|
178
|
+
static parseError(smtpMessage: string, provider: EmailProvider, responseCode?: number): ParsedSmtpError;
|
|
179
|
+
/**
|
|
180
|
+
* Parse generic SMTP error patterns
|
|
181
|
+
*/
|
|
182
|
+
private static parseGenericErrors;
|
|
183
|
+
/**
|
|
184
|
+
* Parse Gmail-specific SMTP errors
|
|
185
|
+
*/
|
|
186
|
+
private static parseGmailError;
|
|
187
|
+
/**
|
|
188
|
+
* Parse Yahoo-specific SMTP errors
|
|
189
|
+
*/
|
|
190
|
+
private static parseYahooError;
|
|
191
|
+
/**
|
|
192
|
+
* Parse Hotmail/Outlook-specific SMTP errors
|
|
193
|
+
*/
|
|
194
|
+
private static parseHotmailError;
|
|
195
|
+
/**
|
|
196
|
+
* Parse Proofpoint-specific SMTP errors
|
|
197
|
+
*/
|
|
198
|
+
private static parseProofpointError;
|
|
199
|
+
/**
|
|
200
|
+
* Parse Mimecast-specific SMTP errors
|
|
201
|
+
*/
|
|
202
|
+
private static parseMimecastError;
|
|
203
|
+
}
|
|
204
|
+
export { verifyYahooApi, verifyYahooHeadless, verifyGmailHeadless, SmtpErrorParser };
|
|
205
|
+
export { HeadlessBrowser };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { DomainSuggestion,
|
|
1
|
+
import type { Cache } from './cache-interface';
|
|
2
|
+
import type { DomainSuggestion, DomainSuggestionParams } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* List of common email domains for typo detection
|
|
5
5
|
* Includes popular free providers, business providers, and hosting services
|
|
6
6
|
*/
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const commonEmailDomains: string[];
|
|
8
8
|
/**
|
|
9
9
|
* Default domain suggestion method using string similarity (sync version)
|
|
10
10
|
*/
|
|
@@ -12,13 +12,13 @@ export declare function defaultDomainSuggestionMethod(domain: string, commonDoma
|
|
|
12
12
|
/**
|
|
13
13
|
* Async version of default domain suggestion method
|
|
14
14
|
*/
|
|
15
|
-
export declare function defaultDomainSuggestionMethodAsync(domain: string, commonDomains?: string[], cache?:
|
|
15
|
+
export declare function defaultDomainSuggestionMethodAsync(domain: string, commonDomains?: string[], cache?: Cache): Promise<DomainSuggestion | null>;
|
|
16
16
|
/**
|
|
17
17
|
* Suggest a corrected domain for a potentially misspelled email domain
|
|
18
18
|
* @param params - Parameters including domain and optional custom method
|
|
19
19
|
* @returns Domain suggestion with confidence score, or null if no suggestion
|
|
20
20
|
*/
|
|
21
|
-
export declare function suggestDomain(params:
|
|
21
|
+
export declare function suggestDomain(params: DomainSuggestionParams): DomainSuggestion | null;
|
|
22
22
|
/**
|
|
23
23
|
* Convenience function to suggest domain from email address
|
|
24
24
|
* @param email - Email address to check for domain typos
|
|
@@ -26,7 +26,7 @@ export declare function suggestDomain(params: ISuggestDomainParams): DomainSugge
|
|
|
26
26
|
* @param cache - Optional cache instance
|
|
27
27
|
* @returns Domain suggestion with confidence score, or null if no suggestion
|
|
28
28
|
*/
|
|
29
|
-
export declare function suggestEmailDomain(email: string, commonDomains?: string[], cache?:
|
|
29
|
+
export declare function suggestEmailDomain(email: string, commonDomains?: string[], cache?: Cache): Promise<DomainSuggestion | null>;
|
|
30
30
|
/**
|
|
31
31
|
* Check if a domain is in the common domains list
|
|
32
32
|
* @param domain - Domain to check
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Cache } from './cache-interface';
|
|
2
2
|
/**
|
|
3
3
|
* Validates if email domain is valid TLD
|
|
4
4
|
*/
|
|
5
|
-
export declare function isValidEmailDomain(emailOrDomain: string, cache?:
|
|
5
|
+
export declare function isValidEmailDomain(emailOrDomain: string, cache?: Cache | null): Promise<boolean>;
|
|
6
6
|
/**
|
|
7
7
|
* Validates email address format using RFC-compliant regex
|
|
8
8
|
* @param emailAddress - The email address to validate
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for email verification functionality
|
|
3
|
+
* Based on the original Rust implementation's type structure
|
|
4
|
+
*/
|
|
5
|
+
import type { Cache } from './cache-interface';
|
|
6
|
+
/**
|
|
7
|
+
* Email providers with enhanced type safety
|
|
8
|
+
*/
|
|
9
|
+
export declare enum EmailProvider {
|
|
10
|
+
gmail = "gmail",
|
|
11
|
+
hotmailB2b = "hotmail_b2b",
|
|
12
|
+
hotmailB2c = "hotmail_b2c",
|
|
13
|
+
proofpoint = "proofpoint",
|
|
14
|
+
mimecast = "mimecast",
|
|
15
|
+
yahoo = "yahoo",
|
|
16
|
+
everythingElse = "everything_else"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Provider-specific configuration and capabilities
|
|
20
|
+
*/
|
|
21
|
+
export interface ProviderConfig {
|
|
22
|
+
provider: EmailProvider;
|
|
23
|
+
domains: readonly string[];
|
|
24
|
+
capabilities: {
|
|
25
|
+
plusAddressing: boolean;
|
|
26
|
+
dotsSignificant: boolean;
|
|
27
|
+
underscoresAllowed: boolean;
|
|
28
|
+
maxLocalLength: number;
|
|
29
|
+
supportsApi: boolean;
|
|
30
|
+
supportsHeadless: boolean;
|
|
31
|
+
};
|
|
32
|
+
smtpSettings: {
|
|
33
|
+
preferredPorts: readonly number[];
|
|
34
|
+
connectTimeout: number;
|
|
35
|
+
readTimeout: number;
|
|
36
|
+
requiresTls?: boolean;
|
|
37
|
+
customHeaders?: Record<string, string>;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* SMTP verification result with enhanced typing
|
|
42
|
+
*/
|
|
43
|
+
export interface SmtpVerificationResult {
|
|
44
|
+
canConnectSmtp: boolean;
|
|
45
|
+
hasFullInbox: boolean;
|
|
46
|
+
isCatchAll: boolean;
|
|
47
|
+
isDeliverable: boolean;
|
|
48
|
+
isDisabled: boolean;
|
|
49
|
+
error?: string;
|
|
50
|
+
providerUsed?: EmailProvider;
|
|
51
|
+
success?: boolean;
|
|
52
|
+
canConnect?: boolean;
|
|
53
|
+
responseCode?: number;
|
|
54
|
+
providerSpecific?: {
|
|
55
|
+
errorCode?: string;
|
|
56
|
+
actionRequired?: string;
|
|
57
|
+
details?: string;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* MX record lookup result
|
|
62
|
+
*/
|
|
63
|
+
export interface MxLookupResult {
|
|
64
|
+
success: boolean;
|
|
65
|
+
records: Array<{
|
|
66
|
+
exchange: string;
|
|
67
|
+
priority: number;
|
|
68
|
+
}>;
|
|
69
|
+
lowestPriority?: {
|
|
70
|
+
exchange: string;
|
|
71
|
+
priority: number;
|
|
72
|
+
};
|
|
73
|
+
error?: string;
|
|
74
|
+
code?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Email syntax validation result
|
|
78
|
+
*/
|
|
79
|
+
export interface EmailSyntaxResult {
|
|
80
|
+
isValid: boolean;
|
|
81
|
+
email?: string;
|
|
82
|
+
localPart?: string;
|
|
83
|
+
domain?: string;
|
|
84
|
+
error?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Complete check-if-email-exists result
|
|
88
|
+
*/
|
|
89
|
+
export interface CheckIfEmailExistsCoreResult {
|
|
90
|
+
email: string;
|
|
91
|
+
isReachable: 'safe' | 'invalid' | 'risky' | 'unknown';
|
|
92
|
+
syntax: {
|
|
93
|
+
isValid: boolean;
|
|
94
|
+
domain?: string;
|
|
95
|
+
localPart?: string;
|
|
96
|
+
error?: string;
|
|
97
|
+
};
|
|
98
|
+
mx: MxLookupResult | null;
|
|
99
|
+
smtp: SmtpVerificationResult | null;
|
|
100
|
+
misc: {
|
|
101
|
+
isDisposable: boolean;
|
|
102
|
+
isFree: boolean;
|
|
103
|
+
providerType: EmailProvider;
|
|
104
|
+
} | null;
|
|
105
|
+
duration: number;
|
|
106
|
+
error?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* SMTP connection options with enhanced typing
|
|
110
|
+
*/
|
|
111
|
+
export interface CheckIfEmailExistsSmtpOptions {
|
|
112
|
+
timeout?: number;
|
|
113
|
+
port?: number;
|
|
114
|
+
retries?: number;
|
|
115
|
+
fromEmail?: string;
|
|
116
|
+
helloName?: string;
|
|
117
|
+
useStartTls?: boolean;
|
|
118
|
+
useSsl?: boolean;
|
|
119
|
+
hostName?: string;
|
|
120
|
+
rejectUnauthorized?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Yahoo API verification options
|
|
124
|
+
*/
|
|
125
|
+
export interface YahooApiOptions {
|
|
126
|
+
timeout?: number;
|
|
127
|
+
userAgent?: string;
|
|
128
|
+
retryAttempts?: number;
|
|
129
|
+
proxyUrl?: string;
|
|
130
|
+
headers?: Record<string, string>;
|
|
131
|
+
apiUrl?: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Headless browser verification options
|
|
135
|
+
*/
|
|
136
|
+
export interface HeadlessOptions {
|
|
137
|
+
webdriverEndpoint?: string;
|
|
138
|
+
timeout?: number;
|
|
139
|
+
retryAttempts?: number;
|
|
140
|
+
screenshot?: boolean;
|
|
141
|
+
viewport?: {
|
|
142
|
+
width: number;
|
|
143
|
+
height: number;
|
|
144
|
+
};
|
|
145
|
+
userAgent?: string;
|
|
146
|
+
acceptInsecureCerts?: boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Error parsing types
|
|
150
|
+
*/
|
|
151
|
+
export interface ParsedSmtpError {
|
|
152
|
+
type: 'disabled' | 'full_inbox' | 'unknown' | 'invalid' | 'catch_all' | 'rate_limited' | 'blocked';
|
|
153
|
+
severity: 'permanent' | 'temporary' | 'unknown';
|
|
154
|
+
message: string;
|
|
155
|
+
originalMessage: string;
|
|
156
|
+
providerSpecific?: {
|
|
157
|
+
code?: string;
|
|
158
|
+
action?: string;
|
|
159
|
+
details?: string;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Enhanced verification parameters
|
|
164
|
+
*/
|
|
165
|
+
export interface CheckIfEmailExistsCoreParams {
|
|
166
|
+
emailAddress: string;
|
|
167
|
+
timeout?: number;
|
|
168
|
+
verifyMx?: boolean;
|
|
169
|
+
verifySmtp?: boolean;
|
|
170
|
+
debug?: boolean;
|
|
171
|
+
checkDisposable?: boolean;
|
|
172
|
+
checkFree?: boolean;
|
|
173
|
+
cache?: Cache | null;
|
|
174
|
+
smtpTimeout?: number;
|
|
175
|
+
fromEmail?: string;
|
|
176
|
+
helloName?: string;
|
|
177
|
+
smtpOptions?: CheckIfEmailExistsSmtpOptions;
|
|
178
|
+
enableProviderOptimizations?: boolean;
|
|
179
|
+
useYahooApi?: boolean;
|
|
180
|
+
useYahooHeadless?: boolean;
|
|
181
|
+
yahooApiOptions?: YahooApiOptions;
|
|
182
|
+
useHeadless?: boolean;
|
|
183
|
+
headlessOptions?: HeadlessOptions;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Test-specific types
|
|
187
|
+
*/
|
|
188
|
+
export interface EmailTestCase {
|
|
189
|
+
email: string;
|
|
190
|
+
expected: {
|
|
191
|
+
syntax: {
|
|
192
|
+
isValid: boolean;
|
|
193
|
+
domain?: string;
|
|
194
|
+
localPart?: string;
|
|
195
|
+
};
|
|
196
|
+
provider?: EmailProvider;
|
|
197
|
+
isDeliverable?: boolean;
|
|
198
|
+
error?: string;
|
|
199
|
+
};
|
|
200
|
+
description?: string;
|
|
201
|
+
category: 'valid' | 'invalid' | 'edge_case' | 'provider_specific';
|
|
202
|
+
}
|
|
203
|
+
export interface MockSmtpServer {
|
|
204
|
+
domain: string;
|
|
205
|
+
provider: EmailProvider;
|
|
206
|
+
responses: Map<string, {
|
|
207
|
+
code: number;
|
|
208
|
+
message: string;
|
|
209
|
+
}>;
|
|
210
|
+
connected: boolean;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Performance metrics
|
|
214
|
+
*/
|
|
215
|
+
export interface VerificationMetrics {
|
|
216
|
+
duration: number;
|
|
217
|
+
steps: {
|
|
218
|
+
syntax: number;
|
|
219
|
+
mx: number;
|
|
220
|
+
smtp: number;
|
|
221
|
+
misc: number;
|
|
222
|
+
};
|
|
223
|
+
cache_hits: number;
|
|
224
|
+
cache_misses: number;
|
|
225
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type DisposableEmailCheckParams, type FreeEmailCheckParams, type VerificationResult, type VerifyEmailParams } from './types';
|
|
2
2
|
export * from './adapters/lru-adapter';
|
|
3
3
|
export * from './adapters/redis-adapter';
|
|
4
|
-
export { verifyEmailBatch } from './batch';
|
|
4
|
+
export { verifyEmailBatch } from './batch-verifier';
|
|
5
5
|
export * from './cache';
|
|
6
6
|
export * from './cache-interface';
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
7
|
+
export { commonEmailDomains, defaultDomainSuggestionMethod, getDomainSimilarity, isCommonDomain, suggestDomain, suggestEmailDomain, } from './domain-suggester';
|
|
8
|
+
export { isValidEmail, isValidEmailDomain } from './email-validator';
|
|
9
|
+
export { cleanNameForAlgorithm, defaultNameDetectionMethod, detectName, detectNameForAlgorithm, detectNameFromEmail, } from './name-detector';
|
|
9
10
|
export * from './types';
|
|
10
|
-
export { isValidEmail, isValidEmailDomain } from './validator';
|
|
11
11
|
export { getDomainAge, getDomainRegistrationStatus } from './whois';
|
|
12
|
-
export declare function isDisposableEmail(params:
|
|
13
|
-
export declare function isFreeEmail(params:
|
|
12
|
+
export declare function isDisposableEmail(params: DisposableEmailCheckParams): Promise<boolean>;
|
|
13
|
+
export declare function isFreeEmail(params: FreeEmailCheckParams): Promise<boolean>;
|
|
14
14
|
export declare const domainPorts: Record<string, number>;
|
|
15
15
|
/**
|
|
16
16
|
* Verify email address
|
|
17
17
|
*/
|
|
18
|
-
export declare function verifyEmail(params:
|
|
18
|
+
export declare function verifyEmail(params: VerifyEmailParams): Promise<VerificationResult>;
|