@emailcheck/email-validator-js 4.0.0-beta.1 → 4.0.0-beta.3
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 +35 -0
- package/dist/cli/index.js +103 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +130 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +130 -7
- package/dist/index.js.map +1 -1
- package/dist/refine-reason.d.ts +1 -0
- 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/index.cjs.js.map +1 -1
- package/dist/serverless/index.esm.js.map +1 -1
- package/dist/types.d.ts +28 -19
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Cache } from './cache-interface';
|
|
2
|
-
/**
|
|
3
|
-
* Error codes for email verification failures
|
|
4
|
-
*/
|
|
2
|
+
/** Error codes set on `VerificationResult.metadata.error` when `verifyEmail` cannot deliver a definitive verdict. */
|
|
5
3
|
export declare enum VerificationErrorCode {
|
|
6
4
|
invalidFormat = "INVALID_FORMAT",
|
|
7
5
|
invalidDomain = "INVALID_DOMAIN",
|
|
@@ -9,14 +7,9 @@ export declare enum VerificationErrorCode {
|
|
|
9
7
|
smtpConnectionFailed = "SMTP_CONNECTION_FAILED",
|
|
10
8
|
smtpTimeout = "SMTP_TIMEOUT",
|
|
11
9
|
mailboxNotFound = "MAILBOX_NOT_FOUND",
|
|
12
|
-
mailboxFull = "MAILBOX_FULL",
|
|
13
10
|
networkError = "NETWORK_ERROR",
|
|
14
|
-
disposableEmail = "DISPOSABLE_EMAIL"
|
|
15
|
-
freeEmailProvider = "FREE_EMAIL_PROVIDER"
|
|
11
|
+
disposableEmail = "DISPOSABLE_EMAIL"
|
|
16
12
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Main verification result interface (flat structure)
|
|
19
|
-
*/
|
|
20
13
|
/** Discriminator for `VerificationStep.kind`. */
|
|
21
14
|
export type VerificationStepKind = 'syntax' | 'domain-validation' | 'name-detection' | 'domain-suggestion' | 'disposable' | 'free' | 'mx-lookup' | 'smtp-probe' | 'whois-age' | 'whois-registration';
|
|
22
15
|
/**
|
|
@@ -55,10 +48,7 @@ export interface VerificationResult {
|
|
|
55
48
|
isDeliverable?: boolean;
|
|
56
49
|
/** Whether the email/account is disabled */
|
|
57
50
|
isDisabled?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Always populated by `verifyEmail`. Optional in older shapes is gone —
|
|
60
|
-
* callers can read it directly without optional chaining.
|
|
61
|
-
*/
|
|
51
|
+
/** Always populated by `verifyEmail` — read directly without optional chaining. */
|
|
62
52
|
metadata: {
|
|
63
53
|
verificationTime: number;
|
|
64
54
|
cached: boolean;
|
|
@@ -199,9 +189,14 @@ export interface SmtpVerificationResult {
|
|
|
199
189
|
/**
|
|
200
190
|
* Short reason key when `isDeliverable === false`. Vocabulary:
|
|
201
191
|
* `not_found` | `over_quota` | `temporary_failure` | `ambiguous` |
|
|
202
|
-
* `connection_error` | `connection_timeout` | `
|
|
203
|
-
* `
|
|
204
|
-
* `
|
|
192
|
+
* `connection_error` | `connection_timeout` | `connection_closed` |
|
|
193
|
+
* `tls_upgrade_failed` | `tls_handshake_failed` |
|
|
194
|
+
* `ehlo_failed` | `helo_failed` | `mail_from_rejected` |
|
|
195
|
+
* `no_greeting` | `no_mx_records` | `unrecognized_response` |
|
|
196
|
+
* `step_timeout` | `socket_timeout`
|
|
197
|
+
*
|
|
198
|
+
* Pass to `refineReasonByEnhancedStatus(error, enhancedStatus)` for a
|
|
199
|
+
* richer (mailbox-status-aware) reason when the MX returned a DSN.
|
|
205
200
|
*/
|
|
206
201
|
error?: string;
|
|
207
202
|
/** Most recent 3-digit SMTP code observed during the probe. */
|
|
@@ -268,14 +263,16 @@ export interface SMTPTLSConfig {
|
|
|
268
263
|
minVersion?: 'TLSv1.2' | 'TLSv1.3';
|
|
269
264
|
}
|
|
270
265
|
/**
|
|
271
|
-
* SMTP protocol steps
|
|
272
|
-
*
|
|
273
|
-
*
|
|
266
|
+
* SMTP protocol steps walked by the verifier in order. `startTls` is a
|
|
267
|
+
* conditional step — it sends the STARTTLS command and upgrades the socket
|
|
268
|
+
* to TLS when the MX advertised support (controlled by
|
|
269
|
+
* `SMTPVerifyOptions.startTls`). On implicit-TLS ports (465) it's a no-op.
|
|
274
270
|
*/
|
|
275
271
|
export declare enum SMTPStep {
|
|
276
272
|
greeting = "GREETING",
|
|
277
273
|
ehlo = "EHLO",
|
|
278
274
|
helo = "HELO",
|
|
275
|
+
startTls = "STARTTLS",
|
|
279
276
|
mailFrom = "MAIL_FROM",
|
|
280
277
|
rcptTo = "RCPT_TO"
|
|
281
278
|
}
|
|
@@ -323,6 +320,18 @@ export interface SMTPVerifyOptions {
|
|
|
323
320
|
* - `'force'`: pipeline without checking — testing escape hatch.
|
|
324
321
|
*/
|
|
325
322
|
pipelining?: 'auto' | 'never' | 'force';
|
|
323
|
+
/**
|
|
324
|
+
* Controls STARTTLS upgrade on plaintext ports (25, 587). Implicit-TLS
|
|
325
|
+
* ports (465) ignore this option — they're already TLS from the start.
|
|
326
|
+
*
|
|
327
|
+
* - `'auto'` (default): upgrade if the MX advertises STARTTLS in EHLO.
|
|
328
|
+
* Submission-port (587) MXes typically require this — without it,
|
|
329
|
+
* `MAIL FROM` is rejected with `530 Must issue STARTTLS first`.
|
|
330
|
+
* - `'never'`: never upgrade — send `MAIL FROM` / `RCPT TO` in plaintext.
|
|
331
|
+
* - `'force'`: send `STARTTLS` unconditionally. Fails with
|
|
332
|
+
* `tls_upgrade_failed` when the MX doesn't support it. Testing only.
|
|
333
|
+
*/
|
|
334
|
+
startTls?: 'auto' | 'never' | 'force';
|
|
326
335
|
}
|
|
327
336
|
export interface VerifyMailboxSMTPParams {
|
|
328
337
|
local: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emailcheck/email-validator-js",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Advanced email validation with MX records, SMTP verification, disposable email detection, batch processing, and caching. Production-ready with TypeScript support.",
|
|
6
6
|
"keywords": [
|