zynor 0.1.0 → 0.1.2

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/native.d.ts CHANGED
@@ -724,6 +724,15 @@ declare class NativeProvider {
724
724
  resolveCaa(hostname: string, options?: AbortOptions): Promise<CaaRecord[]>;
725
725
  resolveCname(hostname: string, options?: AbortOptions): Promise<string[]>;
726
726
  resolveMx(hostname: string, options?: AbortOptions): Promise<MxRecord[]>;
727
+ /**
728
+ * @internal Resolve MX for many hostnames at once. With the Rust binding
729
+ * this is a SINGLE FFI call for the whole array (concurrency handled inside
730
+ * Rust) — the lever that collapses per-email boundary crossings. Without
731
+ * the binding it falls back to parallel libuv calls (same shape, no FFI
732
+ * win). Per-host failures yield `[]` in that slot; never rejects wholesale.
733
+ * Not queued — the caller governs concurrency at the page level.
734
+ */
735
+ resolveMxBatch(hostnames: string[], options?: AbortOptions): Promise<MxRecord[][]>;
727
736
  resolveNaptr(hostname: string, options?: AbortOptions): Promise<NaptrRecord[]>;
728
737
  resolveNs(hostname: string, options?: AbortOptions): Promise<string[]>;
729
738
  resolvePtr(hostname: string, options?: AbortOptions): Promise<string[]>;
@@ -2158,6 +2167,10 @@ declare const records: readonly [
2158
2167
  readonly name: "Turbify";
2159
2168
  readonly mx: "mx-biz.mail.am0.yahoodns.net";
2160
2169
  },
2170
+ {
2171
+ readonly name: "Turbify";
2172
+ readonly mx: "mx-van.mail.am0.yahoodns.net";
2173
+ },
2161
2174
  {
2162
2175
  readonly name: "Turbify";
2163
2176
  readonly mx: "mx-biz.mail.am.yahoodns.net";
@@ -2650,7 +2663,7 @@ declare class EmailValidator {
2650
2663
  private yahooList;
2651
2664
  private domain;
2652
2665
  private static instance;
2653
- private dns;
2666
+ protected dns: Zynor;
2654
2667
  private validateCache;
2655
2668
  private ipCache;
2656
2669
  private inflight;
@@ -3302,6 +3315,9 @@ export interface RustAnyRecord {
3302
3315
  }
3303
3316
  export interface RustBinding {
3304
3317
  resolveMx(hostname: string, options?: RustResolveOptions | null): Promise<RustMxRecord[]>;
3318
+ /** Resolve MX for many hostnames in one FFI call. `out[i]` ↔ `hostnames[i]`;
3319
+ * a per-host failure yields `[]` for that slot (never rejects wholesale). */
3320
+ resolveMxBatch(hostnames: string[], options?: RustResolveOptions | null): Promise<RustMxRecord[][]>;
3305
3321
  resolveA(hostname: string, options?: RustResolveOptions | null): Promise<string[]>;
3306
3322
  resolveAaaa(hostname: string, options?: RustResolveOptions | null): Promise<string[]>;
3307
3323
  resolveCname(hostname: string, options?: RustResolveOptions | null): Promise<string[]>;
@@ -3667,6 +3683,19 @@ declare class Zynor {
3667
3683
  * consumers must continue to use the queued resolve* methods.
3668
3684
  */
3669
3685
  _resolveDirect<T>(hostname: string, type: RecordType, options?: AbortOptions): Promise<T>;
3686
+ /**
3687
+ * @internal Validator-only (native `each`). Resolve MX for many hostnames in
3688
+ * a SINGLE batched call and seed the DNS LRU cache under the same `MX:<host>`
3689
+ * keys that {@link _resolveDirect} reads. After warming, each per-email MX
3690
+ * lookup is a cache hit — zero FFI per email. This is what collapses millions
3691
+ * of per-email native crossings into one batched call per page.
3692
+ *
3693
+ * No-op when the cache is disabled (the default `zynor` validator runs with
3694
+ * `cache: { enabled: false }`, so this is only effective for the native
3695
+ * entry, which enables it). Never throws — a batch failure just leaves the
3696
+ * cache cold and validation falls back to per-email resolution.
3697
+ */
3698
+ _warmMxCache(hostnames: string[], options?: AbortOptions): Promise<void>;
3670
3699
  /**
3671
3700
  * Returns the sum of concurrency limits across all enabled DNS providers.
3672
3701
  * Used by `validateBulk` to determine default parallelism.
@@ -3747,6 +3776,31 @@ declare class Zynor$1 extends Zynor {
3747
3776
  */
3748
3777
  declare class EmailValidator$1 extends EmailValidator {
3749
3778
  protected createDns(config?: Omit<ZynorConfig, "cache">): Zynor$1;
3779
+ /**
3780
+ * Page-based streaming override of {@link BaseEmailValidator.each}.
3781
+ *
3782
+ * The default (libuv) `each` does one DNS lookup per email — millions of
3783
+ * native (napi) crossings for a large list, which can exhaust the host
3784
+ * runtime. This native variant processes a page at a time: it resolves
3785
+ * every unique domain in the page with ONE batched FFI call (warming the
3786
+ * resolver's MX cache), then validates the page reading from that warm
3787
+ * cache (zero FFI per email), then emits the completed page. Awaiting
3788
+ * `onBatch` before the next page is natural backpressure — memory stays
3789
+ * bounded to a single page.
3790
+ *
3791
+ * Same surface and semantics as the base: `perPage`/`concurrency`
3792
+ * defaults, per-email errors become error-shaped results (never abort the
3793
+ * run), an `onBatch` throw aborts and rejects, and an aborted signal stops
3794
+ * cleanly without emitting a partial page.
3795
+ */
3796
+ each(emails: string[], options: {
3797
+ concurrency?: number;
3798
+ perPage?: number;
3799
+ deep?: boolean;
3800
+ logo?: boolean;
3801
+ signal?: AbortSignal;
3802
+ timeout?: number;
3803
+ } | undefined, onBatch: (batch: EmailResponse[]) => void | Promise<void>): Promise<void>;
3750
3804
  }
3751
3805
  export declare const resetDefaultResolver: () => void;
3752
3806
  export declare const setDefaultResolver: (resolver: Zynor$1) => void;