zynor 0.0.68 → 0.0.73

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.d.ts CHANGED
@@ -2096,7 +2096,26 @@ declare const records: readonly [
2096
2096
  }
2097
2097
  ];
2098
2098
  type ProviderName$1 = typeof records[number]["name"] | ProviderNames;
2099
+ /**
2100
+ * Logger signature for debug output. Receives one preformatted line per event.
2101
+ */
2102
+ export type DebugLogger = (line: string) => void;
2099
2103
  export interface ValidationConfig {
2104
+ /**
2105
+ * Enable structured debug logging for every async boundary in the
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.
2109
+ *
2110
+ * - `true` — log to stderr via `console.error`
2111
+ * - `(line: string) => void` — receive each line as a string
2112
+ * - `false` / omitted — silent (no overhead)
2113
+ *
2114
+ * Each line is `[zynor HH:MM:SS.mmm] <scope>: <msg>`.
2115
+ *
2116
+ * @default false
2117
+ */
2118
+ debug?: boolean | DebugLogger;
2100
2119
  /**
2101
2120
  * @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.
2102
2121
  * This is per request option, passing true to the getProvider without turning this ON, it wont work and vice versa.
@@ -2162,6 +2181,7 @@ export declare class EmailValidator {
2162
2181
  private validateCache;
2163
2182
  private ipCache;
2164
2183
  private inflight;
2184
+ private _logFn;
2165
2185
  private validationConfig;
2166
2186
  constructor(config?: {
2167
2187
  options?: ValidationConfig;
@@ -2236,6 +2256,12 @@ export declare class EmailValidator {
2236
2256
  deep?: boolean;
2237
2257
  logo?: boolean;
2238
2258
  }): Promise<EmailResponse>;
2259
+ /**
2260
+ * Emit a debug line if `validationConfig.debug` is enabled.
2261
+ * Format: `[zynor HH:MM:SS.mmm] <scope>: <msg>`. No-op (and zero string
2262
+ * formatting cost) when logging is off.
2263
+ */
2264
+ private _log;
2239
2265
  /**
2240
2266
  * Build a Valid response with `websiteTitle` and optional `loginUrl`
2241
2267
  * populated from the provider maps in ./provider-webmail.