zynor 0.0.97 → 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";
@@ -2233,7 +2246,7 @@ declare const records: readonly [
2233
2246
  readonly mx: ".office365.com";
2234
2247
  },
2235
2248
  {
2236
- readonly name: "Gmail";
2249
+ readonly name: "Google Workspace";
2237
2250
  readonly mx: ".google.com";
2238
2251
  },
2239
2252
  {
@@ -2544,6 +2557,10 @@ declare const records: readonly [
2544
2557
  readonly name: "cPanel Webmail";
2545
2558
  readonly mx: "..................";
2546
2559
  },
2560
+ {
2561
+ readonly name: "Office (OWA)";
2562
+ readonly mx: "..................";
2563
+ },
2547
2564
  {
2548
2565
  readonly name: "Disposable";
2549
2566
  readonly mx: "..................";
@@ -2646,7 +2663,7 @@ declare class EmailValidator {
2646
2663
  private yahooList;
2647
2664
  private domain;
2648
2665
  private static instance;
2649
- private dns;
2666
+ protected dns: Zynor;
2650
2667
  private validateCache;
2651
2668
  private ipCache;
2652
2669
  private inflight;
@@ -3298,6 +3315,9 @@ export interface RustAnyRecord {
3298
3315
  }
3299
3316
  export interface RustBinding {
3300
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[][]>;
3301
3321
  resolveA(hostname: string, options?: RustResolveOptions | null): Promise<string[]>;
3302
3322
  resolveAaaa(hostname: string, options?: RustResolveOptions | null): Promise<string[]>;
3303
3323
  resolveCname(hostname: string, options?: RustResolveOptions | null): Promise<string[]>;
@@ -3663,6 +3683,19 @@ declare class Zynor {
3663
3683
  * consumers must continue to use the queued resolve* methods.
3664
3684
  */
3665
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>;
3666
3699
  /**
3667
3700
  * Returns the sum of concurrency limits across all enabled DNS providers.
3668
3701
  * Used by `validateBulk` to determine default parallelism.
@@ -3743,6 +3776,31 @@ declare class Zynor$1 extends Zynor {
3743
3776
  */
3744
3777
  declare class EmailValidator$1 extends EmailValidator {
3745
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>;
3746
3804
  }
3747
3805
  export declare const resetDefaultResolver: () => void;
3748
3806
  export declare const setDefaultResolver: (resolver: Zynor$1) => void;