zynor 0.0.73 → 0.0.77
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/dist/index.cjs +2 -2
- package/dist/index.d.ts +53 -13
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2100,22 +2100,38 @@ type ProviderName$1 = typeof records[number]["name"] | ProviderNames;
|
|
|
2100
2100
|
* Logger signature for debug output. Receives one preformatted line per event.
|
|
2101
2101
|
*/
|
|
2102
2102
|
export type DebugLogger = (line: string) => void;
|
|
2103
|
+
/**
|
|
2104
|
+
* Verbosity level for debug logging.
|
|
2105
|
+
* - `info` — top-level checkpoints only: validate() enter/exit, MX result,
|
|
2106
|
+
* shallow/deep/Invalid outcome, deep-validation enter/exit,
|
|
2107
|
+
* validateBulk phase boundaries. Best for spotting *where* a hang
|
|
2108
|
+
* occurs without drowning in noise.
|
|
2109
|
+
* - `debug` — adds sub-operations: cache hits/misses, MX→record matches,
|
|
2110
|
+
* domain_check probes, dnsLookup per-IP iteration, IP-cascade
|
|
2111
|
+
* HTTP calls, per-EmailProviders match.
|
|
2112
|
+
* - `trace` — adds every event: inflight hit/cleared, per-mx loop iterations,
|
|
2113
|
+
* per-worker bulk progress, syntax/rejected/disposable early
|
|
2114
|
+
* returns. Use only when `debug` doesn't pinpoint the issue.
|
|
2115
|
+
*/
|
|
2116
|
+
export type DebugLevel = "info" | "debug" | "trace";
|
|
2103
2117
|
export interface ValidationConfig {
|
|
2104
2118
|
/**
|
|
2105
|
-
*
|
|
2106
|
-
* validation flow (cache hits/misses, MX resolution, MX-record matches,
|
|
2107
|
-
* domain_check probes, deep-validation phases, IP-lookup cascade,
|
|
2108
|
-
* inflight enter/exit). Useful for diagnosing slow or stalled calls.
|
|
2119
|
+
* Structured debug logging for the validation flow. Off by default.
|
|
2109
2120
|
*
|
|
2110
|
-
* - `true` — log to stderr via `console.error`
|
|
2111
|
-
* - `(line: string) => void` — receive each line as a string
|
|
2112
2121
|
* - `false` / omitted — silent (no overhead)
|
|
2122
|
+
* - `true` — `info` level, logged to stderr via `console.error`
|
|
2123
|
+
* - `'info' | 'debug' | 'trace'` — that level on stderr
|
|
2124
|
+
* - `(line: string) => void` — `trace` level, each line passed to fn
|
|
2125
|
+
* - `{ level, log }` — both explicit
|
|
2113
2126
|
*
|
|
2114
|
-
* Each line is `[zynor HH:MM:SS.mmm] <scope>: <msg>`.
|
|
2127
|
+
* Each line is `[zynor HH:MM:SS.mmm <LEVEL>] <scope>: <msg>`.
|
|
2115
2128
|
*
|
|
2116
2129
|
* @default false
|
|
2117
2130
|
*/
|
|
2118
|
-
debug?: boolean | DebugLogger
|
|
2131
|
+
debug?: boolean | DebugLevel | DebugLogger | {
|
|
2132
|
+
level?: DebugLevel;
|
|
2133
|
+
log?: DebugLogger;
|
|
2134
|
+
};
|
|
2119
2135
|
/**
|
|
2120
2136
|
* @description This will enable deep validation of the email. slower than normal email validator as it triggers multiple dns requests, or travel to the ip address to get the domain name.
|
|
2121
2137
|
* This is per request option, passing true to the getProvider without turning this ON, it wont work and vice versa.
|
|
@@ -2182,6 +2198,8 @@ export declare class EmailValidator {
|
|
|
2182
2198
|
private ipCache;
|
|
2183
2199
|
private inflight;
|
|
2184
2200
|
private _logFn;
|
|
2201
|
+
/** 0=silent, 1=info, 2=debug, 3=trace */
|
|
2202
|
+
private _logLevel;
|
|
2185
2203
|
private validationConfig;
|
|
2186
2204
|
constructor(config?: {
|
|
2187
2205
|
options?: ValidationConfig;
|
|
@@ -2257,11 +2275,33 @@ export declare class EmailValidator {
|
|
|
2257
2275
|
logo?: boolean;
|
|
2258
2276
|
}): Promise<EmailResponse>;
|
|
2259
2277
|
/**
|
|
2260
|
-
* Emit a
|
|
2261
|
-
* Format: `[zynor HH:MM:SS.mmm] <scope>: <msg>`.
|
|
2262
|
-
*
|
|
2263
|
-
|
|
2264
|
-
|
|
2278
|
+
* Emit a log line if its level is at or below the configured threshold.
|
|
2279
|
+
* Format: `[zynor HH:MM:SS.mmm <LVL>] <scope>: <msg>`. Zero formatting
|
|
2280
|
+
* cost when level is filtered out.
|
|
2281
|
+
*
|
|
2282
|
+
* Use the typed wrappers (`_info`/`_debug`/`_trace`) — they make every
|
|
2283
|
+
* call site self-document its expected verbosity.
|
|
2284
|
+
*/
|
|
2285
|
+
private _emit;
|
|
2286
|
+
/** Top-level checkpoint (validate enter/exit, MX result, terminal outcome). */
|
|
2287
|
+
private _info;
|
|
2288
|
+
/** Sub-operation (cache hit/miss, network call start/end, sub-loop boundary). */
|
|
2289
|
+
private _debug;
|
|
2290
|
+
/** Fine-grained event (singleflight cleanup, per-iteration loop, early returns). */
|
|
2291
|
+
private _trace;
|
|
2292
|
+
/**
|
|
2293
|
+
* Belt-and-suspenders timeout for DNS calls. Races the underlying
|
|
2294
|
+
* operation against a `setTimeout`-based watchdog so a hung c-ares
|
|
2295
|
+
* query (or a broken AbortSignal propagation) cannot pin the inflight
|
|
2296
|
+
* Map indefinitely. The leaked DNS promise continues running in the
|
|
2297
|
+
* background — c-ares eventually abandons it on its own — but the
|
|
2298
|
+
* wrapper rejects on time and the inflight key is always cleared.
|
|
2299
|
+
*
|
|
2300
|
+
* Logged at INFO so the watchdog firing is visible at default
|
|
2301
|
+
* `debug: true`; the `WATCHDOG fired` line tells you which domain is
|
|
2302
|
+
* misbehaving.
|
|
2303
|
+
*/
|
|
2304
|
+
private _withWatchdog;
|
|
2265
2305
|
/**
|
|
2266
2306
|
* Build a Valid response with `websiteTitle` and optional `loginUrl`
|
|
2267
2307
|
* populated from the provider maps in ./provider-webmail.
|