@emailcheck/email-validator-js 3.0.1-beta.0 → 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.
Files changed (40) hide show
  1. package/README.md +176 -24
  2. package/dist/adapters/lru-adapter.d.ts +2 -2
  3. package/dist/adapters/redis-adapter.d.ts +4 -4
  4. package/dist/batch-verifier.d.ts +5 -0
  5. package/dist/cache-interface.d.ts +23 -16
  6. package/dist/cache.d.ts +5 -5
  7. package/dist/check-if-email-exists.d.ts +205 -0
  8. package/dist/domain-suggester.d.ts +6 -6
  9. package/dist/{validator.d.ts → email-validator.d.ts} +2 -2
  10. package/dist/email-verifier-types.d.ts +225 -0
  11. package/dist/index.d.ts +8 -8
  12. package/dist/index.esm.js +457 -236
  13. package/dist/index.esm.js.map +1 -1
  14. package/dist/index.js +460 -238
  15. package/dist/index.js.map +1 -1
  16. package/dist/mx-resolver.d.ts +2 -0
  17. package/dist/name-detector.d.ts +6 -6
  18. package/dist/serverless/adapters/aws-lambda.cjs.js.map +1 -1
  19. package/dist/serverless/adapters/aws-lambda.esm.js.map +1 -1
  20. package/dist/serverless/adapters/cloudflare.cjs.js.map +1 -1
  21. package/dist/serverless/adapters/cloudflare.esm.js.map +1 -1
  22. package/dist/serverless/adapters/vercel.cjs.js.map +1 -1
  23. package/dist/serverless/adapters/vercel.esm.js.map +1 -1
  24. package/dist/serverless/index.cjs.js.map +1 -1
  25. package/dist/serverless/index.d.ts +1 -1
  26. package/dist/serverless/index.esm.js.map +1 -1
  27. package/dist/serverless/{core.cjs.js → verifier.cjs.js} +1 -1
  28. package/dist/serverless/verifier.cjs.js.map +1 -0
  29. package/dist/serverless/{core.esm.js → verifier.esm.js} +1 -1
  30. package/dist/serverless/verifier.esm.js.map +1 -0
  31. package/dist/{smtp.d.ts → smtp-verifier.d.ts} +2 -2
  32. package/dist/types.d.ts +128 -34
  33. package/dist/whois.d.ts +3 -3
  34. package/package.json +19 -19
  35. package/dist/batch.d.ts +0 -5
  36. package/dist/dns.d.ts +0 -2
  37. package/dist/serverless/core.cjs.js.map +0 -1
  38. package/dist/serverless/core.esm.js.map +0 -1
  39. /package/dist/serverless/{core.d.ts → verifier.d.ts} +0 -0
  40. /package/dist/serverless/{core.min.js → verifier.min.js} +0 -0
@@ -1,8 +1,8 @@
1
- import type { ICache } from './cache-interface';
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?: ICache | null): Promise<boolean>;
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 IDisposableEmailParams, type IFreeEmailParams, type IVerifyEmailParams, type VerificationResult } from './types';
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 { COMMON_EMAIL_DOMAINS, defaultDomainSuggestionMethod, getDomainSimilarity, isCommonDomain, suggestDomain, suggestEmailDomain, } from './domain-suggester';
8
- export { cleanNameForAlgrothin, defaultNameDetectionMethod, detectName, detectNameForAlgrothin, detectNameFromEmail, } from './name-detector';
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: IDisposableEmailParams): Promise<boolean>;
13
- export declare function isFreeEmail(params: IFreeEmailParams): Promise<boolean>;
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: IVerifyEmailParams): Promise<VerificationResult>;
18
+ export declare function verifyEmail(params: VerifyEmailParams): Promise<VerificationResult>;